1 #include <string.h> 2 strtok(char * restrict s,const char * restrict sep)3char* strtok(char* restrict s, const char* restrict sep) { 4 static char* p; 5 if (!s && !(s = p)) 6 return NULL; 7 s += strspn(s, sep); 8 if (!*s) 9 return p = 0; 10 p = s + strcspn(s, sep); 11 if (*p) 12 *p++ = 0; 13 else 14 p = 0; 15 return s; 16 } 17