diff options
author | Duncan Wilkie <antigravityd@gmail.com> | 2023-11-18 06:11:09 -0600 |
---|---|---|
committer | Duncan Wilkie <antigravityd@gmail.com> | 2023-11-18 06:11:09 -0600 |
commit | 11da511c784eca003deb90c23570f0873954e0de (patch) | |
tree | e14fdd3d5d6345956d67e79ae771d0633d28362b /ic-reals-6.3/base/strsep.c |
Initial commit.
Diffstat (limited to 'ic-reals-6.3/base/strsep.c')
-rw-r--r-- | ic-reals-6.3/base/strsep.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/ic-reals-6.3/base/strsep.c b/ic-reals-6.3/base/strsep.c new file mode 100644 index 0000000..1191f33 --- /dev/null +++ b/ic-reals-6.3/base/strsep.c @@ -0,0 +1,25 @@ +/* + * Some UNIX distributions don't come with strsep. + */ +#include <stdio.h> +#include <string.h> + +char * +strsep(char **str_p, char *delim) +{ + char *start, *end; + + start = *str_p; + if (start == NULL) + return NULL; + + end = strpbrk(start, delim); + if (end) { + *end++ = '\0'; + *str_p = end; + } + else + *str_p = NULL; + + return start; +} |