2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: ntoskrnl/rtl/strtok.c
5 * PURPOSE: Unicode and thread safe implementation of strtok
6 * PROGRAMMER: David Welch (welch@mcmail.com)
11 /* INCLUDES *****************************************************************/
13 #include <ddk/ntddk.h>
15 #include <internal/debug.h>
18 /* FUNCTIONS *****************************************************************/
20 char* strtok(char *s, const char *delim)
27 if (s == NULL && (s = last) == NULL)
31 * Skip (span) leading delimiters (s += strspn(s, delim), sort of).
35 for (spanp = delim; (sc = *spanp++) != 0;) {
40 if (c == 0) { /* no non-delimiter characters */
47 * Scan token (scan for delimiters: s += strcspn(s, delim), sort of).
48 * Note that delim must have one NUL; we stop if we see that, too.
54 if ((sc = *spanp++) == c) {
67 PWSTR RtlStrtok(PUNICODE_STRING _string, PWSTR _sep,
70 * FUNCTION: Splits a string into tokens
72 * string = string to operate on
73 * if NULL then continue with previous string
74 * sep = Token deliminators
75 * temp = Tempory storage provided by the caller
76 * ARGUMENTS: Returns the beginning of the next token
85 string = _string->Buffer;
99 if ((*string)==(*sep))