Subversion Repositories Kolibri OS

Rev

Rev 647 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
6433 siemargl 1
#include 
2
 
145 halyavin 3
char* strtok(char* s,const char* delim)
6433 siemargl 4
// non reentrant
145 halyavin 5
{
6433 siemargl 6
    static char* savep;
7
    char* res;
8
 
9
    if(s)
10
        savep = NULL;
11
    else
12
        s = savep;
13
 
14
    if (*s == '\0')
15
        return NULL;
16
	s += strspn(s, delim);
17
	if (*s == '\0')
18
		return NULL;
19
	res = s;
20
	s += strcspn(s, delim);
21
	savep = s + 1;
22
	*s = '\0';
145 halyavin 23
	return res;
24
}
6433 siemargl 25