summaryrefslogtreecommitdiff
path: root/libc/string
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-06-12 21:59:00 +0000
committerEric Andersen <andersen@codepoet.org>2002-06-12 21:59:00 +0000
commitfd6b9378be20243eaea7da1c2ddb3d68f123d28e (patch)
treed35598812d68d75aa83fcc1d2c22637cae2558e8 /libc/string
parentf1daf535ed9fa4313524a73646df140bdd35ce93 (diff)
Cleanup the mess, remove now obsolete files
-Erik
Diffstat (limited to 'libc/string')
-rw-r--r--libc/string/Makefile8
-rw-r--r--libc/string/basename.c26
-rw-r--r--libc/string/bcmp.c13
-rw-r--r--libc/string/bcopy.c15
-rw-r--r--libc/string/bzero.c15
-rw-r--r--libc/string/dirname.c55
-rw-r--r--libc/string/strcasecmp.c35
-rw-r--r--libc/string/strcspn.c38
-rw-r--r--libc/string/string.c465
-rw-r--r--libc/string/strncasecmp.c37
-rw-r--r--libc/string/strpbrk.c19
-rw-r--r--libc/string/strsep.c65
-rw-r--r--libc/string/strspn.c42
-rw-r--r--libc/string/strstr.c137
-rw-r--r--libc/string/strtok.c8
-rw-r--r--libc/string/strtok_r.c53
-rw-r--r--libc/string/wstring.c23
17 files changed, 13 insertions, 1041 deletions
diff --git a/libc/string/Makefile b/libc/string/Makefile
index 2b8f39fac..2cd133472 100644
--- a/libc/string/Makefile
+++ b/libc/string/Makefile
@@ -38,17 +38,9 @@ MOBJW2= wcscasecmp.o wcscat.o wcschrnul.o wcschr.o wcscmp.o wcscpy.o wcscspn.o \
wcsnlen.o wcspbrk.o wcsrchr.o wcsspn.o wcsstr.o wcstok.o wmemchr.o \
wmemcmp.o wmemcpy.o wmemmove.o wmempcpy.o wmemset.o
-# ifeq ($(HAS_LOCALE),true)
-# MOBJ += strcoll.o
-# endif
-
MSRC1=strsignal.c
MOBJ1=strsignal.o psignal.o
-MOBJ2=
-#MSRC2=strstr.c
-#MOBJ2=strstr.o strcasestr.o
-
# CSRC=strpbrk.c strsep.c strtok.c strtok_r.c strcspn.c \
# strspn.c strcasecmp.c strncasecmp.c strerror.c bcopy.c bzero.c \
# bcmp.c sys_errlist.c dirname.c basename.c
diff --git a/libc/string/basename.c b/libc/string/basename.c
deleted file mode 100644
index a158745a9..000000000
--- a/libc/string/basename.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Return the name-within-directory of a file name.
- Copyright (C) 1996, 1997, 1998 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., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <string.h>
-
-char * basename(const char *filename)
-{
- char *p = strrchr (filename, '/');
- return p ? p + 1 : (char *) filename;
-}
diff --git a/libc/string/bcmp.c b/libc/string/bcmp.c
deleted file mode 100644
index b3bec9034..000000000
--- a/libc/string/bcmp.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/* Copyright (C) 1995,1996 Robert de Bath <rdebath@cix.compulink.co.uk>
- * This file is part of the Linux-8086 C library and is distributed
- * under the GNU Library General Public License.
- */
-#include <unistd.h>
-#include <string.h>
-#include <sys/types.h>
-
-int bcmp(const __ptr_t dest, const __ptr_t src, size_t len)
-{
- return memcmp(dest, src, len);
-}
-
diff --git a/libc/string/bcopy.c b/libc/string/bcopy.c
deleted file mode 100644
index 7f929db73..000000000
--- a/libc/string/bcopy.c
+++ /dev/null
@@ -1,15 +0,0 @@
-/* Copyright (C) 1995,1996 Robert de Bath <rdebath@cix.compulink.co.uk>
- * This file is part of the Linux-8086 C library and is distributed
- * under the GNU Library General Public License.
- */
-#include <unistd.h>
-#include <string.h>
-#include <sys/types.h>
-
-void bcopy(const __ptr_t src, __ptr_t dest, size_t len)
-{
-/* (void) memcpy(dest, src, len); */
- while (len--)
- *(char *) (dest++) = *(char *) (src++);
-}
-
diff --git a/libc/string/bzero.c b/libc/string/bzero.c
deleted file mode 100644
index f726032a8..000000000
--- a/libc/string/bzero.c
+++ /dev/null
@@ -1,15 +0,0 @@
-/* Copyright (C) 1995,1996 Robert de Bath <rdebath@cix.compulink.co.uk>
- * This file is part of the Linux-8086 C library and is distributed
- * under the GNU Library General Public License.
- */
-#include <unistd.h>
-#include <string.h>
-#include <sys/types.h>
-
-void bzero(__ptr_t dest, size_t len)
-{
- /* (void) memset(dest, '\0', len); */
- while (len--)
- *(char *) (dest++) = '\0';
-}
-
diff --git a/libc/string/dirname.c b/libc/string/dirname.c
deleted file mode 100644
index 89fc31ed8..000000000
--- a/libc/string/dirname.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/* dirname - return directory part of PATH.
- Copyright (C) 1996, 2000 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- 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., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#define __USE_GNU
-#include <libgen.h>
-#include <string.h>
-
-
-char * dirname(char *path)
-{
- static const char dot[] = ".";
- char *last_slash;
-
- /* Find last '/'. */
- last_slash = path != NULL ? strrchr (path, '/') : NULL;
-
- if (last_slash != NULL && last_slash != path && last_slash[1] == '\0')
- /* The '/' is the last character, we have to look further. */
- last_slash = memrchr (path, '/', last_slash - path);
-
- if (last_slash != NULL)
- {
- /* Terminate the path. */
- if (last_slash == path)
- /* The last slash is the first character in the string. We have to
- return "/". */
- ++last_slash;
-
- last_slash[0] = '\0';
- }
- else
- /* This assignment is ill-designed but the XPG specs require to
- return a string containing "." in any case no directory part is
- found and so a static and constant string is required. */
- path = (char *) dot;
-
- return path;
-}
diff --git a/libc/string/strcasecmp.c b/libc/string/strcasecmp.c
deleted file mode 100644
index bae659450..000000000
--- a/libc/string/strcasecmp.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * strcasecmp for uClibc
- * Copyright (C) 2002 by Brian Stafford <brian@stafford.uklinux.net>
- *
- * This program 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.
- *
- * This program 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 this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include <string.h>
-#include <ctype.h>
-
-int strcasecmp (const char *a, const char *b)
-{
- register int n;
-
- while (*a == *b || (n = tolower (*a) - tolower (*b)) == 0)
- {
- if (*a == '\0')
- return 0;
- a++, b++;
- }
- return n;
-}
-
diff --git a/libc/string/strcspn.c b/libc/string/strcspn.c
deleted file mode 100644
index 6ba03dd37..000000000
--- a/libc/string/strcspn.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Copyright (C) 1991, 1994, 1996, 1997 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., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <string.h>
-
-/* Return the length of the maximum initial segment of S
- which contains no characters from REJECT. */
-size_t strcspn( const char *s, const char *reject)
-{
- register const char *scan1;
- register const char *scan2;
- size_t count;
-
- count = 0;
- for (scan1 = s; *scan1 != '\0'; scan1++) {
- for (scan2 = reject; *scan2 != '\0';) /* ++ moved down. */
- if (*scan1 == *scan2++)
- return(count);
- count++;
- }
- return(count);
-}
-
diff --git a/libc/string/string.c b/libc/string/string.c
deleted file mode 100644
index 019e358b5..000000000
--- a/libc/string/string.c
+++ /dev/null
@@ -1,465 +0,0 @@
-/* vi: set sw=4 ts=4: */
-/* Copyright (C) 1995,1996 Robert de Bath <rdebath@cix.compulink.co.uk>
- * This file is part of the Linux-8086 C library and is distributed
- * under the GNU Library General Public License.
- *
- * Many of the functions in this file have been rewritten for correctness
- * (but not necessarily speed) by Erik Andersen <andersee@debian.org>
- */
-
-#include <string.h>
-#include <malloc.h>
-
-/********************** Function strlen ************************************/
-
-#ifdef L_strlen
-size_t strlen(const char *str)
-{
- register char *ptr = (char *) str;
-
- while (*ptr)
- ptr++;
- return (ptr - str);
-}
-#endif
-
-/********************** Function strnlen ************************************/
-
-#ifdef L_strnlen
-size_t strnlen (const char *string, size_t maxlen)
-{
- const char *end = memchr (string, '\0', maxlen);
- return end ? end - string : maxlen;
-}
-#endif
-
-/********************** Function strcat ************************************/
-
-#ifdef L_strcat
-char *strcat(char *dst, const char *src)
-{
- register char *ptr = dst;
-
- while (*ptr)
- ptr++;
-
- while (*src)
- *ptr++ = *src++;
- *ptr = '\0';
-
- return dst;
-}
-#endif
-
-/********************** Function strcpy ************************************/
-
-#ifdef L_strcpy
-char *strcpy(char *dst, const char *src)
-{
- register char *ptr = dst;
-
- while (*src)
- *dst++ = *src++;
- *dst = '\0';
-
- return ptr;
-}
-#endif
-
-/********************** Function stpcpy ************************************/
-
-#ifdef L_stpcpy
-char *stpcpy(char *dst, const char *src)
-{
- while (*src)
- *dst++ = *src++;
- *dst = '\0';
-
- return dst;
-}
-#endif
-
-/********************** Function stpncpy ************************************/
-
-#ifdef L_stpncpy
-char *stpncpy(register char * __restrict s1,
- register const char * __restrict s2, size_t n)
-{
- char *s = s1;
- const char *p = s2;
-
- while (n) {
- if ((*s = *s2) != 0) s2++; /* Need to fill tail with 0s. */
- ++s;
- --n;
- }
- return s1 + (s2 - p);
-}
-#endif
-
-
-/********************** Function strcmp ************************************/
-
-#ifdef L_strcmp
-int strcmp(const char *s1, const char *s2)
-{
- unsigned register char c1, c2;
-
- do {
- c1 = (unsigned char) *s1++;
- c2 = (unsigned char) *s2++;
- if (c1 == '\0')
- return c1 - c2;
- }
- while (c1 == c2);
-
- return c1 - c2;
-}
-
-#ifndef __UCLIBC_HAS_LOCALE__
-weak_alias(strcmp, strcoll);
-#endif /* __UCLIBC_HAS_LOCALE__ */
-#endif
-
-/***** Function strcoll (locale only, as non-locale is alias of strcmp *****/
-
-#ifdef L_strcoll
-#ifdef __UCLIBC_HAS_LOCALE__
-
-#include "../misc/locale/_locale.h"
-
-const unsigned char *_uc_collate_b; /* NULL for no collate, strcoll->strcmp */
-
-int strcoll(const char *s1, const char *s2)
-{
- unsigned char c1, c2;
-
- while(1) {
- c1 = (unsigned char) *s1;
- c2 = (unsigned char) *s2;
- if(_uc_collate_b) { /* setuped non-C locale? */
- c1 = _uc_collate_b[c1];
- c2 = _uc_collate_b[c2];
- }
- if (*s1 == '\0' || c1 != c2)
- return c1 - c2;
- s1++;
- s2++;
- }
-}
-#endif /* __UCLIBC_HAS_LOCALE__ */
-#endif
-
-/********************** Function strncat ************************************/
-
-#ifdef L_strncat
-char *strncat(char *dst, const char *src, size_t len)
-{
- register char *s1 = dst + strlen(dst), *s2;
-
- s2 = memchr(src, 0, len);
- if (s2) {
- memcpy(s1, src, s2 - src + 1);
- } else {
- memcpy(s1, src, len);
- s1[len] = '\0';
- }
- return dst;
-}
-#endif
-
-/********************** Function strncpy ************************************/
-
-#ifdef L_strncpy
-char *strncpy(char *dst, const char *src, size_t len)
-{
- char *ptr = dst;
-
- while (len--) {
- if (*src)
- *dst++ = *src++;
- else
- *dst++ = '\0';
- }
-
- return ptr;
-}
-#endif
-
-#ifdef L_strxfrm
-size_t strxfrm(char *dst, const char *src, size_t len)
-{
- size_t length;
- strncpy( dst, src, len);
- length = strlen(src);
- if (length<len)
- return(length);
- return( len);
-}
-#endif
-
-/********************** Function strncmp ************************************/
-
-#ifdef L_strncmp
-int strncmp(const char *s1, const char *s2, size_t len)
-{
- unsigned register char c1 = '\0';
- unsigned register char c2 = '\0';
-
- while (len > 0) {
- c1 = (unsigned char) *s1++;
- c2 = (unsigned char) *s2++;
- if (c1 == '\0' || c1 != c2)
- return c1 - c2;
- len--;
- }
-
- return c1 - c2;
-}
-#endif
-
-/********************** Function strchr ************************************/
-
-#ifdef L_strchr
-char *strchr(const char *str, int c)
-{
- register char ch;
-
- do {
- if ((ch = *str) == c)
- return (char *) str;
- str++;
- }
- while (ch);
-
- return 0;
-}
-
-weak_alias(strchr, index);
-#endif
-
-/********************** Function strrchr ************************************/
-
-#ifdef L_strrchr
-
-char *strrchr(const char *str, int c)
-{
- register char *prev = 0;
- register char *ptr = (char *) str;
-
- while (*ptr != '\0') {
- if (*ptr == c)
- prev = ptr;
- ptr++;
- }
- if (c == '\0')
- return(ptr);
- return(prev);
-}
-
-weak_alias(strrchr, rindex);
-#endif
-
-/********************** Function strdup ************************************/
-
-#ifdef L_strdup
-char *strdup(const char *str)
-{
- register size_t len;
- register char *dst;
-
- len = strlen(str) + 1;
- dst = (char *) malloc(len);
- if (dst)
- memcpy(dst, str, len);
- return dst;
-}
-#endif
-
-/********************** Function strndup ************************************/
-#ifdef L_strndup
-char *strndup(const char *str, size_t len)
-{
- register size_t n;
- register char *dst;
-
- n = strlen(str);
- if (len < n)
- n = len;
- dst = (char *) malloc(n+1);
- if (dst) {
- memcpy(dst, str, n);
- dst[n] = '\0';
- }
- return dst;
-}
-#endif
-
-/********************** Function memcpy ************************************/
-
-#ifdef L_memcpy
-void *memcpy(void *dst, const void *src, size_t len)
-{
- register char *a = dst;
- register const char *b = src;
-
- while (len--)
- *a++ = *b++;
-
- return dst;
-}
-#endif
-
-/********************** Function mempcpy ************************************/
-
-#ifdef L_mempcpy
-void *mempcpy(void *dst, const void *src, size_t len)
-{
- register char *a = dst;
- register const char *b = src;
-
- while (len--)
- *a++ = *b++;
-
- return (void *) a;
-}
-weak_alias(mempcpy, __mempcpy);
-#endif
-
-/********************** Function memccpy ************************************/
-
-#ifdef L_memccpy
-void *memccpy(void *dst, const void *src, int c, size_t len)
-{
- register char *a = dst;
- register const char *b = src;
-
- while (len--) {
- if ((*a++ = *b++) == c)
- return a;
- }
-
- return 0;
-}
-#endif
-
-/********************** Function memset ************************************/
-
-#ifdef L_memset
-void *memset(void *str, int c, size_t len)
-{
- register char *a = str;
-
- while (len--)
- *a++ = c;
-
- return str;
-}
-#endif
-
-/********************** Function memmove ************************************/
-
-#ifdef L_memmove
-void *memmove(void *dst, const void *src, size_t len)
-{
- register char *s1 = dst, *s2 = (char *) src;
-
- /* This bit of sneakyness c/o Glibc, it assumes the test is unsigned */
- if (s1 - s2 >= len)
- return memcpy(dst, src, len);
-
- /* This reverse copy only used if we absolutly have to */
- s1 += len;
- s2 += len;
- while (len-- > 0)
- *(--s1) = *(--s2);
- return dst;
-}
-#endif
-
-/********************** Function memchr ************************************/
-
-#ifdef L_memchr
-void *memchr(const void *str, int c, size_t len)
-{
- register unsigned char *ptr = (unsigned char *) str;
-
- while (len--) {
- if (*ptr == (unsigned char) c)
- return ptr;
- ptr++;
- }
-
- return 0;
-}
-#endif
-
-/********************** Function memrchr ************************************/
-
-#ifdef L_memrchr
-void *memrchr(const void *str, int c, size_t len)
-{
- register unsigned char *ptr;
-
- for (ptr = (unsigned char *) str + len; len > 0; len--) {
- if (*--ptr == (unsigned char) c)
- return ptr;
- }
-
- return 0;
-}
-#endif
-
-/********************** Function memcmp ************************************/
-
-#ifdef L_memcmp
-int memcmp(const void *s1, const void *s2, size_t len)
-{
- unsigned char *c1 = (unsigned char *)s1;
- unsigned char *c2 = (unsigned char *)s2;
-
- while (len--) {
- if (*c1 != *c2)
- return *c1 - *c2;
- c1++;
- c2++;
- }
- return 0;
-}
-#endif
-
-
-/********************** Function memcmp ************************************/
-
-#ifdef L_ffs
-int ffs(int x)
-{
- int r = 1;
-
- if (!x)
- return 0;
- if (!(x & 0xffff)) {
- x >>= 16;
- r += 16;
- }
- if (!(x & 0xff)) {
- x >>= 8;
- r += 8;
- }
- if (!(x & 0xf)) {
- x >>= 4;
- r += 4;
- }
- if (!(x & 3)) {
- x >>= 2;
- r += 2;
- }
- if (!(x & 1)) {
- x >>= 1;
- r += 1;
- }
- return r;
-}
-#endif
-
-/********************** THE END ********************************************/
diff --git a/libc/string/strncasecmp.c b/libc/string/strncasecmp.c
deleted file mode 100644
index dc274ddb6..000000000
--- a/libc/string/strncasecmp.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * strncasecmp for uClibc
- * Copyright (C) 2002 by Brian Stafford <brian@stafford.uklinux.net>
- *
- * This program 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.
- *
- * This program 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 this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include <string.h>
-#include <ctype.h>
-
-int strncasecmp (const char *a, const char *b, size_t len)
-{
- register int n;
-
- if (len < 1)
- return 0;
- while (*a == *b || (n = tolower (*a) - tolower (*b)) == 0)
- {
- if (*a == '\0' || --len < 1)
- return 0;
- a++, b++;
- }
- return n;
-}
-
diff --git a/libc/string/strpbrk.c b/libc/string/strpbrk.c
deleted file mode 100644
index fe2ec229d..000000000
--- a/libc/string/strpbrk.c
+++ /dev/null
@@ -1,19 +0,0 @@
-/* Copyright (C) 1995,1996 Robert de Bath <rdebath@cix.compulink.co.uk>
- * This file is part of the Linux-8086 C library and is distributed
- * under the GNU Library General Public License.
- */
-
-#include <string.h>
-
-/* This uses strchr, strchr should be in assembler */
-
-char *strpbrk( const char *str, const char *set)
-{
- while (*str != '\0')
- if (strchr(set, *str) == 0)
- ++str;
- else
- return (char *) str;
-
- return 0;
-}
diff --git a/libc/string/strsep.c b/libc/string/strsep.c
deleted file mode 100644
index 797b74400..000000000
--- a/libc/string/strsep.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Copyright (C) 1992, 93, 96, 97, 98, 99 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., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <string.h>
-
-
-char * strsep( char **stringp, const char *delim)
-{
- char *begin, *end;
-
- begin = *stringp;
- if (begin == NULL)
- return NULL;
-
- /* A frequent case is when the delimiter string contains only one
- character. Here we don't need to call the expensive `strpbrk'
- function and instead work using `strchr'. */
- if (delim[0] == '\0' || delim[1] == '\0')
- {
- char ch = delim[0];
-
- if (ch == '\0')
- end = NULL;
- else
- {
- if (*begin == ch)
- end = begin;
- else if (*begin == '\0')
- end = NULL;
- else
- end = strchr (begin + 1, ch);
- }
- }
- else
- /* Find the end of the token. */
- end = strpbrk (begin, delim);
-
- if (end)
- {
- /* Terminate the token and set *STRINGP past NUL character. */
- *end++ = '\0';
- *stringp = end;
- }
- else
- /* No more delimiters; this is the last token. */
- *stringp = NULL;
-
- return begin;
-}
-
diff --git a/libc/string/strspn.c b/libc/string/strspn.c
deleted file mode 100644
index 70b510a7f..000000000
--- a/libc/string/strspn.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright (C) 1991, 1997 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., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <string.h>
-
-#undef strspn
-
-/* Return the length of the maximum initial segment
- of S which contains only characters in ACCEPT. */
-size_t strspn( const char *s, const char *accept)
-{
- const char *p;
- const char *a;
- size_t count = 0;
-
- for (p = s; *p != '\0'; ++p) {
- for (a = accept; *a != '\0'; ++a)
- if (*p == *a)
- break;
- if (*a == '\0')
- return count;
- else
- ++count;
- }
-
- return count;
-}
diff --git a/libc/string/strstr.c b/libc/string/strstr.c
deleted file mode 100644
index 6aa448787..000000000
--- a/libc/string/strstr.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/* Return the offset of one string within another.
- Copyright (C) 1994, 1996, 1997 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., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-/*
- * My personal strstr() implementation that beats most other algorithms.
- * Until someone tells me otherwise, I assume that this is the
- * fastest implementation of strstr() in C.
- * I deliberately chose not to comment it. You should have at least
- * as much fun trying to understand it, as I had to write it :-).
- *
- * Stephen R. van den Berg, berg@pool.informatik.rwth-aachen.de */
-/* added strcasestr support, davidm@lineo.com */
-
-#if HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#if defined _LIBC || defined HAVE_STRING_H
-# include <string.h>
-#endif
-
-typedef unsigned chartype;
-
-#if defined(L_strstr)
-
-#define VAL(x) (x)
-#define FUNC strstr
-#undef strstr
-
-#elif defined(L_strcasestr)
-
-#include <ctype.h>
-#define VAL(x) tolower(x)
-#define FUNC strcasestr
-#undef strcasestr
-
-#else
-
-#error "No target function defined."
-
-#endif
-
-char * FUNC ( const char *phaystack, const char *pneedle)
-{
- register const unsigned char *haystack, *needle;
- register chartype b, c;
-
- haystack = (const unsigned char *) phaystack;
- needle = (const unsigned char *) pneedle;
-
- b = *needle;
- if (b != '\0') {
- haystack--; /* possible ANSI violation */
- do {
- c = *++haystack;
- if (c == '\0')
- goto ret0;
- }
- while (VAL(c) != VAL(b));
-
- c = *++needle;
- if (c == '\0')
- goto foundneedle;
- ++needle;
- goto jin;
-
- for (;;) {
- register chartype a;
- register const unsigned char *rhaystack, *rneedle;
-
- do {
- a = *++haystack;
- if (a == '\0')
- goto ret0;
- if (VAL(a) == VAL(b))
- break;
- a = *++haystack;
- if (a == '\0')
- goto ret0;
- shloop:
- ;
- }
- while (VAL(a) != VAL(b));
-
- jin:a = *++haystack;
- if (a == '\0')
- goto ret0;
-
- if (VAL(a) != VAL(c))
- goto shloop;
-
- rhaystack = haystack-- + 1;
- rneedle = needle;
- a = *rneedle;
-
- if (VAL(*rhaystack) == VAL(a))
- do {
- if (a == '\0')
- goto foundneedle;
- ++rhaystack;
- a = *++needle;
- if (VAL(*rhaystack) != VAL(a))
- break;
- if (a == '\0')
- goto foundneedle;
- ++rhaystack;
- a = *++needle;
- }
- while (VAL(*rhaystack) == VAL(a));
-
- needle = rneedle; /* took the register-poor approach */
-
- if (a == '\0')
- break;
- }
- }
- foundneedle:
- return (char *) haystack;
- ret0:
- return 0;
-}
diff --git a/libc/string/strtok.c b/libc/string/strtok.c
deleted file mode 100644
index dfe05d780..000000000
--- a/libc/string/strtok.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <string.h>
-
-static char *save = 0;
-
-char *strtok(char *s, const char *delim)
-{
- return strtok_r(s, delim, &save);
-}
diff --git a/libc/string/strtok_r.c b/libc/string/strtok_r.c
deleted file mode 100644
index 78b3b7e37..000000000
--- a/libc/string/strtok_r.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* 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. */
-
-/*
- * Modified by Manuel Novoa III Mar 1, 2001
- *
- * Converted original strtok.c code of strtok to __strtok_r.
- * Cleaned up logic and reduced code size.
- */
-
-#include <string.h>
-
-char *strtok_r(char *s, const char *delim, char **save_ptr)
-{
- char *token;
-
- token = 0; /* Initialize to no token. */
-
- if (s == 0) { /* If not first time called... */
- s = *save_ptr; /* restart from where we left off. */
- }
-
- if (s != 0) { /* If not finished... */
- *save_ptr = 0;
-
- s += strspn(s, delim); /* Skip past any leading delimiters. */
- if (*s != '\0') { /* We have a token. */
- token = s;
- *save_ptr = strpbrk(token, delim); /* Find token's end. */
- if (*save_ptr != 0) {
- /* Terminate the token and make SAVE_PTR point past it. */
- *(*save_ptr)++ = '\0';
- }
- }
- }
-
- return token;
-}
diff --git a/libc/string/wstring.c b/libc/string/wstring.c
index 53c5af99c..4c619ad36 100644
--- a/libc/string/wstring.c
+++ b/libc/string/wstring.c
@@ -320,16 +320,19 @@ int Wstrcmp(register const Wchar *s1, register const Wchar *s2)
/**********************************************************************/
#ifdef L_strcoll
#error implement strcoll and remove weak_alias!!
-/* extern unsigned char *_ctype_collate; */
-/* int strcoll(register const char *s1, const char *s2) */
-/* { */
-/* int r; */
+#if 0
+extern unsigned char *_ctype_collate;
+int strcoll(register const char *s1, const char *s2)
+{
+ int r;
+
+ while (!(r = (_ctype_collate[(int)(*s1++)]-_ctype_collate[(int)(*s2++)])));
+
+ return r;
+}
+#endif
-/* while (!(r = (_ctype_collate[(int)(*s1++)]-_ctype_collate[(int)(*s2++)]))); */
-
-/* return r; */
-/* } */
#endif
/**********************************************************************/
#ifdef L_wcsncmp
@@ -369,8 +372,8 @@ int Wstrncmp(register const Wchar *s1, register const Wchar *s2, size_t n)
/**********************************************************************/
#ifdef L_strxfrm
#error implement strxfrm
-/* size_t strxfrm(char * __restrict s1, const char * __restrict s2, size_t n) */
-#endif
+/* size_t strxfrm(char *dst, const char *src, size_t len); */
+#endif
/**********************************************************************/
#ifdef L_wmemchr
#define L_memchr