1 #include <string.h>
2 
3 #ifdef _MSC_VER
strsep(char **stringp, const char *pattern)4 char *strsep(char **stringp, const char *pattern) {
5    char *ptr = *stringp;
6 
7    char *first = NULL;
8    int len = (int)strlen(pattern);
9 
10    for (int i = 0; i < len; ++i) {
11       char *n = strchr(*stringp, pattern[i]);
12       if (n != NULL && (first == NULL || n < first)) {
13          first = n;
14       }
15    }
16 
17    if (first != NULL) {
18       *first = '\0';
19       *stringp = first + 1;
20    } else {
21       *stringp = NULL;
22    }
23 
24    return ptr;
25 }
26 #endif
27