Tokenize, like strtok, but reentrant [[tokenize(s, set, next)]] takes three arguments: a string [[s], a set of characters [[set]] and a string pointer [[next]]. It returns a pointer to the first `token' in the string [[s]], where a token is a non-empty substring that does not contain any characters from [[set]]. To get the next token, pass [[next]] instead of [[s]] and repeat this until the function returns [[NULL]], signifying that there are no more tokens. [[tokenize]] permanently modifies the string [[s]]. The returned pointers point into the space occupied by [[s]]. <<*>>= #include EXPORT char *tokenize(char *s, char *set, char **next) { if (!s) return NULL; s += strspn(s, set); *next = s + strcspn(s, set); if (**next != '\0') *((*next)++) = '\0'; else *next = NULL; return *s ? s : NULL; }