/* Taken from Wine Staging msvcrt/string.c */ #include #include /********************************************************************* * 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; }