diff options
Diffstat (limited to 'libbb/platform.c')
-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 8642337d4..67048648f 100644 --- a/libbb/platform.c +++ b/libbb/platform.c | |||
@@ -120,3 +120,30 @@ char* FAST_FUNC strcasestr(const char *s, const char *pattern) | |||
120 | return 0; | 120 | return 0; |
121 | } | 121 | } |
122 | #endif | 122 | #endif |
123 | |||
124 | #ifndef HAVE_STRSEP | ||
125 | /* Copyright (C) 2004 Free Software Foundation, Inc. */ | ||
126 | char* FAST_FUNC strsep(char **stringp, const char *delim) | ||
127 | { | ||
128 | char *start = *stringp; | ||
129 | char *ptr; | ||
130 | |||
131 | if (!start) | ||
132 | return NULL; | ||
133 | |||
134 | if (!*delim) | ||
135 | ptr = start + strlen(start); | ||
136 | else { | ||
137 | ptr = strpbrk(start, delim); | ||
138 | if (!ptr) { | ||
139 | *stringp = NULL; | ||
140 | return start; | ||
141 | } | ||
142 | } | ||
143 | |||
144 | *ptr = '\0'; | ||
145 | *stringp = ptr + 1; | ||
146 | |||
147 | return start; | ||
148 | } | ||
149 | #endif | ||