From 11da511c784eca003deb90c23570f0873954e0de Mon Sep 17 00:00:00 2001 From: Duncan Wilkie Date: Sat, 18 Nov 2023 06:11:09 -0600 Subject: Initial commit. --- ic-reals-6.3/base/strsep.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 ic-reals-6.3/base/strsep.c (limited to 'ic-reals-6.3/base/strsep.c') 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 +#include + +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; +} -- cgit v1.2.3