aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorWeblate <42@minetest.ru>2013-02-02 21:34:12 +0400
committerWeblate <42@minetest.ru>2013-02-02 21:34:12 +0400
commit1d248cce30105a66a411d327b5400f37a35db3b9 (patch)
treee489f681757416b8b9ab3c965689fb50a5a73d9c /src/util
parentc33654c21ab13b072baadc65a72d31ae839ceec8 (diff)
parent6424c5b69809ad4799c08e93dd8cbdb13547da1c (diff)
downloadminetest-1d248cce30105a66a411d327b5400f37a35db3b9.tar.gz
minetest-1d248cce30105a66a411d327b5400f37a35db3b9.tar.bz2
minetest-1d248cce30105a66a411d327b5400f37a35db3b9.zip
Merge remote branch 'origin/master'
Diffstat (limited to 'src/util')
-rw-r--r--src/util/string.cpp25
-rw-r--r--src/util/string.h1
2 files changed, 26 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;
+}
diff --git a/src/util/string.h b/src/util/string.h
index 58274c677..d081b365b 100644
--- a/src/util/string.h
+++ b/src/util/string.h
@@ -283,6 +283,7 @@ inline std::string wrap_rows(const std::string &from, u32 rowlen)
std::string translatePassword(std::string playername, std::wstring password);
size_t curl_write_data(char *ptr, size_t size, size_t nmemb, void *userdata);
+char *mystrtok_r(char *s, const char *sep, char **lasts);
#endif