libbb: make warning go away
[oweals/busybox.git] / libbb / platform.c
index 17ad3f75a65ccb51469b659bfc0dc5c2e003db2a..fe7ce156719ae3aeb70f00bc80eb1e87efcf7d82 100644 (file)
@@ -4,7 +4,7 @@
  *
  * Copyright (C) 2009 by Dan Fandrich <dan@coneharvesters.com>, et. al.
  *
- * Licensed under the GPL version 2, see the file LICENSE in this tarball.
+ * Licensed under GPLv2, see file LICENSE in this source tree.
  */
 #include "libbb.h"
 
@@ -107,3 +107,41 @@ 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
+
+#ifndef HAVE_STPCPY
+char* FAST_FUNC stpcpy(char *p, const char *to_add)
+{
+       while ((*p = *to_add) != '\0') {
+               p++;
+               to_add++;
+       }
+       return p;
+}
+#endif