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