lang-bootstrap/05/musl-final/src/string/strtok_r.c
2025-04-05 10:55:40 +01:00

12 lines
233 B
C

#include <string.h>
char *strtok_r(char *s, const char *sep, char **p)
{
if (!s && !(s = *p)) return NULL;
s += strspn(s, sep);
if (!*s) return *p = 0;
*p = s + strcspn(s, sep);
if (**p) *(*p)++ = 0;
else *p = 0;
return s;
}