int c, sc;
char *tok;
- if ((s = *stringp) == NULL)
- return (NULL);
+ if ((s = *stringp) == NULL) {
+ return NULL;
+ }
for (tok = s;;) {
c = *s++;
spanp = delim;
do {
if ((sc = *spanp++) == c) {
- if (c == 0)
+ if (c == 0) {
s = NULL;
- else
+ } else {
s[-1] = 0;
+ }
*stringp = s;
- return (tok);
+ return tok;
}
} while (sc != 0);
}