diff options
Diffstat (limited to 'libc-top-half/musl/src/string/strsep.c')
-rw-r--r-- | libc-top-half/musl/src/string/strsep.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libc-top-half/musl/src/string/strsep.c b/libc-top-half/musl/src/string/strsep.c new file mode 100644 index 0000000..cb37c32 --- /dev/null +++ b/libc-top-half/musl/src/string/strsep.c @@ -0,0 +1,13 @@ +#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; +} |