summaryrefslogtreecommitdiff
path: root/src/util/string.cpp
diff options
context:
space:
mode:
authorkwolekr <mirrorisim@gmail.com>2013-01-29 13:07:47 -0800
committerkwolekr <mirrorisim@gmail.com>2013-01-29 13:07:47 -0800
commit12472a44d4ce1a35cad0b9ebe53550a7d44134d5 (patch)
tree359cf19d5eb059aa6236256e6a6b3fe8b4ea5da4 /src/util/string.cpp
parentcbbb6447bfd3a6d0013b3605aeca840733d87561 (diff)
parent9d69b3858385e657a3d1a8b64d302c0bd5a23166 (diff)
downloadminetest-12472a44d4ce1a35cad0b9ebe53550a7d44134d5.tar.gz
minetest-12472a44d4ce1a35cad0b9ebe53550a7d44134d5.tar.bz2
minetest-12472a44d4ce1a35cad0b9ebe53550a7d44134d5.zip
Merge pull request #442 from kwolekr/mingw_compile_fix
Fix compile under MingW
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;
+}