Commit | Line | Data |
---|---|---|
cebe22cb KB |
1 | .\" Copyright (c) 1988 The Regents of the University of California. |
2 | .\" All rights reserved. | |
3 | .\" | |
4 | .\" Redistribution and use in source and binary forms are permitted | |
5 | .\" provided that the above copyright notice and this paragraph are | |
6 | .\" duplicated in all such forms and that any documentation, | |
7 | .\" advertising materials, and other materials related to such | |
8 | .\" distribution and use acknowledge that the software was developed | |
9 | .\" by the University of California, Berkeley. The name of the | |
10 | .\" University may not be used to endorse or promote products derived | |
11 | .\" from this software without specific prior written permission. | |
12 | .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR | |
13 | .\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | |
14 | .\" WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
15 | .\" | |
7b0a190c | 16 | .\" @(#)strtok.3 5.4 (Berkeley) %G% |
cebe22cb KB |
17 | .\" |
18 | .TH STRTOK 3 "" | |
19 | .UC 3 | |
20 | .SH NAME | |
21 | strtok, strsep \- string token operations | |
22 | .SH SYNOPSIS | |
23 | .nf | |
3cf67bdd | 24 | .ft B |
7b0a190c KB |
25 | #include <string.h> |
26 | ||
3cf67bdd KB |
27 | char * |
28 | strtok(char *str, const char *sep); | |
29 | .ft R | |
cebe22cb | 30 | .fi |
3cf67bdd KB |
31 | .SH DESCRIPTION |
32 | .ft B | |
33 | This interface is obsoleted by strsep(3). | |
34 | .ft R | |
cebe22cb KB |
35 | .PP |
36 | .I Strtok | |
37 | is used to isolate sequential tokens in a null-terminated string, | |
38 | .IR str . | |
39 | These tokens are separated in the string by | |
40 | .B "one or more" | |
41 | of the characters in | |
42 | .IR sep . | |
43 | The first time that | |
44 | .I strtok | |
45 | is called, | |
46 | .I str | |
47 | should be specified; subsequent calls, wishing to obtain further tokens | |
3cf67bdd KB |
48 | from the same string, should pass a null pointer instead. |
49 | The separator string, | |
cebe22cb KB |
50 | .IR sep , |
51 | must be supplied each time, and may change between calls. | |
3cf67bdd | 52 | .PP |
cebe22cb KB |
53 | .I Strtok |
54 | returns a pointer to the start of each subsequent token in the string, | |
3cf67bdd KB |
55 | after replacing the token itself with a NUL character. |
56 | When no more tokens remain, a null pointer is returned. | |
57 | .SH SEE ALSO | |
58 | index(3), memchr(3), rindex(3), strchr(3), strcspn(3), strpbrk(3), strrchr(3), | |
59 | strsep(3), strspn(3), strstr(3) | |
60 | .SH STANDARDS | |
61 | .B Strtok | |
62 | conforms to ANSI X3.159-1989 (``ANSI C''). | |
cebe22cb KB |
63 | .SH BUGS |
64 | There is no way to get tokens from multiple strings simultaneously. | |
80ed8d03 | 65 | .PP |
3cf67bdd KB |
66 | The System V |
67 | .B strtok | |
68 | will, if handed a string containing only delimiter characters, | |
69 | not alter the next starting point, so that a call to | |
70 | .B strtok | |
71 | with a different (or empty) delimiter string | |
72 | may return a non-NULL value. | |
73 | Since this implementation always alters the next starting point, | |
74 | such a sequence of calls would always return NULL. |