summaryrefslogtreecommitdiff
path: root/src/lib/libc/string/strspn.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libc/string/strspn.3')
-rw-r--r--src/lib/libc/string/strspn.350
1 files changed, 31 insertions, 19 deletions
diff --git a/src/lib/libc/string/strspn.3 b/src/lib/libc/string/strspn.3
index 4de03aa58b..b1a2ae3014 100644
--- a/src/lib/libc/string/strspn.3
+++ b/src/lib/libc/string/strspn.3
@@ -1,3 +1,5 @@
1.\" $OpenBSD: strspn.3,v 1.10 2011/07/25 00:38:53 schwarze Exp $
2.\"
1.\" Copyright (c) 1990, 1991 The Regents of the University of California. 3.\" Copyright (c) 1990, 1991 The Regents of the University of California.
2.\" All rights reserved. 4.\" All rights reserved.
3.\" 5.\"
@@ -13,11 +15,7 @@
13.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" 2. Redistributions in binary form must reproduce the above copyright
14.\" notice, this list of conditions and the following disclaimer in the 16.\" notice, this list of conditions and the following disclaimer in the
15.\" documentation and/or other materials provided with the distribution. 17.\" documentation and/or other materials provided with the distribution.
16.\" 3. All advertising materials mentioning features or use of this software 18.\" 3. Neither the name of the University nor the names of its contributors
17.\" must display the following acknowledgement:
18.\" This product includes software developed by the University of
19.\" California, Berkeley and its contributors.
20.\" 4. Neither the name of the University nor the names of its contributors
21.\" may be used to endorse or promote products derived from this software 19.\" may be used to endorse or promote products derived from this software
22.\" without specific prior written permission. 20.\" without specific prior written permission.
23.\" 21.\"
@@ -33,10 +31,7 @@
33.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34.\" SUCH DAMAGE. 32.\" SUCH DAMAGE.
35.\" 33.\"
36.\" from: @(#)strspn.3 5.3 (Berkeley) 6/29/91 34.Dd $Mdocdate: July 25 2011 $
37.\" $Id: strspn.3,v 1.1.1.1 1995/10/18 08:42:23 deraadt Exp $
38.\"
39.Dd June 29, 1991
40.Dt STRSPN 3 35.Dt STRSPN 3
41.Os 36.Os
42.Sh NAME 37.Sh NAME
@@ -48,9 +43,8 @@
48.Fn strspn "const char *s" "const char *charset" 43.Fn strspn "const char *s" "const char *charset"
49.Sh DESCRIPTION 44.Sh DESCRIPTION
50The 45The
51.Xr strcspn 46.Fn strspn
52function 47function spans the initial part of the NUL-terminated string
53spans the initial part of the null-terminated string
54.Fa s 48.Fa s
55as long as the characters from 49as long as the characters from
56.Fa s 50.Fa s
@@ -59,22 +53,40 @@ occur in string
59.Sh RETURN VALUES 53.Sh RETURN VALUES
60The 54The
61.Fn strspn 55.Fn strspn
62function 56function returns the number of characters spanned.
63returns the number of characters spanned. 57.Sh EXAMPLES
58The following call to
59.Fn strspn
60will return 3, since the first three characters of string
61.Fa s
62are part of string
63.Fa charset :
64.Bd -literal -offset indent
65char *s = "foobar";
66char *charset = "of";
67size_t span;
68
69span = strspn(s, charset);
70.Ed
64.Sh SEE ALSO 71.Sh SEE ALSO
65.Xr index 3 ,
66.Xr memchr 3 , 72.Xr memchr 3 ,
67.Xr rindex 3 ,
68.Xr strchr 3 , 73.Xr strchr 3 ,
69.Xr strcspn 3 , 74.Xr strcspn 3 ,
70.Xr strpbrk 3 , 75.Xr strpbrk 3 ,
71.Xr strrchr 3 , 76.Xr strrchr 3 ,
72.Xr strsep 3 , 77.Xr strsep 3 ,
73.Xr strstr 3 , 78.Xr strstr 3 ,
74.Xr strtok 3 79.Xr strtok 3 ,
80.Xr wcsspn 3
75.Sh STANDARDS 81.Sh STANDARDS
76The 82The
77.Fn strspn 83.Fn strspn
78function 84function conforms to
79conforms to
80.St -ansiC . 85.St -ansiC .
86.Sh HISTORY
87The
88.Fn strspn
89function first appeared in
90.At III
91and was reimplemented for
92.Bx 4.3 Tahoe .