aboutsummaryrefslogtreecommitdiff
path: root/newlib/libc/string
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2009-03-11 12:57:53 +0000
committerCorinna Vinschen <corinna@vinschen.de>2009-03-11 12:57:53 +0000
commitdc48005c286d3bd25c0e881174cc72a3ab511fd7 (patch)
treeacf2d973b056b592e92aec08fc2539c769e193fc /newlib/libc/string
parent32382e935a569058fbd94748d4d1468ab6224936 (diff)
downloadnewlib-dc48005c286d3bd25c0e881174cc72a3ab511fd7.zip
newlib-dc48005c286d3bd25c0e881174cc72a3ab511fd7.tar.gz
newlib-dc48005c286d3bd25c0e881174cc72a3ab511fd7.tar.bz2
* libc/include/wchar.h (wcscasecmp, wcsncasecmp): Declare.
* libc/string/Makefile.am: Add wcscasecmp.c, wcsncasecmp.c * libc/stdio/Makefile.in: Regenerate. * libc/string/strings.tex: Add new documentation references. * libc/string/wcscasecmp.c: New file. * libc/string/wcsncasecmp.c: New file.
Diffstat (limited to 'newlib/libc/string')
-rw-r--r--newlib/libc/string/Makefile.am8
-rw-r--r--newlib/libc/string/Makefile.in50
-rw-r--r--newlib/libc/string/strings.tex8
-rw-r--r--newlib/libc/string/wcscasecmp.c56
-rw-r--r--newlib/libc/string/wcsncasecmp.c64
5 files changed, 165 insertions, 21 deletions
diff --git a/newlib/libc/string/Makefile.am b/newlib/libc/string/Makefile.am
index 1a3433e..6e630d3 100644
--- a/newlib/libc/string/Makefile.am
+++ b/newlib/libc/string/Makefile.am
@@ -98,7 +98,9 @@ if ELIX_LEVEL_3
ELIX_4_SOURCES =
else
ELIX_4_SOURCES = \
- memmem.c
+ memmem.c \
+ wcscasecmp.c \
+ wcsncasecmp.c
endif !ELIX_LEVEL_3
endif !ELIX_LEVEL_2
endif !ELIX_LEVEL_1
@@ -127,9 +129,9 @@ memchr.def strcat.def strerror.def strerror_r.def strrchr.def \
memcmp.def strchr.def strlen.def strnlen.def strspn.def \
strcasecmp.def strncasecmp.def strcasestr.def strlwr.def strupr.def \
memccpy.def mempcpy.def stpcpy.def stpncpy.def \
-wcscat.def wcschr.def wcscmp.def wcscoll.def \
+wcscasecmp.def wcscat.def wcschr.def wcscmp.def wcscoll.def \
wcscpy.def wcscspn.def wcpcpy.def wcpncpy.def \
-wcslcat.def wcslcpy.def wcslen.def wcsncat.def \
+wcslcat.def wcslcpy.def wcslen.def wcsncasecmp.def wcsncat.def \
wcsncmp.def wcsncpy.def wcsnlen.def wcspbrk.def \
wcsrchr.def wcsspn.def wcsstr.def wcstok.def \
wcswidth.def wcsxfrm.def wcwidth.def wmemchr.def \
diff --git a/newlib/libc/string/Makefile.in b/newlib/libc/string/Makefile.in
index f4607e0..c28d000 100644
--- a/newlib/libc/string/Makefile.in
+++ b/newlib/libc/string/Makefile.in
@@ -38,6 +38,7 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
+LIBOBJDIR =
DIST_COMMON = $(srcdir)/../../Makefile.shared $(srcdir)/Makefile.in \
$(srcdir)/Makefile.am
subdir = string
@@ -100,7 +101,9 @@ am__objects_1 = lib_a-bcopy.$(OBJEXT) lib_a-bzero.$(OBJEXT) \
@ELIX_LEVEL_1_FALSE@ lib_a-strndup_r.$(OBJEXT) \
@ELIX_LEVEL_1_FALSE@ lib_a-wcpcpy.$(OBJEXT) \
@ELIX_LEVEL_1_FALSE@ lib_a-wcpncpy.$(OBJEXT)
-@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@am__objects_3 = lib_a-memmem.$(OBJEXT)
+@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@am__objects_3 = lib_a-memmem.$(OBJEXT) \
+@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@ lib_a-wcscasecmp.$(OBJEXT) \
+@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@ lib_a-wcsncasecmp.$(OBJEXT)
@USE_LIBTOOL_FALSE@am_lib_a_OBJECTS = $(am__objects_1) \
@USE_LIBTOOL_FALSE@ $(am__objects_2) $(am__objects_3)
lib_a_OBJECTS = $(am_lib_a_OBJECTS)
@@ -123,7 +126,9 @@ am__objects_4 = bcopy.lo bzero.lo index.lo memchr.lo memcmp.lo \
@ELIX_LEVEL_1_FALSE@ stpcpy.lo stpncpy.lo strndup.lo \
@ELIX_LEVEL_1_FALSE@ strcasestr.lo strndup_r.lo wcpcpy.lo \
@ELIX_LEVEL_1_FALSE@ wcpncpy.lo
-@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@am__objects_6 = memmem.lo
+@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@am__objects_6 = memmem.lo \
+@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@ wcscasecmp.lo \
+@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@ wcsncasecmp.lo
@USE_LIBTOOL_TRUE@am_libstring_la_OBJECTS = $(am__objects_4) \
@USE_LIBTOOL_TRUE@ $(am__objects_5) $(am__objects_6)
libstring_la_OBJECTS = $(am_libstring_la_OBJECTS)
@@ -252,20 +257,8 @@ STRIP = @STRIP@
USE_LIBTOOL_FALSE = @USE_LIBTOOL_FALSE@
USE_LIBTOOL_TRUE = @USE_LIBTOOL_TRUE@
VERSION = @VERSION@
-ac_ct_AR = @ac_ct_AR@
-ac_ct_AS = @ac_ct_AS@
ac_ct_CC = @ac_ct_CC@
-ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
-ac_ct_DSYMUTIL = @ac_ct_DSYMUTIL@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-ac_ct_LIPO = @ac_ct_LIPO@
-ac_ct_NMEDIT = @ac_ct_NMEDIT@
-ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
-ac_ct_OTOOL = @ac_ct_OTOOL@
-ac_ct_OTOOL64 = @ac_ct_OTOOL64@
-ac_ct_RANLIB = @ac_ct_RANLIB@
-ac_ct_READELF = @ac_ct_READELF@
-ac_ct_STRIP = @ac_ct_STRIP@
aext = @aext@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
@@ -281,6 +274,9 @@ build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
exec_prefix = @exec_prefix@
extra_dir = @extra_dir@
host = @host@
@@ -288,12 +284,14 @@ host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
+htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
libm_machine_dir = @libm_machine_dir@
+localedir = @localedir@
localstatedir = @localstatedir@
lpfx = @lpfx@
lt_ECHO = @lt_ECHO@
@@ -303,8 +301,10 @@ mkdir_p = @mkdir_p@
newlib_basedir = @newlib_basedir@
oext = @oext@
oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
+psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
subdirs = @subdirs@
@@ -395,7 +395,9 @@ GENERAL_SOURCES = \
@ELIX_LEVEL_1_TRUE@ELIX_2_SOURCES =
@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@ELIX_4_SOURCES = \
-@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@ memmem.c
+@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@ memmem.c \
+@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@ wcscasecmp.c \
+@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@ wcsncasecmp.c
@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_TRUE@ELIX_4_SOURCES =
@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_TRUE@ELIX_4_SOURCES =
@@ -417,9 +419,9 @@ memchr.def strcat.def strerror.def strerror_r.def strrchr.def \
memcmp.def strchr.def strlen.def strnlen.def strspn.def \
strcasecmp.def strncasecmp.def strcasestr.def strlwr.def strupr.def \
memccpy.def mempcpy.def stpcpy.def stpncpy.def \
-wcscat.def wcschr.def wcscmp.def wcscoll.def \
+wcscasecmp.def wcscat.def wcschr.def wcscmp.def wcscoll.def \
wcscpy.def wcscspn.def wcpcpy.def wcpncpy.def \
-wcslcat.def wcslcpy.def wcslen.def wcsncat.def \
+wcslcat.def wcslcpy.def wcslen.def wcsncasecmp.def wcsncat.def \
wcsncmp.def wcsncpy.def wcsnlen.def wcspbrk.def \
wcsrchr.def wcsspn.def wcsstr.def wcstok.def \
wcswidth.def wcsxfrm.def wcwidth.def wmemchr.def \
@@ -959,6 +961,18 @@ lib_a-memmem.o: memmem.c
lib_a-memmem.obj: memmem.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-memmem.obj `if test -f 'memmem.c'; then $(CYGPATH_W) 'memmem.c'; else $(CYGPATH_W) '$(srcdir)/memmem.c'; fi`
+lib_a-wcscasecmp.o: wcscasecmp.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wcscasecmp.o `test -f 'wcscasecmp.c' || echo '$(srcdir)/'`wcscasecmp.c
+
+lib_a-wcscasecmp.obj: wcscasecmp.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wcscasecmp.obj `if test -f 'wcscasecmp.c'; then $(CYGPATH_W) 'wcscasecmp.c'; else $(CYGPATH_W) '$(srcdir)/wcscasecmp.c'; fi`
+
+lib_a-wcsncasecmp.o: wcsncasecmp.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wcsncasecmp.o `test -f 'wcsncasecmp.c' || echo '$(srcdir)/'`wcsncasecmp.c
+
+lib_a-wcsncasecmp.obj: wcsncasecmp.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wcsncasecmp.obj `if test -f 'wcsncasecmp.c'; then $(CYGPATH_W) 'wcsncasecmp.c'; else $(CYGPATH_W) '$(srcdir)/wcsncasecmp.c'; fi`
+
mostlyclean-libtool:
-rm -f *.lo
@@ -966,7 +980,7 @@ clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
- -rm -f libtool
+ -rm -f libtool config.lt
uninstall-info-am:
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
diff --git a/newlib/libc/string/strings.tex b/newlib/libc/string/strings.tex
index 6750f3e..0ad6137 100644
--- a/newlib/libc/string/strings.tex
+++ b/newlib/libc/string/strings.tex
@@ -46,6 +46,8 @@ managing areas of memory. The corresponding declarations are in
* strupr:: Convert string to upper case
* strxfrm:: Transform string
* swab:: Swap adjacent bytes
+* wcscasecmp:: Compare wide character strings ignoring case
+* wcsncasecmp:: Compare wide character strings ignoring case
@end menu
@page
@@ -167,3 +169,9 @@ managing areas of memory. The corresponding declarations are in
@page
@include string/swab.def
+
+@page
+@include string/wcscasecmp.def
+
+@page
+@include string/wcsncasecmp.def
diff --git a/newlib/libc/string/wcscasecmp.c b/newlib/libc/string/wcscasecmp.c
new file mode 100644
index 0000000..f9f169f
--- /dev/null
+++ b/newlib/libc/string/wcscasecmp.c
@@ -0,0 +1,56 @@
+/*
+FUNCTION
+ <<wcscasecmp>>---case-insensitive wide character string compare
+
+INDEX
+ wcscasecmp
+
+ANSI_SYNOPSIS
+ #include <wchar.h>
+ int wcscasecmp(const wchar_t *<[a]>, const wchar_t *<[b]>);
+
+TRAD_SYNOPSIS
+ #include <wchar.h>
+ int wcscasecmp(<[a]>, <[b]>)
+ wchar_t *<[a]>;
+ wchar_t *<[b]>;
+
+DESCRIPTION
+ <<wcscasecmp>> compares the wide character string at <[a]> to
+ the wide character string at <[b]> in a case-insensitive manner.
+
+RETURNS
+
+ If <<*<[a]>>> sorts lexicographically after <<*<[b]>>> (after
+ both are converted to uppercase), <<wcscasecmp>> returns a
+ number greater than zero. If the two strings match,
+ <<wcscasecmp>> returns zero. If <<*<[a]>>> sorts
+ lexicographically before <<*<[b]>>>, <<wcscasecmp>> returns a
+ number less than zero.
+
+PORTABILITY
+POSIX-1.2008
+
+<<wcscasecmp>> requires no supporting OS subroutines. It uses
+tolower() from elsewhere in this library.
+
+QUICKREF
+ wcscasecmp
+*/
+
+#include <wchar.h>
+#include <wctype.h>
+
+int
+_DEFUN (wcscasecmp, (s1, s2),
+ _CONST wchar_t *s1 _AND
+ _CONST wchar_t *s2)
+{
+ while (*s1 != '\0' && towlower(*s1) == towlower(*s2))
+ {
+ s1++;
+ s2++;
+ }
+
+ return towlower(*s1) - towlower(*s2);
+}
diff --git a/newlib/libc/string/wcsncasecmp.c b/newlib/libc/string/wcsncasecmp.c
new file mode 100644
index 0000000..1634ca1
--- /dev/null
+++ b/newlib/libc/string/wcsncasecmp.c
@@ -0,0 +1,64 @@
+/*
+FUNCTION
+ <<wcsncasecmp>>---case-insensitive wide character string compare
+
+INDEX
+ wcsncasecmp
+
+ANSI_SYNOPSIS
+ #include <wchar.h>
+ int wcsncasecmp(const wchar_t *<[a]>, const wchar_t * <[b]>, size_t <[length]>);
+
+TRAD_SYNOPSIS
+ #include <wchar.h>
+ int wcsncasecmp(<[a]>, <[b]>, <[length]>)
+ wchar_t *<[a]>;
+ wchar_t *<[b]>;
+ size_t <[length]>
+
+DESCRIPTION
+ <<wcsncasecmp>> compares up to <[length]> wide characters
+ from the string at <[a]> to the string at <[b]> in a
+ case-insensitive manner.
+
+RETURNS
+
+ If <<*<[a]>>> sorts lexicographically after <<*<[b]>>> (after
+ both are converted to uppercase), <<wcsncasecmp>> returns a
+ number greater than zero. If the two strings are equivalent,
+ <<wcsncasecmp>> returns zero. If <<*<[a]>>> sorts
+ lexicographically before <<*<[b]>>>, <<wcsncasecmp>> returns a
+ number less than zero.
+
+PORTABILITY
+POSIX-1.2008
+
+<<wcsncasecmp>> requires no supporting OS subroutines. It uses
+tolower() from elsewhere in this library.
+
+QUICKREF
+ wcsncasecmp
+*/
+
+#include <wchar.h>
+#include <wctype.h>
+
+int
+_DEFUN (wcsncasecmp, (s1, s2, n),
+ _CONST wchar_t *s1 _AND
+ _CONST wchar_t *s2 _AND
+ size_t n)
+{
+ if (n == 0)
+ return 0;
+
+ while (n-- != 0 && towlower(*s1) == towlower(*s2))
+ {
+ if (n == 0 || *s1 == '\0' || *s2 == '\0')
+ break;
+ s1++;
+ s2++;
+ }
+
+ return towlower(*s1) - towlower(*s2);
+}