ref: c35217a1a61f795d312eede2f84faf59c7c06a3c
dir: /lib/c/strtok.c/
#include <string.h>
#undef strtok
char *
strtok(char * restrict s, const char * restrict delim)
{
static char *line;
if (s)
line = s;
if (!s && !line)
return NULL;
s = line + strspn(line, delim);
if (*s == '\0')
return line = NULL;
line = s + strcspn(s, delim);
if (*line != '\0')
*line++ = '\0';
else
line = NULL;
return s;
}