Home
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 (308B) --- 1 #include <string.h> 2 3 #include "compat.h" 4 5 char * 6 strsep(char **str_p, char const *sep) 7 { 8 char *s, *prev; 9 10 if (*str_p == NULL) 11 return NULL; 12 13 for (s = prev = *str_p; strchr(sep, *s) == NULL; s++) 14 continue; 15 16 if (*s == '\0') { 17 *str_p = NULL; 18 } else { 19 *s = '\0'; 20 *str_p = s + 1; 21 } 22 return prev; 23 }