1#include <wchar.h>23#undef wcstok45wchar_t *6wcstok(wchar_t * restrict s1, const wchar_t * restrict s2,7 wchar_t **restrict ptr)8{9 wchar_t *line;1011 if (s1)12 line = s1;13 else14 line = *ptr;1516 if (!line)17 return NULL;1819 s1 = line + wcsspn(line, s2);20 if (*s1 == L'\0')21 return *ptr = NULL;2223 line = s1 + wcscspn(s1, s2);24 if (*line == '\0')25 line = NULL;26 else27 *line++ = L'\0';28 *ptr = line;2930 return s1;31}