/* * strsep() - Split a string on one of the seperators * given in the string 'sep'. * * Dan Cross */ #include #include #include char * strsep(char **sp, char *sep) { char *p, *s; if (sp == NULL || *sp == NULL || **sp == '\0') return(NULL); s = *sp; p = s + strcspn(s, sep); if (*p != '\0') *p++ = '\0'; *sp = p; return(s); }