source:
trunk/sys/dietlibc/strtok_r.c
@
184
| Last change on this file since 184 was 1, checked in by , 9 years ago | |
|---|---|
| File size: 306 bytes | |
| Rev | Line | |
|---|---|---|
| [1] | 1 | #include <string.h> |
| 2 | ||
| 3 | char*strtok_r(char*s,const char*delim,char**ptrptr) { | |
| 4 | char*tmp=0; | |
| 5 | ||
| 6 | if (s==0) s=*ptrptr; | |
| 7 | s+=strspn(s,delim); /* overread leading delimiter */ | |
| 8 | if (*s) { | |
| 9 | tmp=s; | |
| 10 | s+=strcspn(s,delim); | |
| 11 | if (*s) *s++=0; /* not the end ? => terminate it */ | |
| 12 | } | |
| 13 | *ptrptr=s; | |
| 14 | return tmp; | |
| 15 | } |
Note: See TracBrowser
for help on using the repository browser.
