configure: add gettid() test
[fio.git] / oslib / strsep.c
1 #ifndef CONFIG_STRSEP
2
3 #include <stddef.h>
4 #include "strsep.h"
5
6 char *strsep(char **stringp, const char *delim)
7 {
8         char *s, *tok;
9         const char *spanp;
10         int c, sc;
11
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);
32 }
33
34 #endif