summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1999-07-05 23:09:37 +0000
committerRalf Baechle <ralf@linux-mips.org>1999-07-05 23:09:37 +0000
commitaba344fdfed81b2c03d6114c54cfd73a486aa10b (patch)
treed032d8430bf1234c3ecc6f6330d6de6e887e5963 /lib
parent40c138bfc6d37dbff5339f84575db1e3cec6e34e (diff)
Merge with Linux 2.3.9.
Diffstat (limited to 'lib')
-rw-r--r--lib/string.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/string.c b/lib/string.c
index a7bdf21c6..ad6db47fa 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -9,6 +9,10 @@
* as inline code in <asm-xx/string.h>
*
* These are buggy as well..
+ *
+ * * Fri Jun 25 1999, Ingo Oeser <ioe@informatik.tu-chemnitz.de>
+ * - Added strsep() which will replace strtok() soon (because strsep() is
+ * reentrant and should be faster). Use only strsep() in new code, please.
*/
#include <linux/types.h>
@@ -232,6 +236,25 @@ char * strtok(char * s,const char * ct)
}
#endif
+#ifndef __HAVE_ARCH_STRSEP
+
+char * strsep(char **s, const char * ct)
+{
+ char *sbegin=*s;
+ if (!sbegin)
+ return NULL;
+
+ sbegin += strspn(sbegin,ct);
+ if (*sbegin == '\0')
+ return NULL;
+
+ *s = strpbrk( sbegin, ct);
+ if (*s && **s != '\0')
+ **s++ = '\0';
+ return (sbegin);
+}
+#endif
+
#ifndef __HAVE_ARCH_MEMSET
void * memset(void * s, int c, size_t count)
{