diff options
Diffstat (limited to 'usr/klibc/strsep.c')
-rw-r--r-- | usr/klibc/strsep.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/usr/klibc/strsep.c b/usr/klibc/strsep.c new file mode 100644 index 0000000..44e76bd --- /dev/null +++ b/usr/klibc/strsep.c @@ -0,0 +1,21 @@ +/* + * strsep.c + */ + +#include <string.h> + +char *strsep(char **stringp, const char *delim) +{ + char *s = *stringp; + char *e; + + if (!s) + return NULL; + + e = strpbrk(s, delim); + if (e) + *e++ = '\0'; + + *stringp = e; + return s; +} |