src/misc/strtok_r.cpp
raw| 1 | #include "strtok_r.h" |
| 2 | |
| 3 | #ifndef __unix__ |
| 4 | char *strtok_r(char *s1, const char *s2, char **lasts) |
| 5 | { |
| 6 | char *ret; |
| 7 | |
| 8 | if (s1 == NULL) |
| 9 | s1 = *lasts; |
| 10 | while(*s1 && strchr(s2, *s1)) |
| 11 | ++s1; |
| 12 | if(*s1 == '\0') |
| 13 | return NULL; |
| 14 | ret = s1; |
| 15 | while(*s1 && !strchr(s2, *s1)) |
| 16 | ++s1; |
| 17 | if(*s1) |
| 18 | *s1++ = '\0'; |
| 19 | *lasts = s1; |
| 20 | return ret; |
| 21 | } |
| 22 | #endif |