diff options
Diffstat (limited to 'libbb')
| -rw-r--r-- | libbb/platform.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/libbb/platform.c b/libbb/platform.c index 17ad3f75a..7a8b17657 100644 --- a/libbb/platform.c +++ b/libbb/platform.c | |||
| @@ -107,3 +107,30 @@ char* FAST_FUNC strcasestr(const char *s, const char *pattern) | |||
| 107 | return 0; | 107 | return 0; |
| 108 | } | 108 | } |
| 109 | #endif | 109 | #endif |
| 110 | |||
| 111 | #ifndef HAVE_STRSEP | ||
| 112 | /* Copyright (C) 2004 Free Software Foundation, Inc. */ | ||
| 113 | char* FAST_FUNC strsep(char **stringp, const char *delim) | ||
| 114 | { | ||
| 115 | char *start = *stringp; | ||
| 116 | char *ptr; | ||
| 117 | |||
| 118 | if (!start) | ||
| 119 | return NULL; | ||
| 120 | |||
| 121 | if (!*delim) | ||
| 122 | ptr = start + strlen(start); | ||
| 123 | else { | ||
| 124 | ptr = strpbrk(start, delim); | ||
| 125 | if (!ptr) { | ||
| 126 | *stringp = NULL; | ||
| 127 | return start; | ||
| 128 | } | ||
| 129 | } | ||
| 130 | |||
| 131 | *ptr = '\0'; | ||
| 132 | *stringp = ptr + 1; | ||
| 133 | |||
| 134 | return start; | ||
| 135 | } | ||
| 136 | #endif | ||
