extern void bcopy(const void *__src, void *__dst, size_t __n);
extern void bzero(void *__dst, size_t __n);
-/* Other common BSD functions */
+/* Other common string functions */
extern char *strpbrk(const char *__s, const char *__accept);
extern char *strsep(char **__stringp, const char *__delim);
extern char *strstr(const char *__haystack, const char *__needle);
extern char *strtok(char *__str, const char *__delim);
+extern char *strtok_r(char *__str, const char *__delim, char **__olds);
extern size_t strcspn(const char *__s, const char *__reject);
extern size_t strspn(const char *__s, const char *__accept);
SRC_C += sputl.c stat.c stdio0.c stime.c
SRC_C += strcasecmp.c strcasestr.c strdup.c stricmp.c strlcpy.c strncasecmp.c
SRC_C += strnlen.c strnicmp.c strsep.c strxfrm.c strcoll.c strsignal.c
-SRC_C += strtod.c strtol.c swab.c system.c telldir.c
+SRC_C += strtod.c strtok_r.c strtol.c swab.c system.c telldir.c
SRC_C += tfind.c time.c tmpfile.c tmpnam.c tsearch.c ttyname.c
SRC_C += tzset.c umount.c ungetc.c usleep.c utent.c utimes.c utsname.c
SRC_C += vfprintf.c vprintf.c wait.c xitoa.c pathconf.c
--- /dev/null
+/* Copyright (C) 1991 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB. If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#include <string.h>
+
+
+/* Parse S into tokens separated by characters in DELIM.
+ If S is NULL, the last string strtok() was called with is
+ used. For example:
+ char s[] = "-abc=-def";
+ x = strtok(s, "-"); // x = "abc"
+ x = strtok(NULL, "=-"); // x = "def"
+ x = strtok(NULL, "="); // x = NULL
+ // s = "abc\0-def\0"
+*/
+char *strtok_r(char *s, const char *delim, char **olds)
+{
+ char *token;
+
+ if (s == 0)
+ {
+ if (*olds == 0)
+ {
+ return 0;
+ }
+ else
+ s = *olds;
+ }
+
+ /* Scan leading delimiters. */
+ s += strspn(s, delim);
+ if (*s == '\0')
+ {
+ *olds = 0;
+ return 0;
+ }
+
+ /* Find the end of the token. */
+ token = s;
+ s = strpbrk(token, delim);
+ if (s == 0)
+ /* This token finishes the string. */
+ *olds = 0;
+ else
+ {
+ /* Terminate the token and make OLDS point past it. */
+ *s = '\0';
+ *olds = s + 1;
+ }
+ return token;
+}