STRTOK(3) Linux Programmer's Manual STRTOK(3)
strtok, strtok_r - extract tokens from strings
char *strtok(char *str, const char *delim);
char *strtok_r(char *str, const char *delim, char **saveptr);
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
|| /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
The strtok() function breaks a string into a sequence of zero or more nonempty tokens. On the first call to strtok(), the string to be
parsed should be specified in str. In each subsequent call that should parse the same string, str must be NULL.
The delim argument specifies a set of bytes that delimit the tokens in the parsed string. The caller may specify different strings in
delim in successive calls that parse the same string.
Each call to strtok() returns a pointer to a null-terminated string containing the next token. This string does not include the delimiting
byte. If no more tokens are found, strtok() returns NULL.
A sequence of calls to strtok() that operate on the same string maintains a pointer that determines the point from which to start searching
for the next token. The first call to strtok() sets this pointer to point to the first byte of the string. The start of the next token is
determined by scanning forward for the next nondelimiter byte in str. If such a byte is found, it is taken as the start of the next token.
If no such byte is found, then there are no more tokens, and strtok() returns NULL. (A string that is empty or that contains only delim-
iters will thus cause strtok() to return NULL on the first call.)
The end of each token is found by scanning forward until either the next delimiter byte is found or until the terminating null byte ('