Commit | Line | Data |
---|---|---|
cebe22cb KB |
1 | .\" Copyright (c) 1988 The Regents of the University of California. |
2 | .\" All rights reserved. | |
3 | .\" | |
91cff1e1 | 4 | .\" %sccs.include.redist.man% |
cebe22cb | 5 | .\" |
91cff1e1 | 6 | .\" @(#)strtok.3 5.5 (Berkeley) %G% |
cebe22cb KB |
7 | .\" |
8 | .TH STRTOK 3 "" | |
9 | .UC 3 | |
10 | .SH NAME | |
11 | strtok, strsep \- string token operations | |
12 | .SH SYNOPSIS | |
13 | .nf | |
3cf67bdd | 14 | .ft B |
7b0a190c KB |
15 | #include <string.h> |
16 | ||
3cf67bdd KB |
17 | char * |
18 | strtok(char *str, const char *sep); | |
19 | .ft R | |
cebe22cb | 20 | .fi |
3cf67bdd KB |
21 | .SH DESCRIPTION |
22 | .ft B | |
23 | This interface is obsoleted by strsep(3). | |
24 | .ft R | |
cebe22cb KB |
25 | .PP |
26 | .I Strtok | |
27 | is used to isolate sequential tokens in a null-terminated string, | |
28 | .IR str . | |
29 | These tokens are separated in the string by | |
30 | .B "one or more" | |
31 | of the characters in | |
32 | .IR sep . | |
33 | The first time that | |
34 | .I strtok | |
35 | is called, | |
36 | .I str | |
37 | should be specified; subsequent calls, wishing to obtain further tokens | |
3cf67bdd KB |
38 | from the same string, should pass a null pointer instead. |
39 | The separator string, | |
cebe22cb KB |
40 | .IR sep , |
41 | must be supplied each time, and may change between calls. | |
3cf67bdd | 42 | .PP |
cebe22cb KB |
43 | .I Strtok |
44 | returns a pointer to the start of each subsequent token in the string, | |
3cf67bdd KB |
45 | after replacing the token itself with a NUL character. |
46 | When no more tokens remain, a null pointer is returned. | |
47 | .SH SEE ALSO | |
48 | index(3), memchr(3), rindex(3), strchr(3), strcspn(3), strpbrk(3), strrchr(3), | |
49 | strsep(3), strspn(3), strstr(3) | |
50 | .SH STANDARDS | |
51 | .B Strtok | |
52 | conforms to ANSI X3.159-1989 (``ANSI C''). | |
cebe22cb KB |
53 | .SH BUGS |
54 | There is no way to get tokens from multiple strings simultaneously. | |
80ed8d03 | 55 | .PP |
3cf67bdd KB |
56 | The System V |
57 | .B strtok | |
58 | will, if handed a string containing only delimiter characters, | |
59 | not alter the next starting point, so that a call to | |
60 | .B strtok | |
61 | with a different (or empty) delimiter string | |
62 | may return a non-NULL value. | |
63 | Since this implementation always alters the next starting point, | |
64 | such a sequence of calls would always return NULL. |