projects
/
fio.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
f8e55b5351cc3a283d344f3c90af340a6f74e252
[fio.git]
/
lib
/
strsep.c
1
#include <stdio.h>
2
3
char *strsep(char **stringp, const char *delim)
4
{
5
char *s;
6
const char *spanp;
7
int c, sc;
8
char *tok;
9
10
if ((s = *stringp) == NULL)
11
return (NULL);
12
for (tok = s;;) {
13
c = *s++;
14
spanp = delim;
15
do {
16
if ((sc = *spanp++) == c) {
17
if (c == 0)
18
s = NULL;
19
else
20
s[-1] = 0;
21
*stringp = s;
22
return (tok);
23
}
24
} while (sc != 0);
25
}
26
}