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.327
1 files changed, 15 insertions, 12 deletions
diff --git a/src/lib/libc/string/strtok.3 b/src/lib/libc/string/strtok.3
index fa2ec28cf0..143ffc2e42 100644
--- a/src/lib/libc/string/strtok.3
+++ b/src/lib/libc/string/strtok.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: strtok.3,v 1.10 1999/11/09 11:20:13 art Exp $ 36.\" $OpenBSD: strtok.3,v 1.11 2000/04/21 15:24:20 aaron Exp $
37.\" 37.\"
38.Dd June 29, 1991 38.Dd June 29, 1991
39.Dt STRTOK 3 39.Dt STRTOK 3
@@ -55,8 +55,7 @@ This interface is obsoleted by
55.Pp 55.Pp
56The 56The
57.Fn strtok 57.Fn strtok
58function 58function is used to isolate sequential tokens in a null-terminated string,
59is used to isolate sequential tokens in a null-terminated string,
60.Fa str . 59.Fa str .
61These tokens are separated in the string by at least one of the 60These tokens are separated in the string by at least one of the
62characters in 61characters in
@@ -81,9 +80,8 @@ The
81.Fn strtok 80.Fn strtok
82and 81and
83.Fn strtok_r 82.Fn strtok_r
84functions 83functions return a pointer to the beginning of each subsequent token
85return a pointer to the beginning of each subsequent token in the string, 84in the string, after replacing the separator character itself with an
86after replacing the separator character itself with an
87.Tn ASCII NUL 85.Tn ASCII NUL
88character. 86character.
89When no more tokens remain, a null pointer is returned. 87When no more tokens remain, a null pointer is returned.
@@ -116,13 +114,19 @@ for ((p = strtok_r(s, " ", &last)); p; (p = strtok_r(NULL, " ", &last)), i++) {
116tokens[i] = '\e0'; 114tokens[i] = '\e0';
117.Ed 115.Ed
118.Pp 116.Pp
119That is, tokens[0] will point to 117That is,
118.Li tokens[0]
119will point to
120.Qq cat , 120.Qq cat ,
121tokens[1] will point to 121.Li tokens[1]
122will point to
122.Qq dog , 123.Qq dog ,
123tokens[2] will point to 124.Li tokens[2]
125will point to
124.Qq horse , 126.Qq horse ,
125and tokens[3] will point to 127and
128.Li tokens[3]
129will point to
126.Qq cow . 130.Qq cow .
127.Sh SEE ALSO 131.Sh SEE ALSO
128.Xr memchr 3 , 132.Xr memchr 3 ,
@@ -136,8 +140,7 @@ and tokens[3] will point to
136.Sh STANDARDS 140.Sh STANDARDS
137The 141The
138.Fn strtok 142.Fn strtok
139function 143function conforms to
140conforms to
141.St -ansiC . 144.St -ansiC .
142.Sh BUGS 145.Sh BUGS
143The System V 146The System V