summaryrefslogtreecommitdiff
path: root/src/string/wcstok.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-03-01 23:24:45 -0500
committerRich Felker <dalias@aerifal.cx>2012-03-01 23:24:45 -0500
commite0614f7cd418afedd06c9bcd5abb965608bc52f8 (patch)
treeb4b51646b9f65279caa01c3413e42060fe95c395 /src/string/wcstok.c
parent899b13cae77469a9ed1f076c456b66d567af69d8 (diff)
downloadmusl-e0614f7cd418afedd06c9bcd5abb965608bc52f8.tar.gz
add all missing wchar functions except floating point parsers
these are mostly untested and adapted directly from corresponding byte string functions and similar.
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;
+}