summaryrefslogtreecommitdiff
path: root/lib/libc/string/strspn.3
diff options
context:
space:
mode:
authorAllan Jude <allanjude@FreeBSD.org>2014-05-25 18:40:32 +0000
committerAllan Jude <allanjude@FreeBSD.org>2014-05-25 18:40:32 +0000
commit5538d7a1fc220d2f44ee8e837106edd066ddb202 (patch)
treeb68ad46d17d88792d8e3f25f5f37179713899603 /lib/libc/string/strspn.3
parent6736336e88b1664347c3d3fabd55374cac68e4ab (diff)
Notes
Diffstat (limited to 'lib/libc/string/strspn.3')
-rw-r--r--lib/libc/string/strspn.344
1 files changed, 35 insertions, 9 deletions
diff --git a/lib/libc/string/strspn.3 b/lib/libc/string/strspn.3
index 2ba6a6b5575ae..605e54f84f03f 100644
--- a/lib/libc/string/strspn.3
+++ b/lib/libc/string/strspn.3
@@ -32,11 +32,12 @@
.\" @(#)strspn.3 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd June 4, 1993
+.Dd May 24, 2014
.Dt STRSPN 3
.Os
.Sh NAME
-.Nm strspn
+.Nm strspn ,
+.Nm strcspn
.Nd span a string
.Sh LIBRARY
.Lb libc
@@ -44,6 +45,8 @@
.In string.h
.Ft size_t
.Fn strspn "const char *s" "const char *charset"
+.Ft size_t
+.Fn strcspn "const char *s" "const char *charset"
.Sh DESCRIPTION
The
.Fn strspn
@@ -54,22 +57,43 @@ as long as the characters from
.Fa s
occur in the null-terminated string
.Fa charset .
-In other words, it computes the string array index in
-.Fa s
+In other words, it computes the string array index
of the first character of
.Fa s
which is not in
.Fa charset ,
else the index of the first null character.
+.Pp
+The
+.Fn strcspn
+function
+spans the initial part of the null-terminated string
+.Fa s
+as long as the characters from
+.Fa s
+do not occur in the null-terminated string
+.Fa charset
+(it
+spans the
+.Em complement
+of
+.Fa charset ) .
+In other words, it computes the string array index
+of the first character of
+.Fa s
+which is also in
+.Fa charset ,
+else the index of the first null character.
.Sh RETURN VALUES
The
.Fn strspn
-function
-returns the number of characters spanned.
+and
+.Fn strcspn
+functions
+return the number of characters spanned.
.Sh SEE ALSO
.Xr memchr 3 ,
.Xr strchr 3 ,
-.Xr strcspn 3 ,
.Xr strpbrk 3 ,
.Xr strrchr 3 ,
.Xr strsep 3 ,
@@ -79,6 +103,8 @@ returns the number of characters spanned.
.Sh STANDARDS
The
.Fn strspn
-function
-conforms to
+and
+.Fn strcspn
+functions
+conform to
.St -isoC .