1 // ----------------------------------------------------------------------------
3 // ----------------------------------------------------------------------------
4 // Public Domain C Library - http://pdclib.sourceforge.net
5 // This code is Public Domain. Use, modify, and redistribute at will.
6 // ----------------------------------------------------------------------------
8 char * strtok( char * restrict src, const char * restrict seperators )
10 static char * store = NULL;
20 // no old string, no new string, nothing to do
23 src += strspn( src, seperators ); // skipping leading seperators
24 if ( strlen( src ) == 0 )
27 return ( store = NULL );
29 token_length = strcspn( src, seperators );
30 if ( src[ token_length ] == '\0' )
32 // parsed to end of string
36 src[ token_length ] = '\0';
37 store = src + token_length + 1;