ReactOS 0.4.17-dev-966-gf06eace
strtok_s.c
Go to the documentation of this file.
1#define _CRTIMP
2#include <precomp.h>
3
4char * CDECL strtok_s(char *str, const char *delim, char **ctx)
5{
6 if (!MSVCRT_CHECK_PMT(delim != NULL)) return NULL;
7 if (!MSVCRT_CHECK_PMT(ctx != NULL)) return NULL;
8 if (!MSVCRT_CHECK_PMT(str != NULL || *ctx != NULL)) return NULL;
9
10 if(!str)
11 str = *ctx;
12
13 while(*str && strchr(delim, *str))
14 str++;
15 if(!*str)
16 {
17 *ctx = str;
18 return NULL;
19 }
20
21 *ctx = str+1;
22 while(**ctx && !strchr(delim, **ctx))
23 (*ctx)++;
24 if(**ctx)
25 *(*ctx)++ = 0;
26
27 return str;
28}
29
30#ifdef _WIN64
31void* __imp_strtok_s = strtok_s;
32#else
34#endif
#define NULL
Definition: types.h:112
#define CDECL
Definition: compat.h:29
_ACRTIMP char *__cdecl strchr(const char *, int)
Definition: string.c:3291
#define MSVCRT_CHECK_PMT(x)
Definition: msvcrt.h:378
const WCHAR * str
void * _imp__strtok_s
Definition: strtok_s.c:33
char *CDECL strtok_s(char *str, const char *delim, char **ctx)
Definition: strtok_s.c:4