tstrsep.c - iomenu - interactive terminal-based selection menu HTML git clone git://bitreich.org/iomenu git://hg6vgqziawt5s4dj.onion/iomenu DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- tstrsep.c (311B) --- 1 #include <string.h> 2 3 char * 4 strsep(char **strp, const char *delim) 5 { 6 char *s, *oldp; 7 8 if (*strp == NULL) 9 return NULL; 10 for (s = oldp = *strp; ; s++) { 11 if (*s == '\0') { 12 *strp = NULL; 13 return oldp; 14 } else if (strchr(delim, *s) != NULL) { 15 break; 16 } 17 } 18 *s = '\0'; 19 *strp = s + 1; 20 return oldp; 21 }