summaryrefslogtreecommitdiff
path: root/src/lib/libc/string/strtok.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libc/string/strtok.3')
-rw-r--r--src/lib/libc/string/strtok.338
1 files changed, 26 insertions, 12 deletions
diff --git a/src/lib/libc/string/strtok.3 b/src/lib/libc/string/strtok.3
index ed7d5158ed..fbf0abfc26 100644
--- a/src/lib/libc/string/strtok.3
+++ b/src/lib/libc/string/strtok.3
@@ -1,3 +1,5 @@
1.\" $OpenBSD: strtok.3,v 1.20 2011/07/25 00:38:53 schwarze Exp $
2.\"
1.\" Copyright (c) 1988, 1991 The Regents of the University of California. 3.\" Copyright (c) 1988, 1991 The Regents of the University of California.
2.\" All rights reserved. 4.\" All rights reserved.
3.\" 5.\"
@@ -29,9 +31,7 @@
29.\" 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
30.\" SUCH DAMAGE. 32.\" SUCH DAMAGE.
31.\" 33.\"
32.\" $OpenBSD: strtok.3,v 1.19 2007/05/31 19:19:32 jmc Exp $ 34.Dd $Mdocdate: July 25 2011 $
33.\"
34.Dd $Mdocdate: May 31 2007 $
35.Dt STRTOK 3 35.Dt STRTOK 3
36.Os 36.Os
37.Sh NAME 37.Sh NAME
@@ -73,6 +73,14 @@ function is a version of
73.Fn strtok 73.Fn strtok
74that takes an explicit context argument and is reentrant. 74that takes an explicit context argument and is reentrant.
75.Pp 75.Pp
76Since
77.Fn strtok
78and
79.Fn strtok_r
80modify the string,
81.Fa str
82should not point to an area in the initialized data segment.
83.Sh RETURN VALUES
76The 84The
77.Fn strtok 85.Fn strtok
78and 86and
@@ -82,14 +90,6 @@ in the string, after replacing the separator character itself with an
82.Tn ASCII NUL 90.Tn ASCII NUL
83character. 91character.
84When no more tokens remain, a null pointer is returned. 92When no more tokens remain, a null pointer is returned.
85.Pp
86Since
87.Fn strtok
88and
89.Fn strtok_r
90modify the string,
91.Fa str
92should not point to an area in the initialized data segment.
93.Sh EXAMPLES 93.Sh EXAMPLES
94The following will construct an array of pointers to each individual word in 94The following will construct an array of pointers to each individual word in
95the string 95the string
@@ -133,12 +133,26 @@ will point to
133.Xr strrchr 3 , 133.Xr strrchr 3 ,
134.Xr strsep 3 , 134.Xr strsep 3 ,
135.Xr strspn 3 , 135.Xr strspn 3 ,
136.Xr strstr 3 136.Xr strstr 3 ,
137.Xr wcstok 3
137.Sh STANDARDS 138.Sh STANDARDS
138The 139The
139.Fn strtok 140.Fn strtok
140function conforms to 141function conforms to
141.St -ansiC . 142.St -ansiC .
143.Sh HISTORY
144The
145.Fn strtok
146function first appeared in
147.At III
148and was reimplemented for
149.Bx 4.3 Tahoe .
150The
151.Fn strtok_r
152function first appeared in
153.Nx 1.3
154and was reimplemented for
155.Ox 2.7 .
142.Sh BUGS 156.Sh BUGS
143The System V 157The System V
144.Fn strtok , 158.Fn strtok ,