summaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDan Fandrich2010-06-18 22:36:45 -0700
committerDenys Vlasenko2010-06-19 20:03:18 +0200
commit0635ddd8f7bbd8ed40ef4e5e01ff116ee959fa34 (patch)
treee1e9d33dc63415885cb0273a663af5e1fb6db578 /libbb
parentfdd7b566ecdc174907f38d9389b28ba842d2b4bf (diff)
downloadbusybox-0635ddd8f7bbd8ed40ef4e5e01ff116ee959fa34.zip
busybox-0635ddd8f7bbd8ed40ef4e5e01ff116ee959fa34.tar.gz
Added code for nonstandard function strsep()
Signed-off-by: Dan Fandrich <dan@coneharvesters.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r--libbb/platform.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/libbb/platform.c b/libbb/platform.c
index 17ad3f7..7a8b176 100644
--- a/libbb/platform.c
+++ b/libbb/platform.c
@@ -107,3 +107,30 @@ char* FAST_FUNC strcasestr(const char *s, const char *pattern)
return 0;
}
#endif
+
+#ifndef HAVE_STRSEP
+/* Copyright (C) 2004 Free Software Foundation, Inc. */
+char* FAST_FUNC strsep(char **stringp, const char *delim)
+{
+ char *start = *stringp;
+ char *ptr;
+
+ if (!start)
+ return NULL;
+
+ if (!*delim)
+ ptr = start + strlen(start);
+ else {
+ ptr = strpbrk(start, delim);
+ if (!ptr) {
+ *stringp = NULL;
+ return start;
+ }
+ }
+
+ *ptr = '\0';
+ *stringp = ptr + 1;
+
+ return start;
+}
+#endif