mirror of
https://github.com/reactos/reactos.git
synced 2024-11-20 14:30:57 +00:00
33 lines
737 B
C
33 lines
737 B
C
/* Taken from Wine Staging msvcrt/string.c */
|
|
|
|
#include <precomp.h>
|
|
#include <internal/wine/msvcrt.h>
|
|
|
|
/*********************************************************************
|
|
* strtok_s (MSVCRT.@)
|
|
*/
|
|
char * CDECL strtok_s(char *str, const char *delim, char **ctx)
|
|
{
|
|
if (!MSVCRT_CHECK_PMT(delim != NULL)) return NULL;
|
|
if (!MSVCRT_CHECK_PMT(ctx != NULL)) return NULL;
|
|
if (!MSVCRT_CHECK_PMT(str != NULL || *ctx != NULL)) return NULL;
|
|
|
|
if(!str)
|
|
str = *ctx;
|
|
|
|
while(*str && strchr(delim, *str))
|
|
str++;
|
|
if(!*str)
|
|
{
|
|
*ctx = str;
|
|
return NULL;
|
|
}
|
|
|
|
*ctx = str+1;
|
|
while(**ctx && !strchr(delim, **ctx))
|
|
(*ctx)++;
|
|
if(**ctx)
|
|
*(*ctx)++ = 0;
|
|
|
|
return str;
|
|
}
|