ReactOS 0.4.15-dev-8408-g466a198
wcstok.c
Go to the documentation of this file.
1/* taken from wine wcs.c */
2
3#include <precomp.h>
4
5/*********************************************************************
6 * wcstok_s (MSVCRT.@)
7 */
8wchar_t * CDECL wcstok_s( wchar_t *str, const wchar_t *delim,
9 wchar_t **next_token )
10{
11 wchar_t *ret;
12
13 if (!MSVCRT_CHECK_PMT(delim != NULL) || !MSVCRT_CHECK_PMT(next_token != NULL) ||
15 {
17 return NULL;
18 }
19 if (!str) str = *next_token;
20
21 while (*str && strchrW( delim, *str )) str++;
22 if (!*str) return NULL;
23 ret = str++;
24 while (*str && !strchrW( delim, *str )) str++;
25 if (*str) *str++ = 0;
26 *next_token = str;
27 return ret;
28}
29
30/*********************************************************************
31 * wcstok (MSVCRT.@)
32 */
33wchar_t * CDECL wcstok( wchar_t *str, const wchar_t *delim )
34{
35 return wcstok_s(str, delim, &msvcrt_get_thread_data()->wcstok_next);
36}
#define EINVAL
Definition: acclib.h:90
int next_token(char **, FILE *)
#define NULL
Definition: types.h:112
#define CDECL
Definition: compat.h:29
#define MSVCRT_CHECK_PMT(x)
Definition: mbstowcs_s.c:26
thread_data_t * msvcrt_get_thread_data(void)
Definition: tls.c:31
#define strchrW(s, c)
Definition: unicode.h:40
const WCHAR * str
errno_t __cdecl _set_errno(_In_ int _Value)
wchar_t *CDECL wcstok_s(wchar_t *str, const wchar_t *delim, wchar_t **next_token)
Definition: wcstok.c:8
wchar_t *CDECL wcstok(wchar_t *str, const wchar_t *delim)
Definition: wcstok.c:33
int ret