summaryrefslogtreecommitdiffstats
path: root/helpers.c
diff options
context:
space:
mode:
Diffstat (limited to 'helpers.c')
-rw-r--r--helpers.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/helpers.c b/helpers.c
index 63fc880..5685d29 100644
--- a/helpers.c
+++ b/helpers.c
@@ -70,3 +70,24 @@ void tolower_string(char *str)
*str = (char)tolower((unsigned char)*str);
}
+/* FIXME: Find a better solution for MinGW. Maybe wrap strtok_s (C11) if it becomes available */
+#ifdef __MINGW32__
+char* strtok_r(char *str, const char *delim, char **nextp)
+{
+ if (str == NULL)
+ str = *nextp;
+
+ str += strspn(str, delim); /* Skip leading delimiters */
+ if (*str == '\0')
+ return NULL;
+
+ char *ret = str;
+ str += strcspn(str, delim); /* Find end of token */
+ if (*str != '\0')
+ *str++ = '\0';
+
+ *nextp = str;
+ return ret;
+}
+#endif
+
OpenPOWER on IntegriCloud