3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: ntoskrnl/rtl/strtok.c
6 * PURPOSE: Unicode and thread safe implementation of strtok
8 * PROGRAMMERS: David Welch (welch@mcmail.com)
11 /* INCLUDES *****************************************************************/
14 #include <internal/debug.h>
17 /* FUNCTIONS *****************************************************************/
19 char* strtok(char *s
, const char *delim
)
26 if (s
== NULL
&& (s
= last
) == NULL
)
30 * Skip (span) leading delimiters (s += strspn(s, delim), sort of).
34 for (spanp
= delim
; (sc
= *spanp
++) != 0;) {
39 if (c
== 0) { /* no non-delimiter characters */
46 * Scan token (scan for delimiters: s += strcspn(s, delim), sort of).
47 * Note that delim must have one NUL; we stop if we see that, too.
53 if ((sc
= *spanp
++) == c
) {
66 PWSTR
RtlStrtok(PUNICODE_STRING _string
, PWSTR _sep
,
69 * FUNCTION: Splits a string into tokens
71 * string = string to operate on
72 * if NULL then continue with previous string
73 * sep = Token deliminators
74 * temp = Tempory storage provided by the caller
75 * ARGUMENTS: Returns the beginning of the next token
84 string
= _string
->Buffer
;
98 if ((*string
)==(*sep
))