1 /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
2 #include <msvcrt/string.h>
3 #include <msvcrt/internal/tls.h>
5 char** _lasttoken(); /* lasttok.c */
10 char* strtok(char* s, const char* delim)
16 char ** lasttoken = _lasttoken();
18 PTHREADDATA ThreadData = GetThreadData();
19 char ** lasttoken = &ThreadData->lasttoken;
22 if (s == NULL && (s = *lasttoken) == NULL)
26 * Skip (span) leading delimiters (s += strspn(s, delim), sort of).
30 for (spanp = delim; (sc = *spanp++) != 0;) {
35 if (c == 0) { /* no non-delimiter characters */
42 * Scan token (scan for delimiters: s += strcspn(s, delim), sort of).
43 * Note that delim must have one NUL; we stop if we see that, too.
49 if ((sc = *spanp++) == c) {