configure: add gettid() test
[fio.git] / oslib / strsep.c
CommitLineData
5d413e08
SW
1#ifndef CONFIG_STRSEP
2
3#include <stddef.h>
4#include "strsep.h"
00fb3c8d
JA
5
6char *strsep(char **stringp, const char *delim)
7{
fb9ee072
JA
8 char *s, *tok;
9 const char *spanp;
10 int c, sc;
00fb3c8d 11
fb9ee072
JA
12 s = *stringp;
13 if (!s)
14 return NULL;
15
16 tok = s;
17 do {
18 c = *s++;
19 spanp = delim;
20 do {
21 sc = *spanp++;
22 if (sc == c) {
23 if (c == 0)
24 s = NULL;
25 else
26 s[-1] = 0;
27 *stringp = s;
28 return tok;
29 }
30 } while (sc != 0);
31 } while (1);
00fb3c8d 32}
5d413e08
SW
33
34#endif