2016-08-21 16:24:00 +00:00
|
|
|
/* Taken from Wine Staging msvcrt/string.c */
|
2007-03-14 20:24:57 +00:00
|
|
|
|
2011-12-02 21:18:42 +00:00
|
|
|
#include <precomp.h>
|
|
|
|
#include <internal/wine/msvcrt.h>
|
2007-03-14 20:24:57 +00:00
|
|
|
|
2011-12-02 21:18:42 +00:00
|
|
|
/*********************************************************************
|
|
|
|
* strtok (MSVCRT.@)
|
2007-03-14 20:24:57 +00:00
|
|
|
*/
|
2011-12-02 21:18:42 +00:00
|
|
|
char * CDECL strtok( char *str, const char *delim )
|
2007-03-14 20:24:57 +00:00
|
|
|
{
|
2011-12-02 21:18:42 +00:00
|
|
|
thread_data_t *data = msvcrt_get_thread_data();
|
|
|
|
char *ret;
|
2007-03-14 20:24:57 +00:00
|
|
|
|
2011-12-02 21:18:42 +00:00
|
|
|
if (!str)
|
|
|
|
if (!(str = data->strtok_next)) return NULL;
|
2007-03-14 20:24:57 +00:00
|
|
|
|
2011-12-02 21:18:42 +00:00
|
|
|
while (*str && strchr( delim, *str )) str++;
|
|
|
|
if (!*str) return NULL;
|
|
|
|
ret = str++;
|
|
|
|
while (*str && !strchr( delim, *str )) str++;
|
|
|
|
if (*str) *str++ = 0;
|
|
|
|
data->strtok_next = str;
|
|
|
|
return ret;
|
2007-03-14 20:24:57 +00:00
|
|
|
}
|