aboutsummaryrefslogtreecommitdiff
path: root/src/compat.c
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2019-12-18 21:57:51 -0500
committerJoseph Hunkeler <jhunkeler@gmail.com>2019-12-18 21:57:51 -0500
commit534657dd6fc2ee98159e41d2700554fed0da2c4e (patch)
treed9316757b060d68e5640ea9ecb56b29c62adedfc /src/compat.c
parent3166627f1485e2f05421fe874b2236852fe5d017 (diff)
downloadspmc-534657dd6fc2ee98159e41d2700554fed0da2c4e.tar.gz
Refactor project structure
Diffstat (limited to 'src/compat.c')
-rw-r--r--src/compat.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/compat.c b/src/compat.c
new file mode 100644
index 0000000..082a602
--- /dev/null
+++ b/src/compat.c
@@ -0,0 +1,16 @@
+#include <string.h>
+#include "config.h"
+
+#ifndef HAVE_STRSEP
+// credit: Dan Cross via https://unixpapa.com/incnote/string.html
+char *strsep(char **sp, char *sep)
+{
+ char *p, *s;
+ if (sp == NULL || *sp == NULL || **sp == '\0') return(NULL);
+ s = *sp;
+ p = s + strcspn(s, sep);
+ if (*p != '\0') *p++ = '\0';
+ *sp = p;
+ return(s);
+}
+#endif \ No newline at end of file