1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- #ifdef HAVE_CONFIG_H
- #include <config.h>
- #endif
- #include <netdissect-stdinc.h>
- #include <string.h>
- #include "netdissect.h"
- char *
- strsep(char **stringp, const char *delim)
- {
- register char *s;
- register const char *spanp;
- register int c, sc;
- char *tok;
- if ((s = *stringp) == NULL)
- return (NULL);
- for (tok = s;;) {
- c = *s++;
- spanp = delim;
- do {
- if ((sc = *spanp++) == c) {
- if (c == 0)
- s = NULL;
- else
- s[-1] = 0;
- *stringp = s;
- return (tok);
- }
- } while (sc != 0);
- }
-
- }
|