Add pre_read to man page
[fio.git] / lib / strsep.c
CommitLineData
00fb3c8d
JA
1#include <stdio.h>
2
3char *strsep(char **stringp, const char *delim)
4{
fb9ee072
JA
5 char *s, *tok;
6 const char *spanp;
7 int c, sc;
00fb3c8d 8
fb9ee072
JA
9 s = *stringp;
10 if (!s)
11 return NULL;
12
13 tok = s;
14 do {
15 c = *s++;
16 spanp = delim;
17 do {
18 sc = *spanp++;
19 if (sc == c) {
20 if (c == 0)
21 s = NULL;
22 else
23 s[-1] = 0;
24 *stringp = s;
25 return tok;
26 }
27 } while (sc != 0);
28 } while (1);
00fb3c8d 29}