aboutsummaryrefslogtreecommitdiff
path: root/src/util/string.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/string.cpp')
-rw-r--r--src/util/string.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/util/string.cpp b/src/util/string.cpp
index 215ac299d..c10755ae1 100644
--- a/src/util/string.cpp
+++ b/src/util/string.cpp
@@ -47,3 +47,28 @@ size_t curl_write_data(char *ptr, size_t size, size_t nmemb, void *userdata) {
stream->write(ptr, count);
return count;
}
+
+char *mystrtok_r(char *s, const char *sep, char **lasts) {
+ char *t;
+
+ if (!s)
+ s = *lasts;
+
+ while (*s && strchr(sep, *s))
+ s++;
+
+ if (!*s)
+ return NULL;
+
+ t = s;
+ while (*t) {
+ if (strchr(sep, *t)) {
+ *t++ = '\0';
+ break;
+ }
+ t++;
+ }
+
+ *lasts = t;
+ return s;
+}