diff options
author | aaron <> | 1999-06-04 16:39:27 +0000 |
---|---|---|
committer | aaron <> | 1999-06-04 16:39:27 +0000 |
commit | a75229263ddbca710a9fdffc776c5bfdad7c5dfe (patch) | |
tree | 60eab3a5c0bcfe1db43016ec60310396d25c1d4d /src | |
parent | 4bf5bc4f4e34f89a6946a6bca47ab5d0eb2e4e09 (diff) | |
download | openbsd-a75229263ddbca710a9fdffc776c5bfdad7c5dfe.tar.gz openbsd-a75229263ddbca710a9fdffc776c5bfdad7c5dfe.tar.bz2 openbsd-a75229263ddbca710a9fdffc776c5bfdad7c5dfe.zip |
add an example, similar to the one in strspn.3
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libc/string/strcspn.3 | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/lib/libc/string/strcspn.3 b/src/lib/libc/string/strcspn.3 index 93c6d8f84c..de6aff5ebd 100644 --- a/src/lib/libc/string/strcspn.3 +++ b/src/lib/libc/string/strcspn.3 | |||
@@ -33,7 +33,7 @@ | |||
33 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 33 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
34 | .\" SUCH DAMAGE. | 34 | .\" SUCH DAMAGE. |
35 | .\" | 35 | .\" |
36 | .\" $OpenBSD: strcspn.3,v 1.2 1996/08/19 08:34:14 tholo Exp $ | 36 | .\" $OpenBSD: strcspn.3,v 1.3 1999/06/04 16:39:27 aaron Exp $ |
37 | .\" | 37 | .\" |
38 | .Dd June 29, 1991 | 38 | .Dd June 29, 1991 |
39 | .Dt STRCSPN 3 | 39 | .Dt STRCSPN 3 |
@@ -65,6 +65,20 @@ The | |||
65 | .Fn strcspn | 65 | .Fn strcspn |
66 | function | 66 | function |
67 | returns the number of characters spanned. | 67 | returns the number of characters spanned. |
68 | .Sh EXAMPLES | ||
69 | The following call to | ||
70 | .Fn strcspn | ||
71 | will return 3, since the first three characters of string | ||
72 | .Fa s | ||
73 | do not occur in string | ||
74 | .Fa charset : | ||
75 | .Bd -literal -offset indent | ||
76 | char *s = "foobar"; | ||
77 | char *charset = "bar"; | ||
78 | size_t span; | ||
79 | |||
80 | span = strcspn(s, charset); | ||
81 | .Ed | ||
68 | .Sh SEE ALSO | 82 | .Sh SEE ALSO |
69 | .Xr index 3 , | 83 | .Xr index 3 , |
70 | .Xr memchr 3 , | 84 | .Xr memchr 3 , |