musl-tcc/src/string/strsep.c

14 lines
222 B
C
Raw Permalink Normal View History

2022-03-20 08:48:53 +00:00
#define _GNU_SOURCE
#include <string.h>
char *strsep(char **str, const char *sep)
{
char *s = *str, *end;
if (!s) return NULL;
end = s + strcspn(s, sep);
if (*end) *end++ = 0;
else end = 0;
*str = end;
return s;
}