summaryrefslogtreecommitdiff
path: root/src/string/wcstok.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/string/wcstok.c')
-rw-r--r--src/string/wcstok.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/string/wcstok.c b/src/string/wcstok.c
new file mode 100644
index 00000000..c932d0a0
--- /dev/null
+++ b/src/string/wcstok.c
@@ -0,0 +1,12 @@
+#include <wchar.h>
+
+wchar_t *wcstok(wchar_t *s, const wchar_t *sep, wchar_t **p)
+{
+ if (!s && !(s = *p)) return NULL;
+ s += wcsspn(s, sep);
+ if (!*s) return *p = 0;
+ *p = s + wcscspn(s, sep);
+ if (**p) *(*p)++ = 0;
+ else *p = 0;
+ return s;
+}