scc

A fork of https://git.simple-cc.org/scc/ for Qute

git clone https://git.8pit.net/scc.git

 1.TH strtok 3 scc\-VERSION
 2.SH NAME
 3strtok - break a string into tokens
 4.SH SYNOPSIS
 5#include <string.h>
 6
 7char *strtok(char *restrict s1, const char *restrict s2)
 8.SH DESCRIPTION
 9The
10.BR strtok ()
11function splits the string at
12.I s1
13into a series of tokens, each bounded by one or more delimiter characters
14drawn from the string at
15.IR s2 .
16It is called repeatedly to extract successive tokens.
17.PP
18The first call must pass the string to tokenize as
19.IR s1 ;
20subsequent calls must pass NULL as
21.I s1
22to continue where the previous call left off.
23.PP
24The delimiter set in
25.I s2
26may differ between calls.
27.PP
28On each call, the function advances past any leading delimiter characters,
29then locates the next delimiter in the remainder of the string.
30If no non-delimiter character is found, no tokens remain
31and a null pointer is returned.
32Otherwise, that character marks the start of a new token.
33.PP
34When the end of the token is found,
35it is terminated by overwriting the delimiter character with a null byte.
36A pointer to the next character is saved internally
37and used as the starting point for the following call.
38If no delimiter follows the token,
39subsequent calls will return a null pointer.
40.PP
41After the first call, each subsequent call with NULL as
42.I s1
43resumes scanning from the saved position,
44applying the same logic described above.
45.SH RETURN VALUE
46The
47.BR strtok ()
48function returns a pointer to the first character of the current token,
49or a null pointer when no more tokens are found.
50.SH STANDARDS
51ISO/IEC 9899:1999 Section 7.21.5.8