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 | .\" | |
80ed8d03 | 16 | .\" @(#)strtok.3 5.2 (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 | |
24 | .B char *strtok(str, sep) | |
25 | .B char *str, *sep; | |
26 | .PP | |
27 | .B char *strsep(str, sep) | |
28 | .B char *str, *sep; | |
29 | .fi | |
30 | .PP | |
31 | .I Strtok | |
32 | is used to isolate sequential tokens in a null-terminated string, | |
33 | .IR str . | |
34 | These tokens are separated in the string by | |
35 | .B "one or more" | |
36 | of the characters in | |
37 | .IR sep . | |
38 | The first time that | |
39 | .I strtok | |
40 | is called, | |
41 | .I str | |
42 | should be specified; subsequent calls, wishing to obtain further tokens | |
43 | from the same string, should pass a null pointer instead. The separator | |
44 | string, | |
45 | .IR sep , | |
46 | must be supplied each time, and may change between calls. | |
47 | .I Strtok | |
48 | returns a pointer to the start of each subsequent token in the string, | |
49 | after replacing the token itself with a NUL character. When no more | |
50 | tokens remain, a null pointer is returned. | |
51 | .PP | |
52 | .I Strsep | |
53 | behaves similarly to | |
54 | .I strtok | |
55 | with the exception that the tokens in the string are separated by single | |
56 | occurrences of separator characters. This routine was added to allow | |
57 | handling blank fields. | |
58 | .SH BUGS | |
59 | There is no way to get tokens from multiple strings simultaneously. | |
80ed8d03 KB |
60 | .PP |
61 | .I Strsep | |
62 | is used heavily in the C library; calls to it and calls to the C library | |
63 | should not be intermixed. |