Magomed Kostoev (mkostoevr)
1f4d74f500
git-svn-id: svn://kolibrios.org@8622 a494cfbc-eb01-0410-851d-a64ba20cac60
31 lines
514 B
C
31 lines
514 B
C
/* strtok( char *, const char * )
|
|
|
|
This file is part of the Public Domain C Library (PDCLib).
|
|
Permission is granted to use, modify, and / or redistribute at will.
|
|
*/
|
|
|
|
#include <string.h>
|
|
|
|
char* strtok(char* s, const char* delim)
|
|
{
|
|
static char* savep;
|
|
char* res;
|
|
|
|
if(s)
|
|
savep = NULL;
|
|
else
|
|
s = savep;
|
|
|
|
if (*s == '\0')
|
|
return NULL;
|
|
s += strspn(s, delim);
|
|
if (*s == '\0')
|
|
return NULL;
|
|
res = s;
|
|
s += strcspn(s, delim);
|
|
savep = s + 1;
|
|
*s = '\0';
|
|
return res;
|
|
}
|
|
|