Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4349 | Serge | 1 | /* |
2 | FUNCTION |
||
3 | < |
||
4 | |||
5 | INDEX |
||
6 | strtok |
||
7 | |||
8 | INDEX |
||
9 | strtok_r |
||
10 | |||
11 | INDEX |
||
12 | strsep |
||
13 | |||
14 | ANSI_SYNOPSIS |
||
15 | #include |
||
16 | char *strtok(char *<[source]>, const char *<[delimiters]>) |
||
17 | char *strtok_r(char *<[source]>, const char *<[delimiters]>, |
||
18 | char **<[lasts]>) |
||
19 | char *strsep(char **<[source_ptr]>, const char *<[delimiters]>) |
||
20 | |||
21 | TRAD_SYNOPSIS |
||
22 | #include |
||
23 | char *strtok(<[source]>, <[delimiters]>) |
||
24 | char *<[source]>; |
||
25 | char *<[delimiters]>; |
||
26 | |||
27 | char *strtok_r(<[source]>, <[delimiters]>, <[lasts]>) |
||
28 | char *<[source]>; |
||
29 | char *<[delimiters]>; |
||
30 | char **<[lasts]>; |
||
31 | |||
32 | char *strsep(<[source_ptr]>, <[delimiters]>) |
||
33 | char **<[source_ptr]>; |
||
34 | char *<[delimiters]>; |
||
35 | |||
36 | DESCRIPTION |
||
37 | The < |
||
38 | null-terminated string, <<*<[source]>>>. These tokens are delimited |
||
39 | in the string by at least one of the characters in <<*<[delimiters]>>>. |
||
40 | The first time that < |
||
41 | specified; subsequent calls, wishing to obtain further tokens from |
||
42 | the same string, should pass a null pointer instead. The separator |
||
43 | string, <<*<[delimiters]>>>, must be supplied each time and may |
||
44 | change between calls. |
||
45 | |||
46 | The < |
||
47 | subsequent token in the string, after replacing the separator |
||
48 | character itself with a null character. When no more tokens remain, |
||
49 | a null pointer is returned. |
||
50 | |||
51 | The < |
||
52 | a pointer to placeholder <<*<[lasts]>>> must be supplied by the caller. |
||
53 | |||
54 | The < |
||
55 | a pointer to the string pointer must be supplied <<<[source_ptr]>>> and |
||
56 | the function does not skip leading delimiters. When the string starts |
||
57 | with a delimiter, the delimiter is changed to the null character and |
||
58 | the empty string is returned. Like < |
||
59 | <<*<[source_ptr]>>> is updated to the next character following the |
||
60 | last delimiter found or NULL if the end of string is reached with |
||
61 | no more delimiters. |
||
62 | |||
63 | RETURNS |
||
64 | < |
||
65 | next token, or < |
||
66 | < |
||
67 | |||
68 | NOTES |
||
69 | < |
||
70 | and < |
||
71 | |||
72 | PORTABILITY |
||
73 | < |
||
74 | < |
||
75 | < |
||
76 | |||
77 | < |
||
78 | |||
79 | QUICKREF |
||
80 | strtok ansi impure |
||
81 | */ |
||
82 | |||
83 | /* undef STRICT_ANSI so that strtok_r prototype will be defined */ |
||
84 | #undef __STRICT_ANSI__ |
||
85 | #include |
||
86 | #include <_ansi.h> |
||
87 | #include |
||
88 | |||
89 | #ifndef _REENT_ONLY |
||
90 | |||
91 | extern char *__strtok_r (char *, const char *, char **, int); |
||
92 | |||
93 | char * |
||
94 | _DEFUN (strtok, (s, delim), |
||
95 | register char *s _AND |
||
96 | register const char *delim) |
||
97 | { |
||
98 | _REENT_CHECK_MISC(_REENT); |
||
99 | return __strtok_r (s, delim, &(_REENT_STRTOK_LAST(_REENT)), 1); |
||
100 | } |
||
101 | #endif |