msvcrt: Added strtok_s implementation.

This commit is contained in:
Piotr Caban 2010-04-26 14:09:59 +02:00 committed by Alexandre Julliard
parent 59c1139f05
commit 2b3b860396
4 changed files with 30 additions and 3 deletions

View File

@ -1396,7 +1396,7 @@
@ cdecl strstr(str str) msvcrt.strstr
@ cdecl strtod(str ptr) msvcrt.strtod
@ cdecl strtok(str str) msvcrt.strtok
@ stub strtok_s
@ cdecl strtok_s(ptr str ptr) msvcrt.strtok_s
@ cdecl strtol(str ptr long) msvcrt.strtol
@ cdecl strtoul(str ptr long) msvcrt.strtoul
@ cdecl strxfrm(ptr str long) msvcrt.strxfrm

View File

@ -1380,7 +1380,7 @@
@ cdecl strstr(str str) msvcrt.strstr
@ cdecl strtod(str ptr) msvcrt.strtod
@ cdecl strtok(str str) msvcrt.strtok
@ stub strtok_s
@ cdecl strtok_s(ptr str ptr) msvcrt.strtok_s
@ cdecl strtol(str ptr long) msvcrt.strtol
@ cdecl strtoul(str ptr long) msvcrt.strtoul
@ cdecl strxfrm(ptr str long) msvcrt.strxfrm

View File

@ -1331,7 +1331,7 @@
@ cdecl strstr(str str) ntdll.strstr
@ cdecl strtod(str ptr) MSVCRT_strtod
@ cdecl strtok(str str) MSVCRT_strtok
# stub strtok_s
@ cdecl strtok_s(ptr str ptr) MSVCRT_strtok_s
@ cdecl strtol(str ptr long) MSVCRT_strtol
@ cdecl strtoul(str ptr long) MSVCRT_strtoul
@ cdecl strxfrm(ptr str long) MSVCRT_strxfrm

View File

@ -111,6 +111,33 @@ char * CDECL MSVCRT_strtok( char *str, const char *delim )
return ret;
}
/*********************************************************************
* strtok_s (MSVCRT.@)
*/
char * CDECL MSVCRT_strtok_s(char *str, const char *delim, char **ctx)
{
if(!delim || !ctx || (!str && !*ctx)) {
MSVCRT__invalid_parameter(NULL, NULL, NULL, 0, 0);
*MSVCRT__errno() = MSVCRT_EINVAL;
return NULL;
}
if(!str)
str = *ctx;
while(*str && strchr(delim, *str))
str++;
if(!*str)
return NULL;
*ctx = str+1;
while(**ctx && !strchr(delim, **ctx))
(*ctx)++;
if(**ctx)
*(*ctx)++ = 0;
return str;
}
/*********************************************************************
* _swab (MSVCRT.@)