1#include <wchar.h> 2 3wchar_t* wcstok(wchar_t* restrict s, const wchar_t* restrict sep, wchar_t** restrict p) { 4 if (!s && !(s = *p)) 5 return NULL; 6 s += wcsspn(s, sep); 7 if (!*s) 8 return *p = 0; 9 *p = s + wcscspn(s, sep); 10 if (**p) 11 *(*p)++ = 0; 12 else 13 *p = 0; 14 return s; 15} 16