diff options
Diffstat (limited to 'newlib/libc/string')
69 files changed, 0 insertions, 6555 deletions
diff --git a/newlib/libc/string/Makefile.am b/newlib/libc/string/Makefile.am deleted file mode 100644 index cc7c9e732..000000000 --- a/newlib/libc/string/Makefile.am +++ /dev/null @@ -1,126 +0,0 @@ -## Process this file with automake to generate Makefile.in - -AUTOMAKE_OPTIONS = cygnus - -INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) - -GENERAL_SOURCES = \ - bcopy.c \ - bzero.c \ - index.c \ - memchr.c \ - memcmp.c \ - memcpy.c \ - memmove.c \ - memset.c \ - rindex.c \ - strcasecmp.c \ - strcat.c \ - strchr.c \ - strcmp.c \ - strcoll.c \ - strcpy.c \ - strcspn.c \ - strdup.c \ - strdup_r.c \ - strerror.c \ - strerror_r.c \ - strlcat.c \ - strlcpy.c \ - strlen.c \ - strlwr.c \ - strncasecmp.c \ - strncat.c \ - strncmp.c \ - strncpy.c \ - strnlen.c \ - strpbrk.c \ - strrchr.c \ - strsep.c \ - strspn.c \ - strtok.c \ - strtok_r.c \ - strupr.c \ - strxfrm.c \ - strstr.c \ - swab.c \ - u_strerr.c \ - wcscat.c \ - wcschr.c \ - wcscmp.c \ - wcscpy.c \ - wcscspn.c \ - wcslcat.c \ - wcslcpy.c \ - wcslen.c \ - wcsncat.c \ - wcsncmp.c \ - wcsncpy.c \ - wcspbrk.c \ - wcsrchr.c \ - wcsspn.c \ - wcsstr.c \ - wmemchr.c \ - wmemcmp.c \ - wmemcpy.c \ - wmemmove.c \ - wmemset.c - -if ELIX_LEVEL_1 -LIB_OBJS = -else -LIB_OBJS = \ - bcmp.$(oext) \ - memccpy.$(oext) \ - mempcpy.$(oext) \ - strndup.$(oext) \ - strndup_r.$(oext) -endif - -libstring_la_LDFLAGS = -Xcompiler -nostdlib - -if USE_LIBTOOL -noinst_LTLIBRARIES = libstring.la -libstring_la_SOURCES = $(GENERAL_SOURCES) -libstring_la_LIBADD = $(LIB_OBJS) -libstring_la_DEPENDENCIES = $(LIB_OBJS) -noinst_DATA = objectlist.awk.in -else -noinst_LIBRARIES = lib.a -lib_a_SOURCES = $(GENERAL_SOURCES) -lib_a_LIBADD = $(LIB_OBJS) -lib_a_DEPENDENCIES = $(LIB_OBJS) -noinst_DATA = -endif # USE_LIBTOOL - -include $(srcdir)/../../Makefile.shared - -CHEWOUT_FILES=\ -bcmp.def memcpy.def strcmp.def strncat.def strstr.def \ -bcopy.def memmove.def strcoll.def strncmp.def strtok.def \ -bzero.def memset.def strcpy.def strncpy.def strxfrm.def \ -index.def rindex.def strcspn.def strpbrk.def swab.def \ -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 strlwr.def strupr.def memccpy.def \ -mempcpy.def \ -wcscat.def wcschr.def wcscmp.def wcscpy.def wcscspn.def \ -wcslcat.def wcslcpy.def wcslen.def wcsncat.def wcsncmp.def \ -wcsncpy.def wcspbrk.def wcsrchr.def wcsspn.def wcsstr.def \ -wmemchr.def wmemcmp.def wmemcpy.def wmemmove.def wmemset.def - -SUFFIXES = .def - -CHEW = ../../doc/makedoc -f $(srcdir)/../../doc/doc.str - -.c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def - -TARGETDOC = ../tmp.texi - -doc: $(CHEWOUT_FILES) - cat $(srcdir)/strings.tex >> $(TARGETDOC) - cat $(srcdir)/wcstrings.tex >> $(TARGETDOC) - -CLEANFILES = $(CHEWOUT_FILES) *.ref diff --git a/newlib/libc/string/Makefile.in b/newlib/libc/string/Makefile.in deleted file mode 100644 index 14f7b74f0..000000000 --- a/newlib/libc/string/Makefile.in +++ /dev/null @@ -1,507 +0,0 @@ -# Makefile.in generated automatically by automake 1.4 from Makefile.am - -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - - - -SHELL = @SHELL@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include - -DESTDIR = - -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ - -top_builddir = .. - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -transform = @program_transform_name@ - -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_alias = @build_alias@ -build_triplet = @build@ -host_alias = @host_alias@ -host_triplet = @host@ -target_alias = @target_alias@ -target_triplet = @target@ -AR = @AR@ -AS = @AS@ -CC = @CC@ -CPP = @CPP@ -CRT0 = @CRT0@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -DLLTOOL = @DLLTOOL@ -EXEEXT = @EXEEXT@ -GCJ = @GCJ@ -GCJFLAGS = @GCJFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBC_EXTRA_DEF = @LIBC_EXTRA_DEF@ -LIBC_EXTRA_LIB = @LIBC_EXTRA_LIB@ -LIBC_MACHINE_LIB = @LIBC_MACHINE_LIB@ -LIBC_POSIX_LIB = @LIBC_POSIX_LIB@ -LIBC_SIGNAL_DEF = @LIBC_SIGNAL_DEF@ -LIBC_SIGNAL_LIB = @LIBC_SIGNAL_LIB@ -LIBC_STDIO64_DEF = @LIBC_STDIO64_DEF@ -LIBC_STDIO64_LIB = @LIBC_STDIO64_LIB@ -LIBC_SYSCALL_LIB = @LIBC_SYSCALL_LIB@ -LIBC_SYS_LIB = @LIBC_SYS_LIB@ -LIBC_UNIX_LIB = @LIBC_UNIX_LIB@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -NEWLIB_CFLAGS = @NEWLIB_CFLAGS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -RANLIB = @RANLIB@ -STRIP = @STRIP@ -VERSION = @VERSION@ -aext = @aext@ -extra_dir = @extra_dir@ -libm_machine_dir = @libm_machine_dir@ -machine_dir = @machine_dir@ -newlib_basedir = @newlib_basedir@ -oext = @oext@ -sys_dir = @sys_dir@ - -AUTOMAKE_OPTIONS = cygnus - -INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) - -GENERAL_SOURCES = \ - bcopy.c \ - bzero.c \ - index.c \ - memchr.c \ - memcmp.c \ - memcpy.c \ - memmove.c \ - memset.c \ - rindex.c \ - strcasecmp.c \ - strcat.c \ - strchr.c \ - strcmp.c \ - strcoll.c \ - strcpy.c \ - strcspn.c \ - strdup.c \ - strdup_r.c \ - strerror.c \ - strerror_r.c \ - strlcat.c \ - strlcpy.c \ - strlen.c \ - strlwr.c \ - strncasecmp.c \ - strncat.c \ - strncmp.c \ - strncpy.c \ - strnlen.c \ - strpbrk.c \ - strrchr.c \ - strsep.c \ - strspn.c \ - strtok.c \ - strtok_r.c \ - strupr.c \ - strxfrm.c \ - strstr.c \ - swab.c \ - u_strerr.c \ - wcscat.c \ - wcschr.c \ - wcscmp.c \ - wcscpy.c \ - wcscspn.c \ - wcslcat.c \ - wcslcpy.c \ - wcslen.c \ - wcsncat.c \ - wcsncmp.c \ - wcsncpy.c \ - wcspbrk.c \ - wcsrchr.c \ - wcsspn.c \ - wcsstr.c \ - wmemchr.c \ - wmemcmp.c \ - wmemcpy.c \ - wmemmove.c \ - wmemset.c - -@ELIX_LEVEL_1_TRUE@LIB_OBJS = -@ELIX_LEVEL_1_FALSE@LIB_OBJS = @ELIX_LEVEL_1_FALSE@\ -@ELIX_LEVEL_1_FALSE@ bcmp.$(oext) \ -@ELIX_LEVEL_1_FALSE@ memccpy.$(oext) \ -@ELIX_LEVEL_1_FALSE@ mempcpy.$(oext) \ -@ELIX_LEVEL_1_FALSE@ strndup.$(oext) \ -@ELIX_LEVEL_1_FALSE@ strndup_r.$(oext) - -libstring_la_LDFLAGS = -Xcompiler -nostdlib - -@USE_LIBTOOL_TRUE@noinst_LTLIBRARIES = @USE_LIBTOOL_TRUE@libstring.la -@USE_LIBTOOL_TRUE@libstring_la_SOURCES = @USE_LIBTOOL_TRUE@$(GENERAL_SOURCES) -@USE_LIBTOOL_TRUE@libstring_la_LIBADD = @USE_LIBTOOL_TRUE@$(LIB_OBJS) -@USE_LIBTOOL_TRUE@libstring_la_DEPENDENCIES = @USE_LIBTOOL_TRUE@$(LIB_OBJS) -@USE_LIBTOOL_TRUE@noinst_DATA = @USE_LIBTOOL_TRUE@objectlist.awk.in -@USE_LIBTOOL_FALSE@noinst_DATA = -@USE_LIBTOOL_FALSE@noinst_LIBRARIES = @USE_LIBTOOL_FALSE@lib.a -@USE_LIBTOOL_FALSE@lib_a_SOURCES = @USE_LIBTOOL_FALSE@$(GENERAL_SOURCES) -@USE_LIBTOOL_FALSE@lib_a_LIBADD = @USE_LIBTOOL_FALSE@$(LIB_OBJS) -@USE_LIBTOOL_FALSE@lib_a_DEPENDENCIES = @USE_LIBTOOL_FALSE@$(LIB_OBJS) - -CHEWOUT_FILES = \ -bcmp.def memcpy.def strcmp.def strncat.def strstr.def \ -bcopy.def memmove.def strcoll.def strncmp.def strtok.def \ -bzero.def memset.def strcpy.def strncpy.def strxfrm.def \ -index.def rindex.def strcspn.def strpbrk.def swab.def \ -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 strlwr.def strupr.def memccpy.def \ -mempcpy.def \ -wcscat.def wcschr.def wcscmp.def wcscpy.def wcscspn.def \ -wcslcat.def wcslcpy.def wcslen.def wcsncat.def wcsncmp.def \ -wcsncpy.def wcspbrk.def wcsrchr.def wcsspn.def wcsstr.def \ -wmemchr.def wmemcmp.def wmemcpy.def wmemmove.def wmemset.def - - -SUFFIXES = .def - -CHEW = ../../doc/makedoc -f $(srcdir)/../../doc/doc.str - -TARGETDOC = ../tmp.texi - -CLEANFILES = $(CHEWOUT_FILES) *.ref -mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs -CONFIG_CLEAN_FILES = -LIBRARIES = $(noinst_LIBRARIES) - - -DEFS = @DEFS@ -I. -I$(srcdir) -CPPFLAGS = @CPPFLAGS@ -LIBS = @LIBS@ -@USE_LIBTOOL_FALSE@lib_a_OBJECTS = bcopy.$(OBJEXT) bzero.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@index.$(OBJEXT) memchr.$(OBJEXT) memcmp.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@memcpy.$(OBJEXT) memmove.$(OBJEXT) memset.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@rindex.$(OBJEXT) strcasecmp.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@strcat.$(OBJEXT) strchr.$(OBJEXT) strcmp.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@strcoll.$(OBJEXT) strcpy.$(OBJEXT) strcspn.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@strdup.$(OBJEXT) strdup_r.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@strerror.$(OBJEXT) strerror_r.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@strlcat.$(OBJEXT) strlcpy.$(OBJEXT) strlen.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@strlwr.$(OBJEXT) strncasecmp.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@strncat.$(OBJEXT) strncmp.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@strncpy.$(OBJEXT) strnlen.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@strpbrk.$(OBJEXT) strrchr.$(OBJEXT) strsep.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@strspn.$(OBJEXT) strtok.$(OBJEXT) strtok_r.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@strupr.$(OBJEXT) strxfrm.$(OBJEXT) strstr.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@swab.$(OBJEXT) u_strerr.$(OBJEXT) wcscat.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@wcschr.$(OBJEXT) wcscmp.$(OBJEXT) wcscpy.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@wcscspn.$(OBJEXT) wcslcat.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@wcslcpy.$(OBJEXT) wcslen.$(OBJEXT) wcsncat.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@wcsncmp.$(OBJEXT) wcsncpy.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@wcspbrk.$(OBJEXT) wcsrchr.$(OBJEXT) wcsspn.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@wcsstr.$(OBJEXT) wmemchr.$(OBJEXT) wmemcmp.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@wmemcpy.$(OBJEXT) wmemmove.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@wmemset.$(OBJEXT) -LTLIBRARIES = $(noinst_LTLIBRARIES) - -@USE_LIBTOOL_TRUE@libstring_la_OBJECTS = bcopy.lo bzero.lo index.lo \ -@USE_LIBTOOL_TRUE@memchr.lo memcmp.lo memcpy.lo memmove.lo memset.lo \ -@USE_LIBTOOL_TRUE@rindex.lo strcasecmp.lo strcat.lo strchr.lo strcmp.lo \ -@USE_LIBTOOL_TRUE@strcoll.lo strcpy.lo strcspn.lo strdup.lo strdup_r.lo \ -@USE_LIBTOOL_TRUE@strerror.lo strerror_r.lo strlcat.lo strlcpy.lo \ -@USE_LIBTOOL_TRUE@strlen.lo strlwr.lo strncasecmp.lo strncat.lo \ -@USE_LIBTOOL_TRUE@strncmp.lo strncpy.lo strnlen.lo strpbrk.lo \ -@USE_LIBTOOL_TRUE@strrchr.lo strsep.lo strspn.lo strtok.lo strtok_r.lo \ -@USE_LIBTOOL_TRUE@strupr.lo strxfrm.lo strstr.lo swab.lo u_strerr.lo \ -@USE_LIBTOOL_TRUE@wcscat.lo wcschr.lo wcscmp.lo wcscpy.lo wcscspn.lo \ -@USE_LIBTOOL_TRUE@wcslcat.lo wcslcpy.lo wcslen.lo wcsncat.lo wcsncmp.lo \ -@USE_LIBTOOL_TRUE@wcsncpy.lo wcspbrk.lo wcsrchr.lo wcsspn.lo wcsstr.lo \ -@USE_LIBTOOL_TRUE@wmemchr.lo wmemcmp.lo wmemcpy.lo wmemmove.lo \ -@USE_LIBTOOL_TRUE@wmemset.lo -CFLAGS = @CFLAGS@ -COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ -DATA = $(noinst_DATA) - -DIST_COMMON = Makefile.am Makefile.in - - -DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) - -TAR = gtar -GZIP_ENV = --best -SOURCES = $(lib_a_SOURCES) $(libstring_la_SOURCES) -OBJECTS = $(lib_a_OBJECTS) $(libstring_la_OBJECTS) - -all: all-redirect -.SUFFIXES: -.SUFFIXES: .S .c .def .lo .o .obj .s -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(srcdir)/../../Makefile.shared - cd $(top_srcdir) && $(AUTOMAKE) --cygnus string/Makefile - -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status - - -mostlyclean-noinstLIBRARIES: - -clean-noinstLIBRARIES: - -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) - -distclean-noinstLIBRARIES: - -maintainer-clean-noinstLIBRARIES: - -.c.o: - $(COMPILE) -c $< - -# FIXME: We should only use cygpath when building on Windows, -# and only if it is available. -.c.obj: - $(COMPILE) -c `cygpath -w $<` - -.s.o: - $(COMPILE) -c $< - -.S.o: - $(COMPILE) -c $< - -mostlyclean-compile: - -rm -f *.o core *.core - -rm -f *.$(OBJEXT) - -clean-compile: - -distclean-compile: - -rm -f *.tab.c - -maintainer-clean-compile: - -.c.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< - -.s.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< - -.S.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -maintainer-clean-libtool: - -lib.a: $(lib_a_OBJECTS) $(lib_a_DEPENDENCIES) - -rm -f lib.a - $(AR) cru lib.a $(lib_a_OBJECTS) $(lib_a_LIBADD) - $(RANLIB) lib.a - -mostlyclean-noinstLTLIBRARIES: - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - -distclean-noinstLTLIBRARIES: - -maintainer-clean-noinstLTLIBRARIES: - -libstring.la: $(libstring_la_OBJECTS) $(libstring_la_DEPENDENCIES) - $(LINK) $(libstring_la_LDFLAGS) $(libstring_la_OBJECTS) $(libstring_la_LIBADD) $(LIBS) - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - here=`pwd` && cd $(srcdir) \ - && mkid -f$$here/ID $$unique $(LISP) - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ - || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) - -mostlyclean-tags: - -clean-tags: - -distclean-tags: - -rm -f TAGS ID - -maintainer-clean-tags: - -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) - -subdir = string - -distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ - if test -f $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - cp -pr $$d/$$file $(distdir)/$$file; \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done -info-am: -info: info-am -dvi-am: -dvi: dvi-am -check-am: -check: check-am -installcheck-am: -installcheck: installcheck-am -install-info-am: -install-info: install-info-am -install-exec-am: -install-exec: install-exec-am - -install-data-am: -install-data: install-data-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-am -uninstall-am: -uninstall: uninstall-am -all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(DATA) -all-redirect: all-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install -installdirs: - - -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) - -rm -f config.cache config.log stamp-h stamp-h[0-9]* - -maintainer-clean-generic: -mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \ - mostlyclean-libtool mostlyclean-noinstLTLIBRARIES \ - mostlyclean-tags mostlyclean-generic - -mostlyclean: mostlyclean-am - -clean-am: clean-noinstLIBRARIES clean-compile clean-libtool \ - clean-noinstLTLIBRARIES clean-tags clean-generic \ - mostlyclean-am - -clean: clean-am - -distclean-am: distclean-noinstLIBRARIES distclean-compile \ - distclean-libtool distclean-noinstLTLIBRARIES \ - distclean-tags distclean-generic clean-am - -rm -f libtool - -distclean: distclean-am - -maintainer-clean-am: maintainer-clean-noinstLIBRARIES \ - maintainer-clean-compile maintainer-clean-libtool \ - maintainer-clean-noinstLTLIBRARIES \ - maintainer-clean-tags maintainer-clean-generic \ - distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." - -maintainer-clean: maintainer-clean-am - -.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \ -clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \ -mostlyclean-compile distclean-compile clean-compile \ -maintainer-clean-compile mostlyclean-libtool distclean-libtool \ -clean-libtool maintainer-clean-libtool mostlyclean-noinstLTLIBRARIES \ -distclean-noinstLTLIBRARIES clean-noinstLTLIBRARIES \ -maintainer-clean-noinstLTLIBRARIES tags mostlyclean-tags distclean-tags \ -clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \ -check-am installcheck-am installcheck install-info-am install-info \ -install-exec-am install-exec install-data-am install-data install-am \ -install uninstall-am uninstall all-redirect all-am all installdirs \ -mostlyclean-generic distclean-generic clean-generic \ -maintainer-clean-generic clean mostlyclean distclean maintainer-clean - - -objectlist.awk.in: $(noinst_LTLIBRARIES) - -rm -f objectlist.awk.in - for i in `ls *.lo` ; \ - do \ - echo $$i `pwd`/$$i >> objectlist.awk.in ; \ - done - -.c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def - -doc: $(CHEWOUT_FILES) - cat $(srcdir)/strings.tex >> $(TARGETDOC) - cat $(srcdir)/wcstrings.tex >> $(TARGETDOC) - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/newlib/libc/string/bcmp.c b/newlib/libc/string/bcmp.c deleted file mode 100644 index 23e7c26a2..000000000 --- a/newlib/libc/string/bcmp.c +++ /dev/null @@ -1,50 +0,0 @@ -/* -FUNCTION - <<bcmp>>---compare two memory areas - -INDEX - bcmp - -ANSI_SYNOPSIS - #include <string.h> - int bcmp(const void *<[s1]>, const void *<[s2]>, size_t <[n]>); - -TRAD_SYNOPSIS - #include <string.h> - int bcmp(<[s1]>, <[s2]>, <[n]>) - const void *<[s1]>; - const void *<[s2]>; - size_t <[n]>; - -DESCRIPTION - This function compares not more than <[n]> bytes of the - object pointed to by <[s1]> with the object pointed to by <[s2]>. - - This function is identical to <<memcmp>>. - - - -RETURNS - The function returns an integer greater than, equal to or - less than zero according to whether the object pointed to by - <[s1]> is greater than, equal to or less than the object - pointed to by <[s2]>. - -PORTABILITY -<<bcmp>> requires no supporting OS subroutines. - -QUICKREF - bcmp ansi pure -*/ - -#include <string.h> - -int -_DEFUN (bcmp, (m1, m2, n), - _CONST void *m1 _AND - _CONST void *m2 _AND - size_t n) - -{ - return memcmp (m1, m2, n); -} diff --git a/newlib/libc/string/bcopy.c b/newlib/libc/string/bcopy.c deleted file mode 100644 index 505e39dc7..000000000 --- a/newlib/libc/string/bcopy.c +++ /dev/null @@ -1,38 +0,0 @@ -/* -FUNCTION - <<bcopy>>---copy memory regions - -ANSI_SYNOPSIS - #include <string.h> - void bcopy(const void *<[in]>, void *<[out]>, size_t <[n]>); - -TRAD_SYNOPSIS - void bcopy(<[in]>, <[out]>, <[n]> - const void *<[in]>; - void *<[out]>; - size_t <[n]>; - -DESCRIPTION - This function copies <[n]> bytes from the memory region - pointed to by <[in]> to the memory region pointed to by - <[out]>. - - This function is implemented in term of <<memmove>>. - -PORTABILITY -<<bcopy>> requires no supporting OS subroutines. - -QUICKREF - bcopy - pure -*/ - -#include <string.h> - -void -_DEFUN (bcopy, (b1, b2, length), - _CONST void *b1 _AND - void *b2 _AND - size_t length) -{ - memmove (b2, b1, length); -} diff --git a/newlib/libc/string/bzero.c b/newlib/libc/string/bzero.c deleted file mode 100644 index 661285f7b..000000000 --- a/newlib/libc/string/bzero.c +++ /dev/null @@ -1,43 +0,0 @@ -/* -FUNCTION -<<bzero>>---initialize memory to zero - -INDEX - bzero - -ANSI_SYNOPSIS - #include <string.h> - void bzero(void *<[b]>, size_t <[length]>); - -TRAD_SYNOPSIS - #include <string.h> - void bzero(<[b]>, <[length]>) - void *<[b]>; - size_t <[length]>; - -DESCRIPTION -<<bzero>> initializes <[length]> bytes of memory, starting at address -<[b]>, to zero. - -RETURNS -<<bzero>> does not return a result. - -PORTABILITY -<<bzero>> is in the Berkeley Software Distribution. -Neither ANSI C nor the System V Interface Definition (Issue 2) require -<<bzero>>. - -<<bzero>> requires no supporting OS subroutines. -*/ - -#include <string.h> - -_VOID -_DEFUN (bzero, (b, length), - void *b _AND - size_t length) -{ - char *ptr = (char *)b; - while (length--) - *ptr++ = 0; -} diff --git a/newlib/libc/string/index.c b/newlib/libc/string/index.c deleted file mode 100644 index 6c165f952..000000000 --- a/newlib/libc/string/index.c +++ /dev/null @@ -1,44 +0,0 @@ -/* -FUNCTION - <<index>>---search for character in string - -INDEX - index - -ANSI_SYNOPSIS - #include <string.h> - char * index(const char *<[string]>, int <[c]>); - -TRAD_SYNOPSIS - #include <string.h> - char * index(<[string]>, <[c]>); - char *<[string]>; - int *<[c]>; - -DESCRIPTION - This function finds the first occurence of <[c]> (converted to - a char) in the string pointed to by <[string]> (including the - terminating null character). - - This function is identical to <<strchr>>. - -RETURNS - Returns a pointer to the located character, or a null pointer - if <[c]> does not occur in <[string]>. - -PORTABILITY -<<index>> requires no supporting OS subroutines. - -QUICKREF - index - pure -*/ - -#include <string.h> - -char * -_DEFUN (index, (s, c), - _CONST char *s _AND - int c) -{ - return strchr (s, c); -} diff --git a/newlib/libc/string/memccpy.c b/newlib/libc/string/memccpy.c deleted file mode 100644 index f677ac02e..000000000 --- a/newlib/libc/string/memccpy.c +++ /dev/null @@ -1,145 +0,0 @@ -/* -FUNCTION - <<memccpy>>---copy memory regions with end-token check - -ANSI_SYNOPSIS - #include <string.h> - void* memccpy(void *<[out]>, const void *<[in]>, - int <[endchar]>, size_t <[n]>); - -TRAD_SYNOPSIS - void *memccpy(<[out]>, <[in]>, <[endchar]>, <[n]> - void *<[out]>; - void *<[in]>; - int <[endchar]>; - size_t <[n]>; - -DESCRIPTION - This function copies up to <[n]> bytes from the memory region - pointed to by <[in]> to the memory region pointed to by - <[out]>. If a byte matching the <[endchar]> is encountered, - the byte is copied and copying stops. - - If the regions overlap, the behavior is undefined. - -RETURNS - <<memccpy>> returns a pointer to the first byte following the - <[endchar]> in the <[out]> region. If no byte matching - <[endchar]> was copied, then <<NULL>> is returned. - -PORTABILITY -<<memccpy>> is a GNU extension. - -<<memccpy>> requires no supporting OS subroutines. - - */ - -#include <_ansi.h> -#include <stddef.h> -#include <string.h> -#include <limits.h> - -/* Nonzero if either X or Y is not aligned on a "long" boundary. */ -#define UNALIGNED(X, Y) \ - (((long)X & (sizeof (long) - 1)) | ((long)Y & (sizeof (long) - 1))) - -/* How many bytes are copied each iteration of the word copy loop. */ -#define LITTLEBLOCKSIZE (sizeof (long)) - -/* Threshhold for punting to the byte copier. */ -#define TOO_SMALL(LEN) ((LEN) < LITTLEBLOCKSIZE) - -/* Macros for detecting endchar */ -#if LONG_MAX == 2147483647L -#define DETECTNULL(X) (((X) - 0x01010101) & ~(X) & 0x80808080) -#else -#if LONG_MAX == 9223372036854775807L -/* Nonzero if X (a long int) contains a NULL byte. */ -#define DETECTNULL(X) (((X) - 0x0101010101010101) & ~(X) & 0x8080808080808080) -#else -#error long int is not a 32bit or 64bit type. -#endif -#endif - - -_PTR -_DEFUN (memccpy, (dst0, src0, endchar, len0), - _PTR dst0 _AND - _CONST _PTR src0 _AND - int endchar0 _AND - size_t len0) -{ - -#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) - _PTR ptr = NULL; - char *dst = (char *) dst0; - char *src = (char *) src0; - char endchar = endchar0 & 0xff; - - while (len0--) - { - if ((*dst++ = *src++) == endchar) - { - ptr = dst; - break; - } - } - - return ptr; -#else - _PTR ptr = NULL; - char *dst = dst0; - _CONST char *src = src0; - long *aligned_dst; - _CONST long *aligned_src; - int len = len0; - char endchar = endchar0 & 0xff; - - /* If the size is small, or either SRC or DST is unaligned, - then punt into the byte copy loop. This should be rare. */ - if (!TOO_SMALL(len) && !UNALIGNED (src, dst)) - { - int i; - unsigned long mask = 0; - - aligned_dst = (long*)dst; - aligned_src = (long*)src; - - /* The fast code reads the ASCII one word at a time and only - performs the bytewise search on word-sized segments if they - contain the search character, which is detected by XORing - the word-sized segment with a word-sized block of the search - character and then detecting for the presence of NULL in the - result. */ - for (i = 0; i < LITTLEBLOCKSIZE; i++) - mask = (mask << 8) + endchar; - - - /* Copy one long word at a time if possible. */ - while (len >= LITTLEBLOCKSIZE) - { - unsigned long buffer = (unsigned long)(*aligned_src); - buffer ^= mask; - if (DETECTNULL (buffer)) - break; /* endchar is found, go byte by byte from here */ - *aligned_dst++ = *aligned_src++; - len -= LITTLEBLOCKSIZE; - } - - /* Pick up any residual with a byte copier. */ - dst = (char*)aligned_dst; - src = (char*)aligned_src; - } - - while (len--) - { - if ((*dst++ = *src++) == endchar) - { - ptr = dst; - break; - } - } - - return ptr; -#endif /* not PREFER_SIZE_OVER_SPEED */ -} diff --git a/newlib/libc/string/memchr.c b/newlib/libc/string/memchr.c deleted file mode 100644 index 2fd3c861d..000000000 --- a/newlib/libc/string/memchr.c +++ /dev/null @@ -1,143 +0,0 @@ -/* -FUNCTION - <<memchr>>---find character in memory - -INDEX - memchr - -ANSI_SYNOPSIS - #include <string.h> - void *memchr(const void *<[src]>, int <[c]>, size_t <[length]>); - -TRAD_SYNOPSIS - #include <string.h> - void *memchr(<[src]>, <[c]>, <[length]>) - void *<[src]>; - void *<[c]>; - size_t <[length]>; - -DESCRIPTION - This function searches memory starting at <<*<[src]>>> for the - character <[c]>. The search only ends with the first - occurrence of <[c]>, or after <[length]> characters; in - particular, <<NULL>> does not terminate the search. - -RETURNS - If the character <[c]> is found within <[length]> characters - of <<*<[src]>>>, a pointer to the character is returned. If - <[c]> is not found, then <<NULL>> is returned. - -PORTABILITY -<<memchr>>> is ANSI C. - -<<memchr>> requires no supporting OS subroutines. - -QUICKREF - memchr ansi pure -*/ - -#include <_ansi.h> -#include <string.h> -#include <limits.h> - -/* Nonzero if either X or Y is not aligned on a "long" boundary. */ -#define UNALIGNED(X) ((long)X & (sizeof (long) - 1)) - -/* How many bytes are loaded each iteration of the word copy loop. */ -#define LBLOCKSIZE (sizeof (long)) - -/* Threshhold for punting to the bytewise iterator. */ -#define TOO_SMALL(LEN) ((LEN) < LBLOCKSIZE) - -#if LONG_MAX == 2147483647L -#define DETECTNULL(X) (((X) - 0x01010101) & ~(X) & 0x80808080) -#else -#if LONG_MAX == 9223372036854775807L -/* Nonzero if X (a long int) contains a NULL byte. */ -#define DETECTNULL(X) (((X) - 0x0101010101010101) & ~(X) & 0x8080808080808080) -#else -#error long int is not a 32bit or 64bit type. -#endif -#endif - -#ifndef DETECTNULL -#error long int is not a 32bit or 64bit byte -#endif - - -_PTR -_DEFUN (memchr, (src_void, c, length), - _CONST _PTR src_void _AND - int c _AND - size_t length) -{ -#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) - _CONST unsigned char *src = (_CONST unsigned char *) src_void; - - c &= 0xff; - - while (length--) - { - if (*src == c) - return (char *) src; - src++; - } - return NULL; -#else - _CONST unsigned char *src = (_CONST unsigned char *) src_void; - unsigned long *asrc; - unsigned long buffer; - unsigned long mask; - int i, j; - - c &= 0xff; - - /* If the size is small, or src is unaligned, then - use the bytewise loop. We can hope this is rare. */ - if (!TOO_SMALL (length) && !UNALIGNED (src)) - { - /* The fast code reads the ASCII one word at a time and only - performs the bytewise search on word-sized segments if they - contain the search character, which is detected by XORing - the word-sized segment with a word-sized block of the search - character and then detecting for the presence of NULL in the - result. */ - asrc = (unsigned long*) src; - mask = 0; - for (i = 0; i < LBLOCKSIZE; i++) - mask = (mask << 8) + c; - - while (length >= LBLOCKSIZE) - { - buffer = *asrc; - buffer ^= mask; - if (DETECTNULL (buffer)) - { - src = (unsigned char*) asrc; - for ( j = 0; j < LBLOCKSIZE; j++ ) - { - if (*src == c) - return (char*) src; - src++; - } - } - length -= LBLOCKSIZE; - asrc++; - } - - /* If there are fewer than LBLOCKSIZE characters left, - then we resort to the bytewise loop. */ - - src = (unsigned char*) asrc; - } - - while (length--) - { - if (*src == c) - return (char*) src; - src++; - } - - return NULL; -#endif /* not PREFER_SIZE_OVER_SPEED */ -} diff --git a/newlib/libc/string/memcmp.c b/newlib/libc/string/memcmp.c deleted file mode 100644 index ac7a194a6..000000000 --- a/newlib/libc/string/memcmp.c +++ /dev/null @@ -1,113 +0,0 @@ -/* -FUNCTION - <<memcmp>>---compare two memory areas - -INDEX - memcmp - -ANSI_SYNOPSIS - #include <string.h> - int memcmp(const void *<[s1]>, const void *<[s2]>, size_t <[n]>); - -TRAD_SYNOPSIS - #include <string.h> - int memcmp(<[s1]>, <[s2]>, <[n]>) - void *<[s1]>; - void *<[s2]>; - size_t <[n]>; - -DESCRIPTION - This function compares not more than <[n]> characters of the - object pointed to by <[s1]> with the object pointed to by <[s2]>. - - -RETURNS - The function returns an integer greater than, equal to or - less than zero according to whether the object pointed to by - <[s1]> is greater than, equal to or less than the object - pointed to by <[s2]>. - -PORTABILITY -<<memcmp>> is ANSI C. - -<<memcmp>> requires no supporting OS subroutines. - -QUICKREF - memcmp ansi pure -*/ - -#include <string.h> - - -/* Nonzero if either X or Y is not aligned on a "long" boundary. */ -#define UNALIGNED(X, Y) \ - (((long)X & (sizeof (long) - 1)) | ((long)Y & (sizeof (long) - 1))) - -/* How many bytes are copied each iteration of the word copy loop. */ -#define LBLOCKSIZE (sizeof (long)) - -/* Threshhold for punting to the byte copier. */ -#define TOO_SMALL(LEN) ((LEN) < LBLOCKSIZE) - -int -_DEFUN (memcmp, (m1, m2, n), - _CONST _PTR m1 _AND - _CONST _PTR m2 _AND - size_t n) -{ -#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) - unsigned char *s1 = (unsigned char *) m1; - unsigned char *s2 = (unsigned char *) m2; - - while (n--) - { - if (*s1 != *s2) - { - return *s1 - *s2; - } - s1++; - s2++; - } - return 0; -#else - unsigned char *s1 = (unsigned char *) m1; - unsigned char *s2 = (unsigned char *) m2; - unsigned long *a1; - unsigned long *a2; - - /* If the size is too small, or either pointer is unaligned, - then we punt to the byte compare loop. Hopefully this will - not turn up in inner loops. */ - if (!TOO_SMALL(n) && !UNALIGNED(s1,s2)) - { - /* Otherwise, load and compare the blocks of memory one - word at a time. */ - a1 = (unsigned long*) s1; - a2 = (unsigned long*) s2; - while (n >= LBLOCKSIZE) - { - if (*a1 != *a2) - break; - a1++; - a2++; - n -= LBLOCKSIZE; - } - - /* check m mod LBLOCKSIZE remaining characters */ - - s1 = (char*)a1; - s2 = (char*)a2; - } - - while (n--) - { - if (*s1 != *s2) - return *s1 - *s2; - s1++; - s2++; - } - - return 0; -#endif /* not PREFER_SIZE_OVER_SPEED */ -} - diff --git a/newlib/libc/string/memcpy.c b/newlib/libc/string/memcpy.c deleted file mode 100644 index 5336f25a9..000000000 --- a/newlib/libc/string/memcpy.c +++ /dev/null @@ -1,111 +0,0 @@ -/* -FUNCTION - <<memcpy>>---copy memory regions - -ANSI_SYNOPSIS - #include <string.h> - void* memcpy(void *<[out]>, const void *<[in]>, size_t <[n]>); - -TRAD_SYNOPSIS - void *memcpy(<[out]>, <[in]>, <[n]> - void *<[out]>; - void *<[in]>; - size_t <[n]>; - -DESCRIPTION - This function copies <[n]> bytes from the memory region - pointed to by <[in]> to the memory region pointed to by - <[out]>. - - If the regions overlap, the behavior is undefined. - -RETURNS - <<memcpy>> returns a pointer to the first byte of the <[out]> - region. - -PORTABILITY -<<memcpy>> is ANSI C. - -<<memcpy>> requires no supporting OS subroutines. - -QUICKREF - memcpy ansi pure - */ - -#include <_ansi.h> -#include <stddef.h> -#include <limits.h> - -/* Nonzero if either X or Y is not aligned on a "long" boundary. */ -#define UNALIGNED(X, Y) \ - (((long)X & (sizeof (long) - 1)) | ((long)Y & (sizeof (long) - 1))) - -/* How many bytes are copied each iteration of the 4X unrolled loop. */ -#define BIGBLOCKSIZE (sizeof (long) << 2) - -/* How many bytes are copied each iteration of the word copy loop. */ -#define LITTLEBLOCKSIZE (sizeof (long)) - -/* Threshhold for punting to the byte copier. */ -#define TOO_SMALL(LEN) ((LEN) < BIGBLOCKSIZE) - -_PTR -_DEFUN (memcpy, (dst0, src0, len0), - _PTR dst0 _AND - _CONST _PTR src0 _AND - size_t len0) -{ -#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) - char *dst = (char *) dst0; - char *src = (char *) src0; - - _PTR save = dst0; - - while (len0--) - { - *dst++ = *src++; - } - - return save; -#else - char *dst = dst0; - _CONST char *src = src0; - long *aligned_dst; - _CONST long *aligned_src; - int len = len0; - - /* If the size is small, or either SRC or DST is unaligned, - then punt into the byte copy loop. This should be rare. */ - if (!TOO_SMALL(len) && !UNALIGNED (src, dst)) - { - aligned_dst = (long*)dst; - aligned_src = (long*)src; - - /* Copy 4X long words at a time if possible. */ - while (len >= BIGBLOCKSIZE) - { - *aligned_dst++ = *aligned_src++; - *aligned_dst++ = *aligned_src++; - *aligned_dst++ = *aligned_src++; - *aligned_dst++ = *aligned_src++; - len -= BIGBLOCKSIZE; - } - - /* Copy one long word at a time if possible. */ - while (len >= LITTLEBLOCKSIZE) - { - *aligned_dst++ = *aligned_src++; - len -= LITTLEBLOCKSIZE; - } - - /* Pick up any residual with a byte copier. */ - dst = (char*)aligned_dst; - src = (char*)aligned_src; - } - - while (len--) - *dst++ = *src++; - - return dst0; -#endif /* not PREFER_SIZE_OVER_SPEED */ -} diff --git a/newlib/libc/string/memmove.c b/newlib/libc/string/memmove.c deleted file mode 100644 index 2528e27d4..000000000 --- a/newlib/libc/string/memmove.c +++ /dev/null @@ -1,143 +0,0 @@ -/* -FUNCTION - <<memmove>>---move possibly overlapping memory - -INDEX - memmove - -ANSI_SYNOPSIS - #include <string.h> - void *memmove(void *<[dst]>, const void *<[src]>, size_t <[length]>); - -TRAD_SYNOPSIS - #include <string.h> - void *memmove(<[dst]>, <[src]>, <[length]>) - void *<[dst]>; - void *<[src]>; - size_t <[length]>; - -DESCRIPTION - This function moves <[length]> characters from the block of - memory starting at <<*<[src]>>> to the memory starting at - <<*<[dst]>>>. <<memmove>> reproduces the characters correctly - at <<*<[dst]>>> even if the two areas overlap. - - -RETURNS - The function returns <[dst]> as passed. - -PORTABILITY -<<memmove>> is ANSI C. - -<<memmove>> requires no supporting OS subroutines. - -QUICKREF - memmove ansi pure -*/ - -#include <string.h> -#include <_ansi.h> -#include <stddef.h> -#include <limits.h> - -/* Nonzero if either X or Y is not aligned on a "long" boundary. */ -#define UNALIGNED(X, Y) \ - (((long)X & (sizeof (long) - 1)) | ((long)Y & (sizeof (long) - 1))) - -/* How many bytes are copied each iteration of the 4X unrolled loop. */ -#define BIGBLOCKSIZE (sizeof (long) << 2) - -/* How many bytes are copied each iteration of the word copy loop. */ -#define LITTLEBLOCKSIZE (sizeof (long)) - -/* Threshhold for punting to the byte copier. */ -#define TOO_SMALL(LEN) ((LEN) < BIGBLOCKSIZE) - -/*SUPPRESS 20*/ -_PTR -_DEFUN (memmove, (dst_void, src_void, length), - _PTR dst_void _AND - _CONST _PTR src_void _AND - size_t length) -{ -#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) - char *dst = dst_void; - _CONST char *src = src_void; - - if (src < dst && dst < src + length) - { - /* Have to copy backwards */ - src += length; - dst += length; - while (length--) - { - *--dst = *--src; - } - } - else - { - while (length--) - { - *dst++ = *src++; - } - } - - return dst_void; -#else - char *dst = dst_void; - _CONST char *src = src_void; - long *aligned_dst; - _CONST long *aligned_src; - int len = length; - - if (src < dst && dst < src + len) - { - /* Destructive overlap...have to copy backwards */ - src += len; - dst += len; - while (len--) - { - *--dst = *--src; - } - } - else - { - /* Use optimizing algorithm for a non-destructive copy to closely - match memcpy. If the size is small or either SRC or DST is unaligned, - then punt into the byte copy loop. This should be rare. */ - if (!TOO_SMALL(len) && !UNALIGNED (src, dst)) - { - aligned_dst = (long*)dst; - aligned_src = (long*)src; - - /* Copy 4X long words at a time if possible. */ - while (len >= BIGBLOCKSIZE) - { - *aligned_dst++ = *aligned_src++; - *aligned_dst++ = *aligned_src++; - *aligned_dst++ = *aligned_src++; - *aligned_dst++ = *aligned_src++; - len -= BIGBLOCKSIZE; - } - - /* Copy one long word at a time if possible. */ - while (len >= LITTLEBLOCKSIZE) - { - *aligned_dst++ = *aligned_src++; - len -= LITTLEBLOCKSIZE; - } - - /* Pick up any residual with a byte copier. */ - dst = (char*)aligned_dst; - src = (char*)aligned_src; - } - - while (len--) - { - *dst++ = *src++; - } - } - - return dst_void; -#endif /* not PREFER_SIZE_OVER_SPEED */ -} diff --git a/newlib/libc/string/mempcpy.c b/newlib/libc/string/mempcpy.c deleted file mode 100644 index 284cbea79..000000000 --- a/newlib/libc/string/mempcpy.c +++ /dev/null @@ -1,108 +0,0 @@ -/* -FUNCTION - <<mempcpy>>---copy memory regions and return end pointer - -ANSI_SYNOPSIS - #include <string.h> - void* mempcpy(void *<[out]>, const void *<[in]>, size_t <[n]>); - -TRAD_SYNOPSIS - void *mempcpy(<[out]>, <[in]>, <[n]> - void *<[out]>; - void *<[in]>; - size_t <[n]>; - -DESCRIPTION - This function copies <[n]> bytes from the memory region - pointed to by <[in]> to the memory region pointed to by - <[out]>. - - If the regions overlap, the behavior is undefined. - -RETURNS - <<mempcpy>> returns a pointer to the byte following the - last byte copied to the <[out]> region. - -PORTABILITY -<<mempcpy>> is a GNU extension. - -<<mempcpy>> requires no supporting OS subroutines. - - */ - -#include <_ansi.h> -#include <stddef.h> -#include <limits.h> -#include <string.h> - -/* Nonzero if either X or Y is not aligned on a "long" boundary. */ -#define UNALIGNED(X, Y) \ - (((long)X & (sizeof (long) - 1)) | ((long)Y & (sizeof (long) - 1))) - -/* How many bytes are copied each iteration of the 4X unrolled loop. */ -#define BIGBLOCKSIZE (sizeof (long) << 2) - -/* How many bytes are copied each iteration of the word copy loop. */ -#define LITTLEBLOCKSIZE (sizeof (long)) - -/* Threshhold for punting to the byte copier. */ -#define TOO_SMALL(LEN) ((LEN) < BIGBLOCKSIZE) - -_PTR -_DEFUN (mempcpy, (dst0, src0, len0), - _PTR dst0 _AND - _CONST _PTR src0 _AND - size_t len0) -{ -#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) - char *dst = (char *) dst0; - char *src = (char *) src0; - - while (len0--) - { - *dst++ = *src++; - } - - return dst; -#else - char *dst = dst0; - _CONST char *src = src0; - long *aligned_dst; - _CONST long *aligned_src; - int len = len0; - - /* If the size is small, or either SRC or DST is unaligned, - then punt into the byte copy loop. This should be rare. */ - if (!TOO_SMALL(len) && !UNALIGNED (src, dst)) - { - aligned_dst = (long*)dst; - aligned_src = (long*)src; - - /* Copy 4X long words at a time if possible. */ - while (len >= BIGBLOCKSIZE) - { - *aligned_dst++ = *aligned_src++; - *aligned_dst++ = *aligned_src++; - *aligned_dst++ = *aligned_src++; - *aligned_dst++ = *aligned_src++; - len -= BIGBLOCKSIZE; - } - - /* Copy one long word at a time if possible. */ - while (len >= LITTLEBLOCKSIZE) - { - *aligned_dst++ = *aligned_src++; - len -= LITTLEBLOCKSIZE; - } - - /* Pick up any residual with a byte copier. */ - dst = (char*)aligned_dst; - src = (char*)aligned_src; - } - - while (len--) - *dst++ = *src++; - - return dst; -#endif /* not PREFER_SIZE_OVER_SPEED */ -} diff --git a/newlib/libc/string/memset.c b/newlib/libc/string/memset.c deleted file mode 100644 index a5890c884..000000000 --- a/newlib/libc/string/memset.c +++ /dev/null @@ -1,109 +0,0 @@ -/* -FUNCTION - <<memset>>---set an area of memory - -INDEX - memset - -ANSI_SYNOPSIS - #include <string.h> - void *memset(const void *<[dst]>, int <[c]>, size_t <[length]>); - -TRAD_SYNOPSIS - #include <string.h> - void *memset(<[dst]>, <[c]>, <[length]>) - void *<[dst]>; - int <[c]>; - size_t <[length]>; - -DESCRIPTION - This function converts the argument <[c]> into an unsigned - char and fills the first <[length]> characters of the array - pointed to by <[dst]> to the value. - -RETURNS - <<memset>> returns the value of <[m]>. - -PORTABILITY -<<memset>> is ANSI C. - - <<memset>> requires no supporting OS subroutines. - -QUICKREF - memset ansi pure -*/ - -#include <string.h> - -#define LBLOCKSIZE (sizeof(long)) -#define UNALIGNED(X) ((long)X & (LBLOCKSIZE - 1)) -#define TOO_SMALL(LEN) ((LEN) < LBLOCKSIZE) - -_PTR -_DEFUN (memset, (m, c, n), - _PTR m _AND - int c _AND - size_t n) -{ -#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) - char *s = (char *) m; - - while (n-- != 0) - { - *s++ = (char) c; - } - - return m; -#else - char *s = (char *) m; - int i; - unsigned long buffer; - unsigned long *aligned_addr; - - if (!TOO_SMALL (n) && !UNALIGNED (m)) - { - /* If we get this far, we know that n is large and m is word-aligned. */ - - aligned_addr = (unsigned long*)m; - - /* Store C into each char sized location in BUFFER so that - we can set large blocks quickly. */ - c &= 0xff; - if (LBLOCKSIZE == 4) - { - buffer = (c << 8) | c; - buffer |= (buffer << 16); - } - else - { - buffer = 0; - for (i = 0; i < LBLOCKSIZE; i++) - buffer = (buffer << 8) | c; - } - - while (n >= LBLOCKSIZE*4) - { - *aligned_addr++ = buffer; - *aligned_addr++ = buffer; - *aligned_addr++ = buffer; - *aligned_addr++ = buffer; - n -= 4*LBLOCKSIZE; - } - - while (n >= LBLOCKSIZE) - { - *aligned_addr++ = buffer; - n -= LBLOCKSIZE; - } - /* Pick up the remainder with a bytewise loop. */ - s = (char*)aligned_addr; - } - - while (n--) - { - *s++ = (char)c; - } - - return m; -#endif /* not PREFER_SIZE_OVER_SPEED */ -} diff --git a/newlib/libc/string/rindex.c b/newlib/libc/string/rindex.c deleted file mode 100644 index 3c6dff909..000000000 --- a/newlib/libc/string/rindex.c +++ /dev/null @@ -1,44 +0,0 @@ -/* -FUNCTION - <<rindex>>---reverse search for character in string - -INDEX - rindex - -ANSI_SYNOPSIS - #include <string.h> - char * rindex(const char *<[string]>, int <[c]>); - -TRAD_SYNOPSIS - #include <string.h> - char * rindex(<[string]>, <[c]>); - char *<[string]>; - int *<[c]>; - -DESCRIPTION - This function finds the last occurence of <[c]> (converted to - a char) in the string pointed to by <[string]> (including the - terminating null character). - - This function is identical to <<strrchr>>. - -RETURNS - Returns a pointer to the located character, or a null pointer - if <[c]> does not occur in <[string]>. - -PORTABILITY -<<rindex>> requires no supporting OS subroutines. - -QUICKREF - rindex - pure -*/ - -#include <string.h> - -char * -_DEFUN (rindex, (s, c), - _CONST char *s _AND - int c) -{ - return strrchr (s, c); -} diff --git a/newlib/libc/string/strcasecmp.c b/newlib/libc/string/strcasecmp.c deleted file mode 100644 index 4dcfc784a..000000000 --- a/newlib/libc/string/strcasecmp.c +++ /dev/null @@ -1,56 +0,0 @@ -/* -FUNCTION - <<strcasecmp>>---case insensitive character string compare - -INDEX - strcasecmp - -ANSI_SYNOPSIS - #include <string.h> - int strcasecmp(const char *<[a]>, const char *<[b]>); - -TRAD_SYNOPSIS - #include <string.h> - int strcasecmp(<[a]>, <[b]>) - char *<[a]>; - char *<[b]>; - -DESCRIPTION - <<strcasecmp>> compares 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 upper case), <<strcasecmp>> returns a - number greater than zero. If the two strings match, - <<strcasecmp>> returns zero. If <<*<[a]>>> sorts - lexicographically before <<*<[b]>>>, <<strcasecmp>> returns a - number less than zero. - -PORTABILITY -<<strcasecmp>> is in the Berkeley Software Distribution. - -<<strcasecmp>> requires no supporting OS subroutines. It uses -tolower() from elsewhere in this library. - -QUICKREF - strcasecmp -*/ - -#include <string.h> -#include <ctype.h> - -int -_DEFUN (strcasecmp, (s1, s2), - _CONST char *s1 _AND - _CONST char *s2) -{ - while (*s1 != '\0' && tolower(*s1) == tolower(*s2)) - { - s1++; - s2++; - } - - return tolower(*(unsigned char *) s1) - tolower(*(unsigned char *) s2); -} diff --git a/newlib/libc/string/strcat.c b/newlib/libc/string/strcat.c deleted file mode 100644 index 411eadb85..000000000 --- a/newlib/libc/string/strcat.c +++ /dev/null @@ -1,104 +0,0 @@ -/* -FUNCTION - <<strcat>>---concatenate strings - -INDEX - strcat - -ANSI_SYNOPSIS - #include <string.h> - char *strcat(char *<[dst]>, const char *<[src]>); - -TRAD_SYNOPSIS - #include <string.h> - char *strcat(<[dst]>, <[src]>) - char *<[dst]>; - char *<[src]>; - -DESCRIPTION - <<strcat>> appends a copy of the string pointed to by <[src]> - (including the terminating null character) to the end of the - string pointed to by <[dst]>. The initial character of - <[src]> overwrites the null character at the end of <[dst]>. - -RETURNS - This function returns the initial value of <[dst]> - -PORTABILITY -<<strcat>> is ANSI C. - -<<strcat>> requires no supporting OS subroutines. - -QUICKREF - strcat ansi pure -*/ - -#include <string.h> -#include <limits.h> - -/* Nonzero if X is aligned on a "long" boundary. */ -#define ALIGNED(X) \ - (((long)X & (sizeof (long) - 1)) == 0) - -#if LONG_MAX == 2147483647L -#define DETECTNULL(X) (((X) - 0x01010101) & ~(X) & 0x80808080) -#else -#if LONG_MAX == 9223372036854775807L -/* Nonzero if X (a long int) contains a NULL byte. */ -#define DETECTNULL(X) (((X) - 0x0101010101010101) & ~(X) & 0x8080808080808080) -#else -#error long int is not a 32bit or 64bit type. -#endif -#endif - -#ifndef DETECTNULL -#error long int is not a 32bit or 64bit byte -#endif - - -/*SUPPRESS 560*/ -/*SUPPRESS 530*/ - -char * -_DEFUN (strcat, (s1, s2), - char *s1 _AND - _CONST char *s2) -{ -#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) - char *s = s1; - - while (*s1) - s1++; - - while (*s1++ = *s2++) - ; - return s; -#else - char *s = s1; - - - /* Skip over the data in s1 as quickly as possible. */ - if (ALIGNED (s1)) - { - unsigned long *aligned_s1 = (unsigned long *)s1; - while (!DETECTNULL (*aligned_s1)) - aligned_s1++; - - s1 = (char *)aligned_s1; - } - - while (*s1) - s1++; - - /* s1 now points to the its trailing null character, we can - just use strcpy to do the work for us now. - - ?!? We might want to just include strcpy here. - Also, this will cause many more unaligned string copies because - s1 is much less likely to be aligned. I don't know if its worth - tweaking strcpy to handle this better. */ - strcpy (s1, s2); - - return s; -#endif /* not PREFER_SIZE_OVER_SPEED */ -} diff --git a/newlib/libc/string/strchr.c b/newlib/libc/string/strchr.c deleted file mode 100644 index 60b0fde8e..000000000 --- a/newlib/libc/string/strchr.c +++ /dev/null @@ -1,108 +0,0 @@ -/* -FUNCTION - <<strchr>>---search for character in string - -INDEX - strchr - -ANSI_SYNOPSIS - #include <string.h> - char * strchr(const char *<[string]>, int <[c]>); - -TRAD_SYNOPSIS - #include <string.h> - char * strchr(<[string]>, <[c]>); - const char *<[string]>; - int <[c]>; - -DESCRIPTION - This function finds the first occurence of <[c]> (converted to - a char) in the string pointed to by <[string]> (including the - terminating null character). - -RETURNS - Returns a pointer to the located character, or a null pointer - if <[c]> does not occur in <[string]>. - -PORTABILITY -<<strchr>> is ANSI C. - -<<strchr>> requires no supporting OS subroutines. - -QUICKREF - strchr ansi pure -*/ - -#include <string.h> -#include <limits.h> - -/* Nonzero if X is not aligned on a "long" boundary. */ -#define UNALIGNED(X) ((long)X & (sizeof (long) - 1)) - -/* How many bytes are loaded each iteration of the word copy loop. */ -#define LBLOCKSIZE (sizeof (long)) - -#if LONG_MAX == 2147483647L -#define DETECTNULL(X) (((X) - 0x01010101) & ~(X) & 0x80808080) -#else -#if LONG_MAX == 9223372036854775807L -/* Nonzero if X (a long int) contains a NULL byte. */ -#define DETECTNULL(X) (((X) - 0x0101010101010101) & ~(X) & 0x8080808080808080) -#else -#error long int is not a 32bit or 64bit type. -#endif -#endif - -/* DETECTCHAR returns nonzero if (long)X contains the byte used - to fill (long)MASK. */ -#define DETECTCHAR(X,MASK) (DETECTNULL(X ^ MASK)) - -char * -_DEFUN (strchr, (s1, i), - _CONST char *s1 _AND - int i) -{ - _CONST unsigned char *s = (_CONST unsigned char *)s1; -#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) - unsigned char c = (unsigned int)i; - - while (*s && *s != c) - { - s++; - } - - if (*s != c) - { - s = NULL; - } - - return (char *) s; -#else - unsigned char c = (unsigned char)i; - unsigned long mask,j; - unsigned long *aligned_addr; - - if (!UNALIGNED (s)) - { - mask = 0; - for (j = 0; j < LBLOCKSIZE; j++) - mask = (mask << 8) | c; - - aligned_addr = (unsigned long*)s; - while (!DETECTNULL (*aligned_addr) && !DETECTCHAR (*aligned_addr, mask)) - aligned_addr++; - - /* The block of bytes currently pointed to by aligned_addr - contains either a null or the target char, or both. We - catch it using the bytewise search. */ - - s = (unsigned char*)aligned_addr; - } - - while (*s && *s != c) - s++; - if (*s == c) - return (char *)s; - return NULL; -#endif /* not PREFER_SIZE_OVER_SPEED */ -} diff --git a/newlib/libc/string/strcmp.c b/newlib/libc/string/strcmp.c deleted file mode 100644 index 81d65272e..000000000 --- a/newlib/libc/string/strcmp.c +++ /dev/null @@ -1,106 +0,0 @@ -/* -FUNCTION - <<strcmp>>---character string compare - -INDEX - strcmp - -ANSI_SYNOPSIS - #include <string.h> - int strcmp(const char *<[a]>, const char *<[b]>); - -TRAD_SYNOPSIS - #include <string.h> - int strcmp(<[a]>, <[b]>) - char *<[a]>; - char *<[b]>; - -DESCRIPTION - <<strcmp>> compares the string at <[a]> to - the string at <[b]>. - -RETURNS - If <<*<[a]>>> sorts lexicographically after <<*<[b]>>>, - <<strcmp>> returns a number greater than zero. If the two - strings match, <<strcmp>> returns zero. If <<*<[a]>>> - sorts lexicographically before <<*<[b]>>>, <<strcmp>> returns a - number less than zero. - -PORTABILITY -<<strcmp>> is ANSI C. - -<<strcmp>> requires no supporting OS subroutines. - -QUICKREF - strcmp ansi pure -*/ - -#include <string.h> -#include <limits.h> - -/* Nonzero if either X or Y is not aligned on a "long" boundary. */ -#define UNALIGNED(X, Y) \ - (((long)X & (sizeof (long) - 1)) | ((long)Y & (sizeof (long) - 1))) - -/* DETECTNULL returns nonzero if (long)X contains a NULL byte. */ -#if LONG_MAX == 2147483647L -#define DETECTNULL(X) (((X) - 0x01010101) & ~(X) & 0x80808080) -#else -#if LONG_MAX == 9223372036854775807L -#define DETECTNULL(X) (((X) - 0x0101010101010101) & ~(X) & 0x8080808080808080) -#else -#error long int is not a 32bit or 64bit type. -#endif -#endif - -#ifndef DETECTNULL -#error long int is not a 32bit or 64bit byte -#endif - -int -_DEFUN (strcmp, (s1, s2), - _CONST char *s1 _AND - _CONST char *s2) -{ -#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) - while (*s1 != '\0' && *s1 == *s2) - { - s1++; - s2++; - } - - return (*(unsigned char *) s1) - (*(unsigned char *) s2); -#else - unsigned long *a1; - unsigned long *a2; - - /* If s1 or s2 are unaligned, then compare bytes. */ - if (!UNALIGNED (s1, s2)) - { - /* If s1 and s2 are word-aligned, compare them a word at a time. */ - a1 = (unsigned long*)s1; - a2 = (unsigned long*)s2; - while (*a1 == *a2) - { - /* To get here, *a1 == *a2, thus if we find a null in *a1, - then the strings must be equal, so return zero. */ - if (DETECTNULL (*a1)) - return 0; - - a1++; - a2++; - } - - /* A difference was detected in last few bytes of s1, so search bytewise */ - s1 = (char*)a1; - s2 = (char*)a2; - } - - while (*s1 != '\0' && *s1 == *s2) - { - s1++; - s2++; - } - return (*(unsigned char *) s1) - (*(unsigned char *) s2); -#endif /* not PREFER_SIZE_OVER_SPEED */ -} diff --git a/newlib/libc/string/strcoll.c b/newlib/libc/string/strcoll.c deleted file mode 100644 index 8760b2217..000000000 --- a/newlib/libc/string/strcoll.c +++ /dev/null @@ -1,48 +0,0 @@ -/* -FUNCTION - <<strcoll>>---locale specific character string compare - -INDEX - strcoll - -ANSI_SYNOPSIS - #include <string.h> - int strcoll(const char *<[stra]>, const char * <[strb]>); - -TRAD_SYNOPSIS - #include <string.h> - int strcoll(<[stra]>, <[strb]>) - char *<[stra]>; - char *<[strb]>; - -DESCRIPTION - <<strcoll>> compares the string pointed to by <[stra]> to - the string pointed to by <[strb]>, using an interpretation - appropriate to the current <<LC_COLLATE>> state. - -RETURNS - If the first string is greater than the second string, - <<strcoll>> returns a number greater than zero. If the two - strings are equivalent, <<strcoll>> returns zero. If the first - string is less than the second string, <<strcoll>> returns a - number less than zero. - -PORTABILITY -<<strcoll>> is ANSI C. - -<<strcoll>> requires no supporting OS subroutines. - -QUICKREF - strcoll ansi pure -*/ - -#include <string.h> - -int -_DEFUN (strcoll, (a, b), - _CONST char *a _AND - _CONST char *b) - -{ - return strcmp (a, b); -} diff --git a/newlib/libc/string/strcpy.c b/newlib/libc/string/strcpy.c deleted file mode 100644 index 905b2541c..000000000 --- a/newlib/libc/string/strcpy.c +++ /dev/null @@ -1,99 +0,0 @@ -/* -FUNCTION - <<strcpy>>---copy string - -INDEX - strcpy - -ANSI_SYNOPSIS - #include <string.h> - char *strcpy(char *<[dst]>, const char *<[src]>); - -TRAD_SYNOPSIS - #include <string.h> - char *strcpy(<[dst]>, <[src]>) - char *<[dst]>; - char *<[src]>; - -DESCRIPTION - <<strcpy>> copies the string pointed to by <[src]> - (including the terminating null character) to the array - pointed to by <[dst]>. - -RETURNS - This function returns the initial value of <[dst]>. - -PORTABILITY -<<strcpy>> is ANSI C. - -<<strcpy>> requires no supporting OS subroutines. - -QUICKREF - strcpy ansi pure -*/ - -#include <string.h> -#include <limits.h> - -/*SUPPRESS 560*/ -/*SUPPRESS 530*/ - -/* Nonzero if either X or Y is not aligned on a "long" boundary. */ -#define UNALIGNED(X, Y) \ - (((long)X & (sizeof (long) - 1)) | ((long)Y & (sizeof (long) - 1))) - -#if LONG_MAX == 2147483647L -#define DETECTNULL(X) (((X) - 0x01010101) & ~(X) & 0x80808080) -#else -#if LONG_MAX == 9223372036854775807L -/* Nonzero if X (a long int) contains a NULL byte. */ -#define DETECTNULL(X) (((X) - 0x0101010101010101) & ~(X) & 0x8080808080808080) -#else -#error long int is not a 32bit or 64bit type. -#endif -#endif - -#ifndef DETECTNULL -#error long int is not a 32bit or 64bit byte -#endif - -char* -_DEFUN (strcpy, (dst0, src0), - char *dst0 _AND - _CONST char *src0) -{ -#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) - char *s = dst0; - - while (*dst0++ = *src0++) - ; - - return s; -#else - char *dst = dst0; - _CONST char *src = src0; - long *aligned_dst; - _CONST long *aligned_src; - - /* If SRC or DEST is unaligned, then copy bytes. */ - if (!UNALIGNED (src, dst)) - { - aligned_dst = (long*)dst; - aligned_src = (long*)src; - - /* SRC and DEST are both "long int" aligned, try to do "long int" - sized copies. */ - while (!DETECTNULL(*aligned_src)) - { - *aligned_dst++ = *aligned_src++; - } - - dst = (char*)aligned_dst; - src = (char*)aligned_src; - } - - while (*dst++ = *src++) - ; - return dst0; -#endif /* not PREFER_SIZE_OVER_SPEED */ -} diff --git a/newlib/libc/string/strcspn.c b/newlib/libc/string/strcspn.c deleted file mode 100644 index fe68b8f51..000000000 --- a/newlib/libc/string/strcspn.c +++ /dev/null @@ -1,54 +0,0 @@ -/* -FUNCTION - <<strcspn>>---count chars not in string - -INDEX - strcspn - -ANSI_SYNOPSIS - size_t strcspn(const char *<[s1]>, const char *<[s2]>); - -TRAD_SYNOPSIS - size_t strcspn(<[s1]>, <[s2]>) - char *<[s1]>; - char *<[s2]>; - -DESCRIPTION - This function computes the length of the initial part of - the string pointed to by <[s1]> which consists entirely of - characters <[NOT]> from the string pointed to by <[s2]> - (excluding the terminating null character). - -RETURNS - <<strcspn>> returns the length of the substring found. - -PORTABILITY -<<strcspn>> is ANSI C. - -<<strcspn>> requires no supporting OS subroutines. - */ - -#include <string.h> - -size_t -_DEFUN (strcspn, (s1, s2), - _CONST char *s1 _AND - _CONST char *s2) -{ - _CONST char *s = s1; - _CONST char *c; - - while (*s1) - { - for (c = s2; *c; c++) - { - if (*s1 == *c) - break; - } - if (*c) - break; - s1++; - } - - return s1 - s; -} diff --git a/newlib/libc/string/strdup.c b/newlib/libc/string/strdup.c deleted file mode 100644 index dbb069264..000000000 --- a/newlib/libc/string/strdup.c +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef _REENT_ONLY - -#include <reent.h> -#include <stdlib.h> -#include <string.h> - -char * -_DEFUN (strdup, (str), _CONST char *str) -{ - return _strdup_r (_REENT, str); -} - -#endif /* !_REENT_ONLY */ diff --git a/newlib/libc/string/strdup_r.c b/newlib/libc/string/strdup_r.c deleted file mode 100644 index ef77a58eb..000000000 --- a/newlib/libc/string/strdup_r.c +++ /dev/null @@ -1,17 +0,0 @@ -#include <reent.h> -#include <stdlib.h> -#include <string.h> - -char * -_DEFUN (_strdup_r, (reent_ptr, str), - struct _reent *reent_ptr _AND - _CONST char *str) -{ - size_t len = strlen (str) + 1; - char *copy = _malloc_r (reent_ptr, len); - if (copy) - { - memcpy (copy, str, len); - } - return copy; -} diff --git a/newlib/libc/string/strerror.c b/newlib/libc/string/strerror.c deleted file mode 100644 index 8bea4b768..000000000 --- a/newlib/libc/string/strerror.c +++ /dev/null @@ -1,761 +0,0 @@ -/*** -**** CAUTION!!! KEEP DOC CONSISTENT---if you change text of a message -**** here, change two places: -**** 1) the leading doc section (alphabetized by macro) -**** 2) the real text inside switch(errnum) -***/ - -/* -FUNCTION - <<strerror>>---convert error number to string - -INDEX - strerror - -ANSI_SYNOPSIS - #include <string.h> - char *strerror(int <[errnum]>); - -TRAD_SYNOPSIS - #include <string.h> - char *strerror(<[errnum]>) - int <[errnum]>; - -DESCRIPTION -<<strerror>> converts the error number <[errnum]> into a -string. The value of <[errnum]> is usually a copy of <<errno>>. -If <<errnum>> is not a known error number, the result points to an -empty string. - -This implementation of <<strerror>> prints out the following strings -for each of the values defined in `<<errno.h>>': - -o+ -o E2BIG -Arg list too long - -o EACCES -Permission denied - -o EADDRINUSE -Address already in use - -o EADV -Advertise error - -o EAFNOSUPPORT -Address family not supported by protocol family - -o EAGAIN -No more processes - -o EALREADY -Socket already connected - -o EBADF -Bad file number - -o EBADMSG -Bad message - -o EBUSY -Device or resource busy - -o ECHILD -No children - -o ECOMM -Communication error - -o ECONNABORTED -Software caused connection abort - -o ECONNREFUSED -Connection refused - -o EDEADLK -Deadlock - -o EDESTADDRREQ -Destination address required - -o EEXIST -File exists - -o EDOM -Math argument - -o EFAULT -Bad address - -o EFBIG -File too large - -o EHOSTDOWN -Host is down - -o EHOSTUNREACH -Host is unreachable - -o EIDRM -Identifier removed - -o EINPROGRESS -Connection already in progress - -o EINTR -Interrupted system call - -o EINVAL -Invalid argument - -o EIO -I/O error - -o EISCONN -Socket is already connected - -o EISDIR -Is a directory - -o ELIBACC -Cannot access a needed shared library - -o ELIBBAD -Accessing a corrupted shared library - -o ELIBEXEC -Cannot exec a shared library directly - -o ELIBMAX -Attempting to link in more shared libraries than system limit - -o ELIBSCN -<<.lib>> section in a.out corrupted - -o EMFILE -Too many open files - -o EMLINK -Too many links - -o EMSGSIZE -Message too long - -o EMULTIHOP -Multihop attempted - -o ENAMETOOLONG -File or path name too long - -o ENETDOWN -Network interface not configured - -o ENETUNREACH -Network is unreachable - -o ENFILE -Too many open files in system - -o ENODEV -No such device - -o ENOENT -No such file or directory - -o ENOEXEC -Exec format error - -o ENOLCK -No lock - -o ENOLINK -Virtual circuit is gone - -o ENOMEM -Not enough space - -o ENOMSG -No message of desired type - -o ENONET -Machine is not on the network - -o ENOPKG -No package - -o ENOPROTOOPT -Protocol not available - -o ENOSPC -No space left on device - -o ENOSR -No stream resources - -o ENOSTR -Not a stream - -o ENOSYS -Function not implemented - -o ENOTBLK -Block device required - -o ENOTCONN -Socket is not connected - -o ENOTDIR -Not a directory - -o ENOTEMPTY -Directory not empty - -o ENOTSOCK -Socket operation on non-socket - -o ENOTSUP -Not supported - -o ENOTTY -Not a character device - -o ENXIO -No such device or address - -o EPERM -Not owner - -o EPIPE -Broken pipe - -o EPROTO -Protocol error - -o EPROTOTYPE -Protocol wrong type for socket - -o EPROTONOSUPPORT -Unknown protocol - -o ERANGE -Result too large - -o EREMOTE -Resource is remote - -o EROFS -Read-only file system - -o ESHUTDOWN -Can't send after socket shutdown - -o ESOCKTNOSUPPORT -Socket type not supported - -o ESPIPE -Illegal seek - -o ESRCH -No such process - -o ESRMNT -Srmount error - -o ETIME -Stream ioctl timeout - -o ETIMEDOUT -Connection timed out - -o ETXTBSY -Text file busy - -o EXDEV -Cross-device link - -o- - -RETURNS -This function returns a pointer to a string. Your application must -not modify that string. - -PORTABILITY -ANSI C requires <<strerror>>, but does not specify the strings used -for each error number. - -Although this implementation of <<strerror>> is reentrant, ANSI C -declares that subsequent calls to <<strerror>> may overwrite the -result string; therefore portable code cannot depend on the reentrancy -of this subroutine. - -This implementation of <<strerror>> provides for user-defined -extensibility. <<errno.h>> defines <[__ELASTERROR]>, which can be -used as a base for user-defined error values. If the user supplies a -routine named <<_user_strerror>>, and <[errnum]> passed to -<<strerror>> does not match any of the supported values, -<<_user_strerror>> is called with <[errnum]> as its argument. - -<<_user_strerror>> takes one argument of type <[int]>, and returns a -character pointer. If <[errnum]> is unknown to <<_user_strerror>>, -<<_user_strerror>> returns <[NULL]>. The default <<_user_strerror>> -returns <[NULL]> for all input values. - -<<strerror>> requires no supporting OS subroutines. - -QUICKREF - strerror ansi pure -*/ - -#include <errno.h> -#include <string.h> - -char * -_DEFUN (strerror, (errnum), - int errnum) -{ - char *error; - extern char *_user_strerror _PARAMS ((int)); - - switch (errnum) - { -/* go32 defines EPERM as EACCES */ -#if defined (EPERM) && (!defined (EACCES) || (EPERM != EACCES)) - case EPERM: - error = "Not owner"; - break; -#endif -#ifdef ENOENT - case ENOENT: - error = "No such file or directory"; - break; -#endif -#ifdef ESRCH - case ESRCH: - error = "No such process"; - break; -#endif -#ifdef EINTR - case EINTR: - error = "Interrupted system call"; - break; -#endif -#ifdef EIO - case EIO: - error = "I/O error"; - break; -#endif -/* go32 defines ENXIO as ENODEV */ -#if defined (ENXIO) && (!defined (ENODEV) || (ENXIO != ENODEV)) - case ENXIO: - error = "No such device or address"; - break; -#endif -#ifdef E2BIG - case E2BIG: - error = "Arg list too long"; - break; -#endif -#ifdef ENOEXEC - case ENOEXEC: - error = "Exec format error"; - break; -#endif -#ifdef EALREADY - case EALREADY: - error = "Socket already connected"; - break; -#endif -#ifdef EBADF - case EBADF: - error = "Bad file number"; - break; -#endif -#ifdef ECHILD - case ECHILD: - error = "No children"; - break; -#endif -#ifdef EDESTADDRREQ - case EDESTADDRREQ: - error = "Destination address required"; - break; -#endif -#ifdef EAGAIN - case EAGAIN: - error = "No more processes"; - break; -#endif -#ifdef ENOMEM - case ENOMEM: - error = "Not enough space"; - break; -#endif -#ifdef EACCES - case EACCES: - error = "Permission denied"; - break; -#endif -#ifdef EFAULT - case EFAULT: - error = "Bad address"; - break; -#endif -#ifdef ENOTBLK - case ENOTBLK: - error = "Block device required"; - break; -#endif -#ifdef EBUSY - case EBUSY: - error = "Device or resource busy"; - break; -#endif -#ifdef EEXIST - case EEXIST: - error = "File exists"; - break; -#endif -#ifdef EXDEV - case EXDEV: - error = "Cross-device link"; - break; -#endif -#ifdef ENODEV - case ENODEV: - error = "No such device"; - break; -#endif -#ifdef ENOTDIR - case ENOTDIR: - error = "Not a directory"; - break; -#endif -#ifdef EHOSTDOWN - case EHOSTDOWN: - error = "Host is down"; - break; -#endif -#ifdef EINPROGRESS - case EINPROGRESS: - error = "Connection already in progress"; - break; -#endif -#ifdef EISDIR - case EISDIR: - error = "Is a directory"; - break; -#endif -#ifdef EINVAL - case EINVAL: - error = "Invalid argument"; - break; -#endif -#ifdef ENETDOWN - case ENETDOWN: - error = "Network interface is not configured"; - break; -#endif -#ifdef ENFILE - case ENFILE: - error = "Too many open files in system"; - break; -#endif -#ifdef EMFILE - case EMFILE: - error = "Too many open files"; - break; -#endif -#ifdef ENOTTY - case ENOTTY: - error = "Not a character device"; - break; -#endif -#ifdef ETXTBSY - case ETXTBSY: - error = "Text file busy"; - break; -#endif -#ifdef EFBIG - case EFBIG: - error = "File too large"; - break; -#endif -#ifdef EHOSTUNREACH - case EHOSTUNREACH: - error = "Host is unreachable"; - break; -#endif -#ifdef ENOSPC - case ENOSPC: - error = "No space left on device"; - break; -#endif -#ifdef ENOTSUP - case ENOTSUP: - error = "Not supported"; - break; -#endif -#ifdef ESPIPE - case ESPIPE: - error = "Illegal seek"; - break; -#endif -#ifdef EROFS - case EROFS: - error = "Read-only file system"; - break; -#endif -#ifdef EMLINK - case EMLINK: - error = "Too many links"; - break; -#endif -#ifdef EPIPE - case EPIPE: - error = "Broken pipe"; - break; -#endif -#ifdef EDOM - case EDOM: - error = "Math argument"; - break; -#endif -#ifdef ERANGE - case ERANGE: - error = "Result too large"; - break; -#endif -#ifdef ENOMSG - case ENOMSG: - error = "No message of desired type"; - break; -#endif -#ifdef EIDRM - case EIDRM: - error = "Identifier removed"; - break; -#endif -#ifdef EDEADLK - case EDEADLK: - error = "Deadlock"; - break; -#endif -#ifdef ENETUNREACH - case ENETUNREACH: - error = "Network is unreachable"; - break; -#endif -#ifdef ENOLCK - case ENOLCK: - error = "No lock"; - break; -#endif -#ifdef ENOSTR - case ENOSTR: - error = "Not a stream"; - break; -#endif -#ifdef ETIME - case ETIME: - error = "Stream ioctl timeout"; - break; -#endif -#ifdef ENOSR - case ENOSR: - error = "No stream resources"; - break; -#endif -#ifdef ENONET - case ENONET: - error = "Machine is not on the network"; - break; -#endif -#ifdef ENOPKG - case ENOPKG: - error = "No package"; - break; -#endif -#ifdef EREMOTE - case EREMOTE: - error = "Resource is remote"; - break; -#endif -#ifdef ENOLINK - case ENOLINK: - error = "Virtual circuit is gone"; - break; -#endif -#ifdef EADV - case EADV: - error = "Advertise error"; - break; -#endif -#ifdef ESRMNT - case ESRMNT: - error = "Srmount error"; - break; -#endif -#ifdef ECOMM - case ECOMM: - error = "Communication error"; - break; -#endif -#ifdef EPROTO - case EPROTO: - error = "Protocol error"; - break; -#endif -#ifdef EPROTONOSUPPORT - case EPROTONOSUPPORT: - error = "Unknown protocol"; - break; -#endif -#ifdef EMULTIHOP - case EMULTIHOP: - error = "Multihop attempted"; - break; -#endif -#ifdef EBADMSG - case EBADMSG: - error = "Bad message"; - break; -#endif -#ifdef ELIBACC - case ELIBACC: - error = "Cannot access a needed shared library"; - break; -#endif -#ifdef ELIBBAD - case ELIBBAD: - error = "Accessing a corrupted shared library"; - break; -#endif -#ifdef ELIBSCN - case ELIBSCN: - error = ".lib section in a.out corrupted"; - break; -#endif -#ifdef ELIBMAX - case ELIBMAX: - error = "Attempting to link in more shared libraries than system limit"; - break; -#endif -#ifdef ELIBEXEC - case ELIBEXEC: - error = "Cannot exec a shared library directly"; - break; -#endif -#ifdef ENOSYS - case ENOSYS: - error = "Function not implemented"; - break; -#endif -#ifdef ENMFILE - case ENMFILE: - error = "No more files"; - break; -#endif -#ifdef ENOTEMPTY - case ENOTEMPTY: - error = "Directory not empty"; - break; -#endif -#ifdef ENAMETOOLONG - case ENAMETOOLONG: - error = "File or path name too long"; - break; -#endif -#ifdef ELOOP - case ELOOP: - error = "Too many symbolic links"; - break; -#endif -#ifdef ENOBUFS - case ENOBUFS: - error = "No buffer space available"; - break; -#endif -#ifdef EAFNOSUPPORT - case EAFNOSUPPORT: - error = "Address family not supported by protocol family"; - break; -#endif -#ifdef EPROTOTYPE - case EPROTOTYPE: - error = "Protocol wrong type for socket"; - break; -#endif -#ifdef ENOTSOCK - case ENOTSOCK: - error = "Socket operation on non-socket"; - break; -#endif -#ifdef ENOPROTOOPT - case ENOPROTOOPT: - error = "Protocol not available"; - break; -#endif -#ifdef ESHUTDOWN - case ESHUTDOWN: - error = "Can't send after socket shutdown"; - break; -#endif -#ifdef ECONNREFUSED - case ECONNREFUSED: - error = "Connection refused"; - break; -#endif -#ifdef EADDRINUSE - case EADDRINUSE: - error = "Address already in use"; - break; -#endif -#ifdef ECONNABORTED - case ECONNABORTED: - error = "Software caused connection abort"; - break; -#endif -#if (defined(EWOULDBLOCK) && (!defined (EAGAIN) || (EWOULDBLOCK != EAGAIN))) - case EWOULDBLOCK: - error = "Operation would block"; - break; -#endif -#ifdef ENOTCONN - case ENOTCONN: - error = "Socket is not connected"; - break; -#endif -#ifdef ESOCKTNOSUPPORT - case ESOCKTNOSUPPORT: - error = "Socket type not supported"; - break; -#endif -#ifdef EISCONN - case EISCONN: - error = "Socket is already connected"; - break; -#endif -#if defined(EOPNOTSUPP) && (!defined(ENOTSUP) || (ENOTSUP != EOPNOTSUPP)) - case EOPNOTSUPP: - error = "Operation not supported on socket"; - break; -#endif -#ifdef EMSGSIZE - case EMSGSIZE: - error = "Message too long"; - break; -#endif -#ifdef ETIMEDOUT - case ETIMEDOUT: - error = "Connection timed out"; - break; -#endif - default: - if ((error = _user_strerror (errnum)) == 0) - error = ""; - break; - } - - return error; -} diff --git a/newlib/libc/string/strerror_r.c b/newlib/libc/string/strerror_r.c deleted file mode 100644 index 956a1f485..000000000 --- a/newlib/libc/string/strerror_r.c +++ /dev/null @@ -1,53 +0,0 @@ -/* -FUNCTION - <<strerror_r>>---convert error number to string and copy to buffer - -INDEX - strerror_r - -ANSI_SYNOPSIS - #include <string.h> - char *strerror_r(int <[errnum]>, char *<[buffer]>, size_t <[n]>); - -TRAD_SYNOPSIS - #include <string.h> - char *strerror_r(<[errnum]>, <[buffer]>, <[n]>) - int <[errnum]>; - char *<[buffer]>; - size_t <[n]>; - -DESCRIPTION -<<strerror_r>> converts the error number <[errnum]> into a -string and copies the result into the supplied <[buffer]> for -a length up to <[n]>, including the NUL terminator. The value of -<[errnum]> is usually a copy of <<errno>>. If <<errnum>> is not a known -error number, the result is the empty string. - -See <<strerror>> for how strings are mapped to <<errnum>>. - -RETURNS -This function returns a pointer to a string. Your application must -not modify that string. - -PORTABILITY -<<strerror_r>> is a gnu extension. - -<<strerror_r>> requires no supporting OS subroutines. - -*/ - -#undef __STRICT_ANSI__ -#include <errno.h> -#include <string.h> - -char * -_DEFUN (strerror_r, (errnum, buffer, n), - int errnum _AND - char *buffer _AND - size_t n) -{ - char *error; - error = strerror (errnum); - - return strncpy (buffer, (const char *)error, n); -} diff --git a/newlib/libc/string/strings.tex b/newlib/libc/string/strings.tex deleted file mode 100644 index 7f9106ee9..000000000 --- a/newlib/libc/string/strings.tex +++ /dev/null @@ -1,145 +0,0 @@ -@node Strings -@chapter Strings and Memory (@file{string.h}) - -This chapter describes string-handling functions and functions for -managing areas of memory. The corresponding declarations are in -@file{string.h}. - -@menu -* bcmp:: Compare two memory areas -* bcopy:: Copy memory regions -* bzero:: Initialize memory to zero -* index:: Search for character in string -* memccpy:: Copy memory regions up to end-token -* memchr:: Find character in memory -* memcmp:: Compare two memory areas -* memcpy:: Copy memory regions -* memmove:: Move possibly overlapping memory -* mempcpy:: Copy memory regions and locate end -* memset:: Set an area of memory -* rindex:: Reverse search for character in string -* strcasecmp:: Compare strings ignoring case -* strcat:: Concatenate strings -* strchr:: Search for character in string -* strcmp:: Character string compare -* strcoll:: Locale specific character string compare -* strcpy:: Copy string -* strcspn:: Count chars not in string -* strerror:: Convert error number to string -* strlen:: Character string length -* strlwr:: Convert string to lower case -* strncasecmp:: Compare strings ignoring case -* strncat:: Concatenate strings -* strncmp:: Character string compare -* strncpy:: Counted copy string -* strpbrk:: Find chars in string -* strrchr:: Reverse search for character in string -* strspn:: Find initial match -* strstr:: Find string segment -* strtok:: Get next token from a string -* strupr:: Convert string to upper case -* strxfrm:: Transform string -* swab:: Swap adjacent bytes -@end menu - -@page -@include string/bcmp.def - -@page -@include string/bcopy.def - -@page -@include string/bzero.def - -@page -@include string/index.def - -@page -@include string/memccpy.def - -@page -@include string/memchr.def - -@page -@include string/memcmp.def - -@page -@include string/memcpy.def - -@page -@include string/memmove.def - -@page -@include string/mempcpy.def - -@page -@include string/memset.def - -@page -@include string/rindex.def - -@page -@include string/strcasecmp.def - -@page -@include string/strcat.def - -@page -@include string/strchr.def - -@page -@include string/strcmp.def - -@page -@include string/strcoll.def - -@page -@include string/strcpy.def - -@page -@include string/strcspn.def - -@page -@include string/strerror.def - -@page -@include string/strlen.def - -@page -@include string/strlwr.def - -@page -@include string/strncasecmp.def - -@page -@include string/strncat.def - -@page -@include string/strncmp.def - -@page -@include string/strncpy.def - -@page -@include string/strpbrk.def - -@page -@include string/strrchr.def - -@page -@include string/strspn.def - -@page -@include string/strstr.def - -@page -@include string/strtok.def - -@page -@include string/strupr.def - -@page -@include string/strxfrm.def - -@page -@include string/swab.def diff --git a/newlib/libc/string/strlcat.c b/newlib/libc/string/strlcat.c deleted file mode 100644 index 0c47bd527..000000000 --- a/newlib/libc/string/strlcat.c +++ /dev/null @@ -1,74 +0,0 @@ -/* $OpenBSD: strlcat.c,v 1.8 2001/05/13 15:40:15 deraadt Exp $ */ - -/* - * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: strlcat.c,v 1.8 2001/05/13 15:40:15 deraadt Exp $"; -#endif /* LIBC_SCCS and not lint */ - -#include <sys/types.h> -#include <string.h> - -/* - * Appends src to string dst of size siz (unlike strncat, siz is the - * full size of dst, not space left). At most siz-1 characters - * will be copied. Always NUL terminates (unless siz <= strlen(dst)). - * Returns strlen(src) + MIN(siz, strlen(initial dst)). - * If retval >= siz, truncation occurred. - */ -size_t -_DEFUN (strlcat, (dst, src, siz), - char *dst _AND - _CONST char *src _AND - size_t siz) -{ - register char *d = dst; - register const char *s = src; - register size_t n = siz; - size_t dlen; - - /* Find the end of dst and adjust bytes left but don't go past end */ - while (n-- != 0 && *d != '\0') - d++; - dlen = d - dst; - n = siz - dlen; - - if (n == 0) - return(dlen + strlen(s)); - while (*s != '\0') { - if (n != 1) { - *d++ = *s; - n--; - } - s++; - } - *d = '\0'; - - return(dlen + (s - src)); /* count does not include NUL */ -} - diff --git a/newlib/libc/string/strlcpy.c b/newlib/libc/string/strlcpy.c deleted file mode 100644 index c31001642..000000000 --- a/newlib/libc/string/strlcpy.c +++ /dev/null @@ -1,70 +0,0 @@ -/* $OpenBSD: strlcpy.c,v 1.5 2001/05/13 15:40:16 deraadt Exp $ */ - -/* - * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: strlcpy.c,v 1.5 2001/05/13 15:40:16 deraadt Exp $"; -#endif /* LIBC_SCCS and not lint */ - -#include <sys/types.h> -#include <string.h> - -/* - * Copy src to string dst of size siz. At most siz-1 characters - * will be copied. Always NUL terminates (unless siz == 0). - * Returns strlen(src); if retval >= siz, truncation occurred. - */ -size_t -_DEFUN (strlcpy, (dst, src, siz), - char *dst _AND - _CONST char *src _AND - size_t siz) -{ - register char *d = dst; - register const char *s = src; - register size_t n = siz; - - /* Copy as many bytes as will fit */ - if (n != 0 && --n != 0) { - do { - if ((*d++ = *s++) == 0) - break; - } while (--n != 0); - } - - /* Not enough room in dst, add NUL and traverse rest of src */ - if (n == 0) { - if (siz != 0) - *d = '\0'; /* NUL-terminate dst */ - while (*s++) - ; - } - - return(s - src - 1); /* count does not include NUL */ -} - diff --git a/newlib/libc/string/strlen.c b/newlib/libc/string/strlen.c deleted file mode 100644 index 4249e14c7..000000000 --- a/newlib/libc/string/strlen.c +++ /dev/null @@ -1,88 +0,0 @@ -/* -FUNCTION - <<strlen>>---character string length - -INDEX - strlen - -ANSI_SYNOPSIS - #include <string.h> - size_t strlen(const char *<[str]>); - -TRAD_SYNOPSIS - #include <string.h> - size_t strlen(<[str]>) - char *<[src]>; - -DESCRIPTION - The <<strlen>> function works out the length of the string - starting at <<*<[str]>>> by counting chararacters until it - reaches a <<NULL>> character. - -RETURNS - <<strlen>> returns the character count. - -PORTABILITY -<<strlen>> is ANSI C. - -<<strlen>> requires no supporting OS subroutines. - -QUICKREF - strlen ansi pure -*/ - -#include <_ansi.h> -#include <string.h> -#include <limits.h> - -#define LBLOCKSIZE (sizeof (long)) -#define UNALIGNED(X) ((long)X & (LBLOCKSIZE - 1)) - -#if LONG_MAX == 2147483647L -#define DETECTNULL(X) (((X) - 0x01010101) & ~(X) & 0x80808080) -#else -#if LONG_MAX == 9223372036854775807L -/* Nonzero if X (a long int) contains a NULL byte. */ -#define DETECTNULL(X) (((X) - 0x0101010101010101) & ~(X) & 0x8080808080808080) -#else -#error long int is not a 32bit or 64bit type. -#endif -#endif - -#ifndef DETECTNULL -#error long int is not a 32bit or 64bit byte -#endif - -size_t -_DEFUN (strlen, (str), - _CONST char *str) -{ -#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) - _CONST char *start = str; - - while (*str) - str++; - - return str - start; -#else - _CONST char *start = str; - unsigned long *aligned_addr; - - if (!UNALIGNED (str)) - { - /* If the string is word-aligned, we can check for the presence of - a null in each word-sized block. */ - aligned_addr = (unsigned long*)str; - while (!DETECTNULL (*aligned_addr)) - aligned_addr++; - - /* Once a null is detected, we check each byte in that block for a - precise position of the null. */ - str = (char*)aligned_addr; - } - - while (*str) - str++; - return str - start; -#endif /* not PREFER_SIZE_OVER_SPEED */ -} diff --git a/newlib/libc/string/strlwr.c b/newlib/libc/string/strlwr.c deleted file mode 100644 index cf0d45f71..000000000 --- a/newlib/libc/string/strlwr.c +++ /dev/null @@ -1,50 +0,0 @@ -/* -FUNCTION - <<strlwr>>---force string to lower case - -INDEX - strlwr - -ANSI_SYNOPSIS - #include <string.h> - char *strlwr(char *<[a]>); - -TRAD_SYNOPSIS - #include <string.h> - char *strlwr(<[a]>) - char *<[a]>; - -DESCRIPTION - <<strlwr>> converts each characters in the string at <[a]> to - lower case. - -RETURNS - <<strlwr>> returns its argument, <[a]>. - -PORTABILITY -<<strlwr>> is not widely portable. - -<<strlwr>> requires no supporting OS subroutines. - -QUICKREF - strlwr -*/ - -#include <string.h> -#include <ctype.h> - -char * -strlwr (a) - char *a; -{ - char *ret = a; - - while (*a != '\0') - { - if (isupper (*a)) - *a = tolower (*a); - ++a; - } - - return ret; -} diff --git a/newlib/libc/string/strncasecmp.c b/newlib/libc/string/strncasecmp.c deleted file mode 100644 index 28c6cc44f..000000000 --- a/newlib/libc/string/strncasecmp.c +++ /dev/null @@ -1,64 +0,0 @@ -/* -FUNCTION - <<strncasecmp>>---case insensitive character string compare - -INDEX - strncasecmp - -ANSI_SYNOPSIS - #include <string.h> - int strncasecmp(const char *<[a]>, const char * <[b]>, size_t <[length]>); - -TRAD_SYNOPSIS - #include <string.h> - int strncasecmp(<[a]>, <[b]>, <[length]>) - char *<[a]>; - char *<[b]>; - size_t <[length]> - -DESCRIPTION - <<strncasecmp>> compares up to <[length]> 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 upper case), <<strncasecmp>> returns a - number greater than zero. If the two strings are equivalent, - <<strncasecmp>> returns zero. If <<*<[a]>>> sorts - lexicographically before <<*<[b]>>>, <<strncasecmp>> returns a - number less than zero. - -PORTABILITY -<<strncasecmp>> is in the Berkeley Software Distribution. - -<<strncasecmp>> requires no supporting OS subroutines. It uses -tolower() from elsewhere in this library. - -QUICKREF - strncasecmp -*/ - -#include <string.h> -#include <ctype.h> - -int -_DEFUN (strncasecmp, (s1, s2, n), - _CONST char *s1 _AND - _CONST char *s2 _AND - size_t n) -{ - if (n == 0) - return 0; - - while (n-- != 0 && tolower(*s1) == tolower(*s2)) - { - if (n == 0 || *s1 == '\0' || *s2 == '\0') - break; - s1++; - s2++; - } - - return tolower(*(unsigned char *) s1) - tolower(*(unsigned char *) s2); -} diff --git a/newlib/libc/string/strncat.c b/newlib/libc/string/strncat.c deleted file mode 100644 index 57ca068eb..000000000 --- a/newlib/libc/string/strncat.c +++ /dev/null @@ -1,115 +0,0 @@ -/* -FUNCTION - <<strncat>>---concatenate strings - -INDEX - strncat - -ANSI_SYNOPSIS - #include <string.h> - char *strncat(char *<[dst]>, const char *<[src]>, size_t <[length]>); - -TRAD_SYNOPSIS - #include <string.h> - char *strncat(<[dst]>, <[src]>, <[length]>) - char *<[dst]>; - char *<[src]>; - size_t <[length]>; - -DESCRIPTION - <<strncat>> appends not more than <[length]> characters from - the string pointed to by <[src]> (including the terminating - null character) to the end of the string pointed to by - <[dst]>. The initial character of <[src]> overwrites the null - character at the end of <[dst]>. A terminating null character - is always appended to the result - -WARNINGS - Note that a null is always appended, so that if the copy is - limited by the <[length]> argument, the number of characters - appended to <[dst]> is <<n + 1>>. - - -RETURNS - This function returns the initial value of <[dst]> - -PORTABILITY -<<strncat>> is ANSI C. - -<<strncat>> requires no supporting OS subroutines. - -QUICKREF - strncat ansi pure -*/ - -#include <string.h> -#include <limits.h> - -/* Nonzero if X is aligned on a "long" boundary. */ -#define ALIGNED(X) \ - (((long)X & (sizeof (long) - 1)) == 0) - -#if LONG_MAX == 2147483647L -#define DETECTNULL(X) (((X) - 0x01010101) & ~(X) & 0x80808080) -#else -#if LONG_MAX == 9223372036854775807L -/* Nonzero if X (a long int) contains a NULL byte. */ -#define DETECTNULL(X) (((X) - 0x0101010101010101) & ~(X) & 0x8080808080808080) -#else -#error long int is not a 32bit or 64bit type. -#endif -#endif - -#ifndef DETECTNULL -#error long int is not a 32bit or 64bit byte -#endif - -char * -_DEFUN (strncat, (s1, s2, n), - char *s1 _AND - _CONST char *s2 _AND - size_t n) -{ -#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) - char *s = s1; - - while (*s1) - s1++; - while (n-- != 0 && (*s1++ = *s2++)) - { - if (n == 0) - *s1 = '\0'; - } - - return s; -#else - char *s = s1; - - /* Skip over the data in s1 as quickly as possible. */ - if (ALIGNED (s1)) - { - unsigned long *aligned_s1 = (unsigned long *)s1; - while (!DETECTNULL (*aligned_s1)) - aligned_s1++; - - s1 = (char *)aligned_s1; - } - - while (*s1) - s1++; - - /* s1 now points to the its trailing null character, now copy - up to N bytes from S2 into S1 stopping if a NULL is encountered - in S2. - - It is not safe to use strncpy here since it copies EXACTLY N - characters, NULL padding if necessary. */ - while (n-- != 0 && (*s1++ = *s2++)) - { - if (n == 0) - *s1 = '\0'; - } - - return s; -#endif /* not PREFER_SIZE_OVER_SPEED */ -} diff --git a/newlib/libc/string/strncmp.c b/newlib/libc/string/strncmp.c deleted file mode 100644 index 9801b7d92..000000000 --- a/newlib/libc/string/strncmp.c +++ /dev/null @@ -1,122 +0,0 @@ -/* -FUNCTION - <<strncmp>>---character string compare - -INDEX - strncmp - -ANSI_SYNOPSIS - #include <string.h> - int strncmp(const char *<[a]>, const char * <[b]>, size_t <[length]>); - -TRAD_SYNOPSIS - #include <string.h> - int strncmp(<[a]>, <[b]>, <[length]>) - char *<[a]>; - char *<[b]>; - size_t <[length]> - -DESCRIPTION - <<strncmp>> compares up to <[length]> characters - from the string at <[a]> to the string at <[b]>. - -RETURNS - If <<*<[a]>>> sorts lexicographically after <<*<[b]>>>, - <<strncmp>> returns a number greater than zero. If the two - strings are equivalent, <<strncmp>> returns zero. If <<*<[a]>>> - sorts lexicographically before <<*<[b]>>>, <<strncmp>> returns a - number less than zero. - -PORTABILITY -<<strncmp>> is ANSI C. - -<<strncmp>> requires no supporting OS subroutines. - -QUICKREF - strncmp ansi pure -*/ - -#include <string.h> -#include <limits.h> - -/* Nonzero if either X or Y is not aligned on a "long" boundary. */ -#define UNALIGNED(X, Y) \ - (((long)X & (sizeof (long) - 1)) | ((long)Y & (sizeof (long) - 1))) - -/* DETECTNULL returns nonzero if (long)X contains a NULL byte. */ -#if LONG_MAX == 2147483647L -#define DETECTNULL(X) (((X) - 0x01010101) & ~(X) & 0x80808080) -#else -#if LONG_MAX == 9223372036854775807L -#define DETECTNULL(X) (((X) - 0x0101010101010101) & ~(X) & 0x8080808080808080) -#else -#error long int is not a 32bit or 64bit type. -#endif -#endif - -#ifndef DETECTNULL -#error long int is not a 32bit or 64bit byte -#endif - -int -_DEFUN (strncmp, (s1, s2, n), - _CONST char *s1 _AND - _CONST char *s2 _AND - size_t n) -{ -#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) - if (n == 0) - return 0; - - while (n-- != 0 && *s1 == *s2) - { - if (n == 0 || *s1 == '\0') - break; - s1++; - s2++; - } - - return (*(unsigned char *) s1) - (*(unsigned char *) s2); -#else - unsigned long *a1; - unsigned long *a2; - - if (n == 0) - return 0; - - /* If s1 or s2 are unaligned, then compare bytes. */ - if (!UNALIGNED (s1, s2)) - { - /* If s1 and s2 are word-aligned, compare them a word at a time. */ - a1 = (unsigned long*)s1; - a2 = (unsigned long*)s2; - while (n >= sizeof (long) && *a1 == *a2) - { - n -= sizeof (long); - - /* If we've run out of bytes or hit a null, return zero - since we already know *a1 == *a2. */ - if (n == 0 || DETECTNULL (*a1)) - return 0; - - a1++; - a2++; - } - - /* A difference was detected in last few bytes of s1, so search bytewise */ - s1 = (char*)a1; - s2 = (char*)a2; - } - - while (n-- > 0 && *s1 == *s2) - { - /* If we've run out of bytes or hit a null, return zero - since we already know *s1 == *s2. */ - if (n == 0 || *s1 == '\0') - return 0; - s1++; - s2++; - } - return (*(unsigned char *) s1) - (*(unsigned char *) s2); -#endif /* not PREFER_SIZE_OVER_SPEED */ -} diff --git a/newlib/libc/string/strncpy.c b/newlib/libc/string/strncpy.c deleted file mode 100644 index 7c1973ba6..000000000 --- a/newlib/libc/string/strncpy.c +++ /dev/null @@ -1,125 +0,0 @@ -/* -FUNCTION - <<strncpy>>---counted copy string - -INDEX - strncpy - -ANSI_SYNOPSIS - #include <string.h> - char *strncpy(char *<[dst]>, const char *<[src]>, size_t <[length]>); - -TRAD_SYNOPSIS - #include <string.h> - char *strncpy(<[dst]>, <[src]>, <[length]>) - char *<[dst]>; - char *<[src]>; - size_t <[length]>; - -DESCRIPTION - <<strncpy>> copies not more than <[length]> characters from the - the string pointed to by <[src]> (including the terminating - null character) to the array pointed to by <[dst]>. If the - string pointed to by <[src]> is shorter than <[length]> - characters, null characters are appended to the destination - array until a total of <[length]> characters have been - written. - -RETURNS - This function returns the initial value of <[dst]>. - -PORTABILITY -<<strncpy>> is ANSI C. - -<<strncpy>> requires no supporting OS subroutines. - -QUICKREF - strncpy ansi pure -*/ - -#include <string.h> -#include <limits.h> - -/*SUPPRESS 560*/ -/*SUPPRESS 530*/ - -/* Nonzero if either X or Y is not aligned on a "long" boundary. */ -#define UNALIGNED(X, Y) \ - (((long)X & (sizeof (long) - 1)) | ((long)Y & (sizeof (long) - 1))) - -#if LONG_MAX == 2147483647L -#define DETECTNULL(X) (((X) - 0x01010101) & ~(X) & 0x80808080) -#else -#if LONG_MAX == 9223372036854775807L -/* Nonzero if X (a long int) contains a NULL byte. */ -#define DETECTNULL(X) (((X) - 0x0101010101010101) & ~(X) & 0x8080808080808080) -#else -#error long int is not a 32bit or 64bit type. -#endif -#endif - -#ifndef DETECTNULL -#error long int is not a 32bit or 64bit byte -#endif - -#define TOO_SMALL(LEN) ((LEN) < sizeof (long)) - -char * -_DEFUN (strncpy, (dst0, src0), - char *dst0 _AND - _CONST char *src0 _AND - size_t count) -{ -#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) - char *dscan; - _CONST char *sscan; - - dscan = dst0; - sscan = src0; - while (count > 0) - { - --count; - if ((*dscan++ = *sscan++) == '\0') - break; - } - while (count-- > 0) - *dscan++ = '\0'; - - return dst0; -#else - char *dst = dst0; - _CONST char *src = src0; - long *aligned_dst; - _CONST long *aligned_src; - - /* If SRC and DEST is aligned and count large enough, then copy words. */ - if (!UNALIGNED (src, dst) && !TOO_SMALL (count)) - { - aligned_dst = (long*)dst; - aligned_src = (long*)src; - - /* SRC and DEST are both "long int" aligned, try to do "long int" - sized copies. */ - while (count >= sizeof (long int) && !DETECTNULL(*aligned_src)) - { - count -= sizeof (long int); - *aligned_dst++ = *aligned_src++; - } - - dst = (char*)aligned_dst; - src = (char*)aligned_src; - } - - while (count > 0) - { - --count; - if ((*dst++ = *src++) == '\0') - break; - } - - while (count-- > 0) - *dst++ = '\0'; - - return dst0; -#endif /* not PREFER_SIZE_OVER_SPEED */ -} diff --git a/newlib/libc/string/strndup.c b/newlib/libc/string/strndup.c deleted file mode 100644 index caa1b68b7..000000000 --- a/newlib/libc/string/strndup.c +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef _REENT_ONLY - -#include <_ansi.h> -#include <reent.h> -#include <stdlib.h> -#include <string.h> - -char * -_DEFUN (strndup, (str, n), - _CONST char *str _AND - size_t n) -{ - return _strndup_r (_REENT, str, n); -} - -#endif /* !_REENT_ONLY */ diff --git a/newlib/libc/string/strndup_r.c b/newlib/libc/string/strndup_r.c deleted file mode 100644 index 86d9eec44..000000000 --- a/newlib/libc/string/strndup_r.c +++ /dev/null @@ -1,21 +0,0 @@ -#include <reent.h> -#include <stdlib.h> -#include <string.h> - -#define MIN(a,b) ((a) < (b) ? (a) : (b)) - -char * -_DEFUN (_strndup_r, (reent_ptr, str, n), - struct _reent *reent_ptr _AND - _CONST char *str _AND - size_t n) -{ - size_t len = MIN(strlen (str), n); - char *copy = _malloc_r (reent_ptr, len + 1); - if (copy) - { - memcpy (copy, str, len); - copy[len] = '\0'; - } - return copy; -} diff --git a/newlib/libc/string/strnlen.c b/newlib/libc/string/strnlen.c deleted file mode 100644 index b9a3b5e77..000000000 --- a/newlib/libc/string/strnlen.c +++ /dev/null @@ -1,49 +0,0 @@ -/* -FUNCTION - <<strnlen>>---character string length - -INDEX - strnlen - -ANSI_SYNOPSIS - #include <string.h> - size_t strnlen(const char *<[str]>, size_t <[n]>); - -TRAD_SYNOPSIS - #include <string.h> - size_t strnlen(<[str]>, <[n]>) - char *<[src]>; - size_t <[n]>; - -DESCRIPTION - The <<strnlen>> function works out the length of the string - starting at <<*<[str]>>> by counting chararacters until it - reaches a NUL character or the maximum: <[n]> number of - characters have been inspected. - -RETURNS - <<strnlen>> returns the character count or <[n]>. - -PORTABILITY -<<strnlen>> is a Gnu extension. - -<<strnlen>> requires no supporting OS subroutines. - -*/ - -#undef __STRICT_ANSI__ -#include <_ansi.h> -#include <string.h> - -size_t -_DEFUN (strnlen, (str, n), - _CONST char *str _AND - size_t n) -{ - _CONST char *start = str; - - while (*str && n-- > 0) - str++; - - return str - start; -} diff --git a/newlib/libc/string/strpbrk.c b/newlib/libc/string/strpbrk.c deleted file mode 100644 index e7f2dd2b6..000000000 --- a/newlib/libc/string/strpbrk.c +++ /dev/null @@ -1,58 +0,0 @@ -/* -FUNCTION - <<strpbrk>>---find chars in string - -INDEX - strpbrk - -ANSI_SYNOPSIS - #include <string.h> - char *strpbrk(const char *<[s1]>, const char *<[s2]>); - -TRAD_SYNOPSIS - #include <string.h> - char *strpbrk(<[s1]>, <[s2]>) - char *<[s1]>; - char *<[s2]>; - -DESCRIPTION - This function locates the first occurence in the string - pointed to by <[s1]> of any character in string pointed to by - <[s2]> (excluding the terminating null character). - -RETURNS - <<strpbrk>> returns a pointer to the character found in <[s1]>, or a - null pointer if no character from <[s2]> occurs in <[s1]>. - -PORTABILITY -<<strpbrk>> requires no supporting OS subroutines. -*/ - -#include <string.h> - -char * -_DEFUN (strpbrk, (s1, s2), - _CONST char *s1 _AND - _CONST char *s2) -{ - _CONST char *c = s2; - if (!*s1) - return (char *) NULL; - - while (*s1) - { - for (c = s2; *c; c++) - { - if (*s1 == *c) - break; - } - if (*c) - break; - s1++; - } - - if (*c == '\0') - s1 = NULL; - - return (char *) s1; -} diff --git a/newlib/libc/string/strrchr.c b/newlib/libc/string/strrchr.c deleted file mode 100644 index 36ef3ef2f..000000000 --- a/newlib/libc/string/strrchr.c +++ /dev/null @@ -1,59 +0,0 @@ -/* -FUNCTION - <<strrchr>>---reverse search for character in string - -INDEX - strrchr - -ANSI_SYNOPSIS - #include <string.h> - char * strrchr(const char *<[string]>, int <[c]>); - -TRAD_SYNOPSIS - #include <string.h> - char * strrchr(<[string]>, <[c]>); - char *<[string]>; - int *<[c]>; - -DESCRIPTION - This function finds the last occurence of <[c]> (converted to - a char) in the string pointed to by <[string]> (including the - terminating null character). - -RETURNS - Returns a pointer to the located character, or a null pointer - if <[c]> does not occur in <[string]>. - -PORTABILITY -<<strrchr>> is ANSI C. - -<<strrchr>> requires no supporting OS subroutines. - -QUICKREF - strrchr ansi pure -*/ - -#include <string.h> - -char * -_DEFUN (strrchr, (s, i), - _CONST char *s _AND - int i) -{ - _CONST char *last = NULL; - - if (i) - { - while (s=strchr(s, i)) - { - last = s; - s++; - } - } - else - { - last = strchr(s, i); - } - - return (char *) last; -} diff --git a/newlib/libc/string/strsep.c b/newlib/libc/string/strsep.c deleted file mode 100644 index d3d0ad0a9..000000000 --- a/newlib/libc/string/strsep.c +++ /dev/null @@ -1,19 +0,0 @@ -/* BSD strsep function */ - -/* Copyright 2002, Red Hat Inc. */ - -/* undef STRICT_ANSI so that strsep prototype will be defined */ -#undef __STRICT_ANSI__ -#include <string.h> -#include <_ansi.h> -#include <reent.h> - -extern char *__strtok_r (char *, const char *, char **, int); - -char * -_DEFUN (strsep, (source_ptr, delim), - register char **source_ptr _AND - register const char *delim) -{ - return __strtok_r (*source_ptr, delim, source_ptr, 0); -} diff --git a/newlib/libc/string/strspn.c b/newlib/libc/string/strspn.c deleted file mode 100644 index 32b921b10..000000000 --- a/newlib/libc/string/strspn.c +++ /dev/null @@ -1,59 +0,0 @@ -/* -FUNCTION - <<strspn>>---find initial match - -INDEX - strspn - -ANSI_SYNOPSIS - #include <string.h> - size_t strspn(const char *<[s1]>, const char *<[s2]>); - -TRAD_SYNOPSIS - #include <string.h> - size_t strspn(<[s1]>, <[s2]>) - char *<[s1]>; - char *<[s2]>; - -DESCRIPTION - This function computes the length of the initial segment of - the string pointed to by <[s1]> which consists entirely of - characters from the string pointed to by <[s2]> (excluding the - terminating null character). - -RETURNS - <<strspn>> returns the length of the segment found. - -PORTABILITY -<<strspn>> is ANSI C. - -<<strspn>> requires no supporting OS subroutines. - -QUICKREF - strspn ansi pure -*/ - -#include <string.h> - -size_t -_DEFUN (strspn, (s1, s2), - _CONST char *s1 _AND - _CONST char *s2) -{ - _CONST char *s = s1; - _CONST char *c; - - while (*s1) - { - for (c = s2; *c; c++) - { - if (*s1 == *c) - break; - } - if (*c == '\0') - break; - s1++; - } - - return s1 - s; -} diff --git a/newlib/libc/string/strstr.c b/newlib/libc/string/strstr.c deleted file mode 100644 index dddced3b2..000000000 --- a/newlib/libc/string/strstr.c +++ /dev/null @@ -1,73 +0,0 @@ -/* -FUNCTION - <<strstr>>---find string segment - -INDEX - strstr - -ANSI_SYNOPSIS - #include <string.h> - char *strstr(const char *<[s1]>, const char *<[s2]>); - -TRAD_SYNOPSIS - #include <string.h> - char *strstr(<[s1]>, <[s2]>) - char *<[s1]>; - char *<[s2]>; - -DESCRIPTION - Locates the first occurence in the string pointed to by <[s1]> of - the sequence of characters in the string pointed to by <[s2]> - (excluding the terminating null character). - -RETURNS - Returns a pointer to the located string segment, or a null - pointer if the string <[s2]> is not found. If <[s2]> points to - a string with zero length, the <[s1]> is returned. - -PORTABILITY -<<strstr>> is ANSI C. - -<<strstr>> requires no supporting OS subroutines. - -QUICKREF - strstr ansi pure -*/ - -#include <string.h> - -char * -_DEFUN (strstr, (searchee, lookfor), - _CONST char *searchee _AND - _CONST char *lookfor) -{ - if (*searchee == 0) - { - if (*lookfor) - return (char *) NULL; - return (char *) searchee; - } - - while (*searchee) - { - size_t i; - i = 0; - - while (1) - { - if (lookfor[i] == 0) - { - return (char *) searchee; - } - - if (lookfor[i] != searchee[i]) - { - break; - } - i++; - } - searchee++; - } - - return (char *) NULL; -} diff --git a/newlib/libc/string/strtok.c b/newlib/libc/string/strtok.c deleted file mode 100644 index 8d53290c7..000000000 --- a/newlib/libc/string/strtok.c +++ /dev/null @@ -1,101 +0,0 @@ -/* -FUNCTION - <<strtok>>,<<strtok_r>>,<<strsep>>---get next token from a string - -INDEX - strtok - -INDEX - strtok_r - -INDEX - strsep - -ANSI_SYNOPSIS - #include <string.h> - char *strtok(char *<[source]>, const char *<[delimiters]>) - char *strtok_r(char *<[source]>, const char *<[delimiters]>, - char **<[lasts]>) - char *strsep(char **<[source_ptr]>, const char *<[delimiters]>) - -TRAD_SYNOPSIS - #include <string.h> - char *strtok(<[source]>, <[delimiters]>) - char *<[source]>; - char *<[delimiters]>; - - char *strtok_r(<[source]>, <[delimiters]>, <[lasts]>) - char *<[source]>; - char *<[delimiters]>; - char **<[lasts]>; - - char *strsep(<[source_ptr]>, <[delimiters]>) - char **<[source_ptr]>; - char *<[delimiters]>; - -DESCRIPTION - The <<strtok>> function is used to isolate sequential tokens in a - null-terminated string, <<*<[source]>>>. These tokens are delimited - in the string by at least one of the characters in <<*<[delimiters]>>>. - The first time that <<strtok>> is called, <<*<[source]>>> should be - specified; subsequent calls, wishing to obtain further tokens from - the same string, should pass a null pointer instead. The separator - string, <<*<[delimiters]>>>, must be supplied each time, and may - change between calls. - - The <<strtok>> function returns a pointer to the beginning of each - subsequent token in the string, after replacing the separator - character itself with a NUL character. When no more tokens remain, - a null pointer is returned. - - The <<strtok_r>> function has the same behavior as <<strtok>>, except - a pointer to placeholder <<*[lasts]>> must be supplied by the caller. - - The <<strsep>> function is similar in behavior to <<strtok>>, except - a pointer to the string pointer must be supplied <<[source_ptr]>> and - the function does not skip leading delimeters. When the string starts - with a delimeter, the delimeter is changed to the NUL character and - the empty string is returned. Like <<strtok_r>> and <<strtok>>, the - <<*[source_ptr]>> is updated to the next character following the - last delimeter found or NULL if the end of string is reached with - no more delimeters. - -RETURNS - <<strtok>>, <<strtok_r>>, and <<strsep>> all return a pointer to the - next token, or <<NULL>> if no more tokens can be found. For - <<strsep>>, a token may be the empty string. - -NOTES - <<strtok>> is unsafe for multi-thread applications. <<strtok_r>> - and <<strsep>> are MT-Safe and should be used instead. - -PORTABILITY -<<strtok>> is ANSI C. -<<strtok_r>> is POSIX. -<<strsep>> is a BSD-extension. - -<<strtok>>, <<strtok_r>>, and <<strsep>> require no supporting OS subroutines. - -QUICKREF - strtok ansi impure -*/ - -/* undef STRICT_ANSI so that strtok_r prototype will be defined */ -#undef __STRICT_ANSI__ -#include <string.h> -#include <_ansi.h> -#include <reent.h> - -#ifndef _REENT_ONLY - -extern char *__strtok_r (char *, const char *, char **, int); - -char * -_DEFUN (strtok, (s, delim), - register char *s _AND - register const char *delim) -{ - _REENT_CHECK_MISC(_REENT); - return __strtok_r (s, delim, &(_REENT_STRTOK_LAST(_REENT)), 1); -} -#endif diff --git a/newlib/libc/string/strtok_r.c b/newlib/libc/string/strtok_r.c deleted file mode 100644 index 02ad80b9b..000000000 --- a/newlib/libc/string/strtok_r.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 1988 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <string.h> - -char * -_DEFUN (__strtok_r, (s, delim, lasts, skip_leading_delim), - register char *s _AND - register const char *delim _AND - char **lasts _AND - int skip_leading_delim) -{ - register char *spanp; - register int c, sc; - char *tok; - - - if (s == NULL && (s = *lasts) == NULL) - return (NULL); - - /* - * Skip (span) leading delimiters (s += strspn(s, delim), sort of). - */ -cont: - c = *s++; - for (spanp = (char *)delim; (sc = *spanp++) != 0;) { - if (c == sc) { - if (skip_leading_delim) { - goto cont; - } - else { - *lasts = s; - s[-1] = 0; - return (s - 1); - } - } - } - - if (c == 0) { /* no non-delimiter characters */ - *lasts = NULL; - return (NULL); - } - tok = s - 1; - - /* - * Scan token (scan for delimiters: s += strcspn(s, delim), sort of). - * Note that delim must have one NUL; we stop if we see that, too. - */ - for (;;) { - c = *s++; - spanp = (char *)delim; - do { - if ((sc = *spanp++) == c) { - if (c == 0) - s = NULL; - else - s[-1] = 0; - *lasts = s; - return (tok); - } - } while (sc != 0); - } - /* NOTREACHED */ -} - -char * -_DEFUN (strtok_r, (s, delim, lasts), - register char *s _AND - register const char *delim _AND - char **lasts) -{ - return __strtok_r (s, delim, lasts, 1); -} diff --git a/newlib/libc/string/strupr.c b/newlib/libc/string/strupr.c deleted file mode 100644 index d7f7c129d..000000000 --- a/newlib/libc/string/strupr.c +++ /dev/null @@ -1,49 +0,0 @@ -/* -FUNCTION - <<strupr>>---force string to uppercase - -INDEX - strupr - -ANSI_SYNOPSIS - #include <string.h> - char *strupr(char *<[a]>); - -TRAD_SYNOPSIS - #include <string.h> - char *strupr(<[a]>) - char *<[a]>; - -DESCRIPTION - <<strupr>> converts each characters in the string at <[a]> to - upper case. - -RETURNS - <<strupr>> returns its argument, <[a]>. - -PORTABILITY -<<strupr>> is not widely portable. - -<<strupr>> requires no supporting OS subroutines. - -QUICKREF - strupr */ - -#include <string.h> -#include <ctype.h> - -char * -strupr (a) - char *a; -{ - char *ret = a; - - while (*a != '\0') - { - if (islower (*a)) - *a = toupper (*a); - ++a; - } - - return ret; -} diff --git a/newlib/libc/string/strxfrm.c b/newlib/libc/string/strxfrm.c deleted file mode 100644 index 65ed4f1b1..000000000 --- a/newlib/libc/string/strxfrm.c +++ /dev/null @@ -1,75 +0,0 @@ -/* -FUNCTION - <<strxfrm>>---transform string - -INDEX - strxfrm - -ANSI_SYNOPSIS - #include <string.h> - size_t strxfrm(char *<[s1]>, const char *<[s2]>, size_t <[n]>); - -TRAD_SYNOPSIS - #include <string.h> - size_t strxfrm(<[s1]>, <[s2]>, <[n]>); - char *<[s1]>; - char *<[s2]>; - size_t <[n]>; - -DESCRIPTION - This function transforms the string pointed to by <[s2]> and - places the resulting string into the array pointed to by - <[s1]>. The transformation is such that if the <<strcmp>> - function is applied to the two transformed strings, it returns - a value greater than, equal to, or less than zero, - correspoinding to the result of a <<strcoll>> function applied - to the same two original strings. - - No more than <[n]> characters are placed into the resulting - array pointed to by <[s1]>, including the terminating null - character. If <[n]> is zero, <[s1]> may be a null pointer. If - copying takes place between objects that overlap, the behavior - is undefined. - - With a C locale, this function just copies. - -RETURNS - The <<strxfrm>> function returns the length of the transformed string - (not including the terminating null character). If the value returned - is <[n]> or more, the contents of the array pointed to by - <[s1]> are indeterminate. - -PORTABILITY -<<strxfrm>> is ANSI C. - -<<strxfrm>> requires no supporting OS subroutines. - -QUICKREF - strxfrm ansi pure -*/ - -#include <string.h> - -size_t -_DEFUN (strxfrm, (s1, s2, n), - char *s1 _AND - _CONST char *s2 _AND - size_t n) -{ - size_t res; - res = 0; - while (n-- > 0) - { - if ((*s1++ = *s2++) != '\0') - ++res; - else - return res; - } - while (*s2) - { - ++s2; - ++res; - } - - return res; -} diff --git a/newlib/libc/string/swab.c b/newlib/libc/string/swab.c deleted file mode 100644 index aee076319..000000000 --- a/newlib/libc/string/swab.c +++ /dev/null @@ -1,44 +0,0 @@ -/* -FUNCTION - <<swab>>---swap adjacent bytes - -ANSI_SYNOPSIS - #include <unistd.h> - void swab(const void *<[in]>, void *<[out]>, ssize_t <[n]>); - -TRAD_SYNOPSIS - void swab(<[in]>, <[out]>, <[n]> - void *<[in]>; - void *<[out]>; - ssize_t <[n]>; - -DESCRIPTION - This function copies <[n]> bytes from the memory region - pointed to by <[in]> to the memory region pointed to by - <[out]>, exchanging adjacent even and odd bytes. - -PORTABILITY -<<swab>> requires no supporting OS subroutines. -*/ - -#include <unistd.h> - -void -_DEFUN (swab, (b1, b2, length), - _CONST void *b1 _AND - void *b2 _AND - ssize_t length) -{ - const char *from = b1; - char *to = b2; - ssize_t ptr; - for (ptr = 1; ptr < length; ptr += 2) - { - char p = from[ptr]; - char q = from[ptr-1]; - to[ptr-1] = p; - to[ptr ] = q; - } - if (ptr == length) /* I.e., if length is odd, */ - to[ptr-1] = 0; /* then pad with a NUL. */ -} diff --git a/newlib/libc/string/u_strerr.c b/newlib/libc/string/u_strerr.c deleted file mode 100644 index fa4605c8b..000000000 --- a/newlib/libc/string/u_strerr.c +++ /dev/null @@ -1,8 +0,0 @@ -#include <_ansi.h> - -char * -_DEFUN(_user_strerror, (errnum), - int errnum) -{ - return 0; -} diff --git a/newlib/libc/string/wcscat.c b/newlib/libc/string/wcscat.c deleted file mode 100644 index b3a3bd987..000000000 --- a/newlib/libc/string/wcscat.c +++ /dev/null @@ -1,84 +0,0 @@ -/* -FUNCTION - <<wcscat>>---concatenate two wide-character strings -INDEX - wcscat - -ANSI_SYNOPSIS - #include <wchar.h> - wchar_t *wcscat(wchar_t *<[s1]>, const wchar_t *<[s2]>); - -TRAD_SYNOPSIS - wchar_t *wcscat(<[s1]>, <[s2]> - wchar_t *<[s1]>; - const wchar_t *<[s2]>; - -DESCRIPTION - The <<wcscat>> function appends a copy of the wide-character string - pointed to by <[s2]> (including the terminating null wide-character - code) to the end of the wide-character string pointed to by <[s1]>. - The initial wide-character code of <[s2]> overwrites the null - wide-character code at the end of <[s1]>. If copying takes place between - objects that overlap, the behaviour is undefined. - -RETURNS - The <<wcscat>> function returns <[s1]>; - no return value is reserved to indicate an error. - -PORTABILITY -<<wcscat>> is ISO/IEC 9899/AMD1:1995 (ISO C). -No supporting OS subroutines are required. -*/ - -/* $NetBSD: wcscat.c,v 1.1 2000/12/23 23:14:36 itojun Exp $ */ - -/*- - * Copyright (c)1999 Citrus Project, - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * citrus Id: wcscat.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp - */ - -#include <_ansi.h> -#include <wchar.h> - -wchar_t * -_DEFUN (wcscat, (s1, s2), - wchar_t * s1 _AND - _CONST wchar_t * s2) -{ - wchar_t *p; - wchar_t *q; - _CONST wchar_t *r; - - p = s1; - while (*p) - p++; - q = p; - r = s2; - while (*r) - *q++ = *r++; - *q = '\0'; - return s1; -} diff --git a/newlib/libc/string/wcschr.c b/newlib/libc/string/wcschr.c deleted file mode 100644 index fa213c90b..000000000 --- a/newlib/libc/string/wcschr.c +++ /dev/null @@ -1,82 +0,0 @@ -/* -FUNCTION - <<wcschr>>---wide-character string scanning operation - -ANSI_SYNOPSIS - #include <wchar.h> - wchar_t *wcschr(const wchar_t *<[s]>, wchar_t <[c]>); - -TRAD_SYNOPSIS - wchar_t *wcschr(<[s]>, <[c]> - const wchar_t *<[s]>; - wchar_t <[c]>; - -DESCRIPTION - The <<wcschr>> function locates the first occurrence of <[c]> in the - wide-character string pointed to by <[s]>. The value of <[c]> must be a - character representable as a type wchar_t and must be a wide-character - code corresponding to a valid character in the current locale. - The terminating null wide-character string. - -RETURNS - Upon completion, <<wcschr>> returns a pointer to the wide-character - code, or a null pointer if the wide-character code is not found. - -PORTABILITY -<<wcschr>> is ISO/IEC 9899/AMD1:1995 (ISO C). -No supporting OS subroutines are required. -*/ - -/* $NetBSD: wcschr.c,v 1.1 2000/12/23 23:14:36 itojun Exp $ */ - -/*- - * Copyright (c)1999 Citrus Project, - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * citrus Id: wcschr.c,v 1.2 2000/12/21 05:07:25 itojun Exp - */ - -#include <_ansi.h> -#include <stddef.h> -#include <wchar.h> - -wchar_t * -_DEFUN (wcschr, (s, c), - _CONST wchar_t * s _AND - wchar_t c) -{ - _CONST wchar_t *p; - - p = s; - while (*p) - { - if (*p == c) - { - /* LINTED interface specification */ - return (wchar_t *) p; - } - p++; - } - return NULL; -} diff --git a/newlib/libc/string/wcscmp.c b/newlib/libc/string/wcscmp.c deleted file mode 100644 index 279f3a90c..000000000 --- a/newlib/libc/string/wcscmp.c +++ /dev/null @@ -1,82 +0,0 @@ -/* -FUNCTION - <<wcscmp>>---compare two wide-character strings - -ANSI_SYNOPSIS - #include <wchar.h> - int wcscmp(const wchar_t *<[s1]>, *<[s2]>); - -TRAD_SYNOPSIS - int wcscmp(<[s1]>, <[s2]> - const wchar_t *<[s1]>, <[s2]>; - -DESCRIPTION - The <<wcscmp>> function compares the wide-character string pointed to - by <[s1]> to the wide-character string pointed to by <[s2]>. - - The sign of a non-zero return value is determined by the sign of the - difference between the values of the first pair of wide-character codes - that differ in the objects being compared. - -RETURNS - Upon completion, <<wcscmp>> returns an integer greater than, equal to - or less than 0, if the wide-character string pointed to by <[s1]> is - greater than, equal to or less than the wide-character string pointed - to by <[s2]> respectively. - -PORTABILITY -<<wcscmp>> is ISO/IEC 9899/AMD1:1995 (ISO C). -No supporting OS subroutines are required. -*/ - -/* $NetBSD$ */ - -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Chris Torek. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <_ansi.h> -#include <wchar.h> - -/* - * Compare strings. - */ -int -_DEFUN (wcscmp, (s1, s2), - _CONST wchar_t * s1 _AND - _CONST wchar_t * s2) -{ - - while (*s1 == *s2++) - if (*s1++ == 0) - return (0); - return (*s1 - *--s2); -} diff --git a/newlib/libc/string/wcscpy.c b/newlib/libc/string/wcscpy.c deleted file mode 100644 index 5a72338ce..000000000 --- a/newlib/libc/string/wcscpy.c +++ /dev/null @@ -1,78 +0,0 @@ -/* -FUNCTION - <<wcscpy>>---copy a wide-character string - -ANSI_SYNOPSIS - #include <wchar.h> - wchar_t *wcscpy(wchar_t *<[s1]>, const wchar_t *,<[s2]>); - -TRAD_SYNOPSIS - wchar_t *wcscpy(<[s1]>, <[s2]> - wchar_t *<[s1]>; - const wchar_t *<[s2]>; - -DESCRIPTION - The <<wcscpy>> function copies the wide-character string pointed to by - <[s2]> (including the terminating null wide-character code) into the - array pointed to by <[s1]>. If copying takes place between objects that - overlap, the behaviour is undefined. - -RETURNS - The <<wcscpy>> function returns <[s1]>; no return value is reserved to - indicate an error. - -PORTABILITY -<<wcscpy>> is ISO/IEC 9899/AMD1:1995 (ISO C). -No supporting OS subroutines are required. -*/ - -/* $NetBSD: wcscpy.c,v 1.1 2000/12/23 23:14:36 itojun Exp $ */ - -/*- - * Copyright (c)1999 Citrus Project, - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * citrus Id: wcscpy.c,v 1.2 2000/12/21 04:51:09 itojun Exp - */ - -#include <_ansi.h> -#include <wchar.h> - -wchar_t * -_DEFUN (wcscpy, (s1, s2), - wchar_t * s1 _AND - _CONST wchar_t * s2) -{ - wchar_t *p; - _CONST wchar_t *q; - - *s1 = '\0'; - p = s1; - q = s2; - while (*q) - *p++ = *q++; - *p = '\0'; - - return s1; -} diff --git a/newlib/libc/string/wcscspn.c b/newlib/libc/string/wcscspn.c deleted file mode 100644 index 7e53cc15d..000000000 --- a/newlib/libc/string/wcscspn.c +++ /dev/null @@ -1,85 +0,0 @@ -/* -FUNCTION - <<wcscspn>>---get length of a complementary wide substring - -ANSI_SYNOPSIS - #include <wchar.h> - size_t wcscspn(const wchar_t *<[s]>, wchar_t *<[set]>); - -TRAD_SYNOPSIS - size_t wcscspn(<[s]>, <[set]> - const wchar_t *<[s]>; - const wchar_t *<[set]>; - -DESCRIPTION - The <<wcscspn>> function computes the length of the maximum initial - segment of the wide-character string pointed to by <[s]> which consists - entirely of wide-character codes not from the wide-character string - pointed to by <[set]>. - -RETURNS - The <<wcscspn>> function returns the length of the initial substring of - <[s1]>; no return value is reserved to indicate an error. - -PORTABILITY -<<wcscspn>> is ISO/IEC 9899/AMD1:1995 (ISO C). -No supporting OS subroutines are required. -*/ - -/* $NetBSD: wcscspn.c,v 1.1 2000/12/23 23:14:36 itojun Exp $ */ - -/*- - * Copyright (c)1999 Citrus Project, - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * citrus Id: wcscspn.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp - */ - -#include <_ansi.h> -#include <wchar.h> - -size_t -_DEFUN (wcscspn, (s, set), - _CONST wchar_t * s _AND - _CONST wchar_t * set) -{ - _CONST wchar_t *p; - _CONST wchar_t *q; - - p = s; - while (*p) - { - q = set; - while (*q) - { - if (*p == *q) - goto done; - q++; - } - p++; - } - -done: - return (p - s); -} diff --git a/newlib/libc/string/wcslcat.c b/newlib/libc/string/wcslcat.c deleted file mode 100644 index adf683ad5..000000000 --- a/newlib/libc/string/wcslcat.c +++ /dev/null @@ -1,108 +0,0 @@ -/* -FUNCTION - <<wcslcat>>---concatenate wide-character strings to specified length - -ANSI_SYNOPSIS - #include <wchar.h> - size_t wcslcat(wchar_t *<[dst]>, const wchar_t *<[src]>, size_t <[siz]>); - -TRAD_SYNOPSIS - #include <wchar.h> - size_t wcslcat(<[dst]>, <[src]>, <[siz]> - wchar_t *<[dst]>; - const wchar_t *<[src]>; - size_t <[siz]>; - -DESCRIPTION - The <<wcslcat>> function appends wide-characters from <[src]> to - end of the <[dst]> wide-character string so that the resultant - wide-character string is not more than <[siz]> wide-characters - including terminating null wide-character code. A terminating - null wide-character is always added unless <[siz]> is 0. Thus, - the maximum number of wide-characters that can be appended from - <[src]> is <[siz]> - 1. If copying takes place between objects - that overlap, the behaviour is undefined. - -RETURNS - Wide-character string length of initial <[dst]> plus the - wide-character string length of <[src]> (does not include - terminating null wide-characters). If the return value is - greater than or equal to <[siz]>, then truncation occurred and - not all wide-characters from <[src]> were appended. - -PORTABILITY -No supporting OS subroutines are required. -*/ - -/* $NetBSD: wcslcat.c,v 1.1 2000/12/23 23:14:36 itojun Exp $ */ -/* from OpenBSD: strlcat.c,v 1.3 2000/11/24 11:10:02 itojun Exp */ - -/* - * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <_ansi.h> -#include <wchar.h> - -/* - * Appends src to string dst of size siz (unlike wcsncat, siz is the - * full size of dst, not space left). At most siz-1 characters - * will be copied. Always NUL terminates (unless siz == 0). - * Returns wcslen(initial dst) + wcslen(src); if retval >= siz, - * truncation occurred. - */ -size_t -_DEFUN (wcslcat, (dst, src, siz), - wchar_t * dst _AND - _CONST wchar_t * src _AND - size_t siz) -{ - wchar_t *d = dst; - _CONST wchar_t *s = src; - size_t n = siz; - size_t dlen; - - /* Find the end of dst and adjust bytes left but don't go past end */ - while (*d != '\0' && n-- != 0) - d++; - dlen = d - dst; - n = siz - dlen; - - if (n == 0) - return (dlen + wcslen (s)); - while (*s != '\0') - { - if (n != 1) - { - *d++ = *s; - n--; - } - s++; - } - *d = '\0'; - - return (dlen + (s - src)); /* count does not include NUL */ -} diff --git a/newlib/libc/string/wcslcpy.c b/newlib/libc/string/wcslcpy.c deleted file mode 100644 index ac7d01863..000000000 --- a/newlib/libc/string/wcslcpy.c +++ /dev/null @@ -1,102 +0,0 @@ -/* -FUNCTION - <<wcslcpy>>---copy a wide-character string to specified length - -ANSI_SYNOPSIS - #include <wchar.h> - size_t wcslcpy(wchar_t *<[dst]>, const wchar_t *<[src]>, size_t <[siz]>); - -TRAD_SYNOPSIS - #include <wchar.h> - size_t wcslcpy(<[dst]>, <[src]>, <[siz]>) - wchar_t *<[dst]>; - const wchar_t *<[src]>; - size_t <[siz]>; - -DESCRIPTION - <<wcslcpy>> copies wide-characters from <[src]> to <[dst]> - such that up to <[siz]> - 1 characters are copied. A - terminating null is appended to the result, unless <[siz]> - is zero. - -RETURNS - <<wcslcpy>> returns the number of wide-characters in <[src]>, - not including the terminating null wide-character. If the - return value is greater than or equal to <[siz]>, then - not all wide-characters were copied from <[src]> and truncation - occurred. - -PORTABILITY -No supporting OS subroutines are required. -*/ - -/* $NetBSD: wcslcpy.c,v 1.1 2000/12/23 23:14:36 itojun Exp $ */ -/* from OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp */ - -/* - * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <_ansi.h> -#include <wchar.h> - -/* - * Copy src to string dst of size siz. At most siz-1 characters - * will be copied. Always NUL terminates (unless siz == 0). - * Returns wcslen(src); if retval >= siz, truncation occurred. - */ -size_t -_DEFUN (wcslcpy, (dst, src, siz), - wchar_t * dst _AND - _CONST wchar_t * src _AND - size_t siz) -{ - wchar_t *d = dst; - _CONST wchar_t *s = src; - size_t n = siz; - - /* Copy as many bytes as will fit */ - if (n != 0 && --n != 0) - { - do - { - if ((*d++ = *s++) == 0) - break; - } - while (--n != 0); - } - - /* Not enough room in dst, add NUL and traverse rest of src */ - if (n == 0) - { - if (siz != 0) - *d = '\0'; /* NUL-terminate dst */ - while (*s++) - ; - } - - return (s - src - 1); /* count does not include NUL */ -} diff --git a/newlib/libc/string/wcslen.c b/newlib/libc/string/wcslen.c deleted file mode 100644 index d68f00a72..000000000 --- a/newlib/libc/string/wcslen.c +++ /dev/null @@ -1,71 +0,0 @@ -/* -FUNCTION - <<wcslen>>---get wide-character string length - -ANSI_SYNOPSIS - #include <wchar.h> - size_t wcslen(const wchar_t *<[s]>); - -TRAD_SYNOPSIS - size_t wcslen(<[s]> - const wchar_t *<[s]>; - -DESCRIPTION - The <<wcslen>> function computes the number of wide-character codes - in the wide-character string to which <[s]> points, not including the - terminating null wide-character code. - -RETURNS - The <<wcslen>> function returns the length of <[s]>; no return value is - reserved to indicate an error. - -PORTABILITY -<<wcslen>> is ISO/IEC 9899/AMD1:1995 (ISO C). -No supporting OS subroutines are required. -*/ - -/* $NetBSD: wcslen.c,v 1.1 2000/12/23 23:14:36 itojun Exp $ */ - -/*- - * Copyright (c)1999 Citrus Project, - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * citrus Id: wcslen.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp - */ - -#include <_ansi.h> -#include <wchar.h> - -size_t -_DEFUN (wcslen, (s), - _CONST wchar_t * s) -{ - _CONST wchar_t *p; - - p = s; - while (*p) - p++; - - return p - s; -} diff --git a/newlib/libc/string/wcsncat.c b/newlib/libc/string/wcsncat.c deleted file mode 100644 index 2ba293497..000000000 --- a/newlib/libc/string/wcsncat.c +++ /dev/null @@ -1,90 +0,0 @@ -/* -FUNCTION - <<wcsncat>>---concatenate part of two wide-character strings - -ANSI_SYNOPSIS - #include <wchar.h> - wchar_t *wcsncat(wchar_t *<[s1]>, const wchar_t *<[s2]>, size_t <[n]>); - -TRAD_SYNOPSIS - wchar_t *wcsncat(<[s1]>, <[s2]>, <[n]> - wchar_t *<[s1]>; - const wchar_t *<[s2]>; - size_t <[n]>; - -DESCRIPTION - The <<wcsncat>> function appends not more than <[n]> wide-character - codes (a null wide-character code and wide-character codes that follow - it are not appended) from the array pointed to by <[s2]> to the end of - the wide-character string pointed to by <[s1]>. The initial - wide-character code of <[s2]> overwrites the null wide-character code - at the end of <[s1]>. - A terminating null wide-character code is always appended to the result. - If copying takes place between objects that overlap, the behaviour is - undefined. - -RETURNS - The <<wcsncat>> function returns <[s1]>; no return value is reserved to - indicate an error. - -PORTABILITY -<<wcsncat>> is ISO/IEC 9899/AMD1:1995 (ISO C). -No supporting OS subroutines are required. -*/ - -/* $NetBSD: wcsncat.c,v 1.1 2000/12/23 23:14:36 itojun Exp $ */ - -/*- - * Copyright (c)1999 Citrus Project, - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * citrus Id: wcsncat.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp - */ - -#include <_ansi.h> -#include <wchar.h> - -wchar_t * -_DEFUN (wcsncat, (s1, s2, n), - wchar_t * s1 _AND - _CONST wchar_t * s2 _AND - size_t n) -{ - wchar_t *p; - wchar_t *q; - _CONST wchar_t *r; - - p = s1; - while (*p) - p++; - q = p; - r = s2; - while (*r && n) - { - *q++ = *r++; - n--; - } - *q = '\0'; - return s1; -} diff --git a/newlib/libc/string/wcsncmp.c b/newlib/libc/string/wcsncmp.c deleted file mode 100644 index 48cb96c25..000000000 --- a/newlib/libc/string/wcsncmp.c +++ /dev/null @@ -1,90 +0,0 @@ -/* -FUNCTION - <<wcsncmp>>---compare part of two wide-character strings - -ANSI_SYNOPSIS - #include <wchar.h> - int wcsncmp(const wchar_t *<[s1]>, const wchar_t *<[s2]>, size_t <[n]>); - -TRAD_SYNOPSIS - int wcsncmp(<[s1]>, <[s2]>, <[n]> - const wchar_t *<[s1]>; - const wchar_t *<[s2]>; - size_t <[n]>; - -DESCRIPTION - The <<wcsncmp>> function compares not more than <[n]> wide-character - codes (wide-character codes that follow a null wide-character code are - not compared) from the array pointed to by <[s1]> to the array pointed - to by <[s2]>. - - The sign of a non-zero return value is determined by the sign of the - difference between the values of the first pair of wide-character codes - that differ in the objects being compared. - -RETURNS - Upon successful completion, <<wcsncmp>> returns an integer greater than, - equal to or less than 0, if the possibly null-terminated array pointed - to by <[s1]> is greater than, equal to or less than the possibly - null-terminated array pointed to by <[s2]> respectively. - -PORTABILITY -<<wcsncmp>> is ISO/IEC 9899/AMD1:1995 (ISO C). -No supporting OS subroutines are required. -*/ - -/* $NetBSD$ */ - -/* - * Copyright (c) 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <_ansi.h> -#include <wchar.h> - -int -_DEFUN (wcsncmp, (s1, s2, n), - _CONST wchar_t * s1 _AND - _CONST wchar_t * s2 _AND - size_t n) -{ - - if (n == 0) - return (0); - do - { - if (*s1 != *s2++) - { - return (*s1 - *--s2); - } - if (*s1++ == 0) - break; - } - while (--n != 0); - return (0); -} diff --git a/newlib/libc/string/wcsncpy.c b/newlib/libc/string/wcsncpy.c deleted file mode 100644 index afe75a238..000000000 --- a/newlib/libc/string/wcsncpy.c +++ /dev/null @@ -1,89 +0,0 @@ -/* -FUNCTION - <<wcsncpy>>---copy part of a wide-character string - -ANSI_SYNOPSIS - #include <wchar.h> - wchar_t *wcsncpy(wchar_t *<[s1]>, const wchar_t *<[s2]>, size_t <[n]>); - -TRAD_SYNOPSIS - wchar_t *wcsncpy(<[s1]>, <[s2]>, <[n]> - wchar_t *<[s1]>; - const wchar_t *<[s2]>; - size_t <[n]>; - -DESCRIPTION - The <<wcsncpy>> function copies not more than n wide-character codes - (wide-character codes that follow a null wide-character code are not - copied) from the array pointed to by <[s2]> to the array pointed to - by <[s1]>. If copying takes place between objects that overlap, the - behaviour is undefined. - - If the array pointed to by <[s2]> is a wide-character string that is - shorter than <[n]> wide-character codes, null wide-character codes are - appended to the copy in the array pointed to by <[s1]>, until <[n]> - wide-character codes in all are written. - -RETURNS - The <<wcsncpy>> function returns <[s1]>; no return value is reserved to - indicate an error. - -PORTABILITY -<<wcsncpy>> is ISO/IEC 9899/AMD1:1995 (ISO C). -No supporting OS subroutines are required. -*/ - -/* $NetBSD: wcsncpy.c,v 1.1 2000/12/23 23:14:36 itojun Exp $ */ - -/*- - * Copyright (c)1999 Citrus Project, - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * citrus Id: wcsncpy.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp - */ - -#include <_ansi.h> -#include <wchar.h> - -wchar_t * -_DEFUN (wcsncpy, (s1, s2, n), - wchar_t * s1 _AND - _CONST wchar_t * s2 _AND - size_t n) -{ - wchar_t *p; - _CONST wchar_t *q; - - *s1 = '\0'; - p = s1; - q = s2; - while (n && *q) - { - *p++ = *q++; - n--; - } - *p = '\0'; - - return s1; -} diff --git a/newlib/libc/string/wcspbrk.c b/newlib/libc/string/wcspbrk.c deleted file mode 100644 index bfe793b15..000000000 --- a/newlib/libc/string/wcspbrk.c +++ /dev/null @@ -1,87 +0,0 @@ -/* -FUNCTION - <<wcspbrk>>----scan wide-character string for a wide-character code - -ANSI_SYNOPSIS - #include <wchar.h> - wchar_t *wcspbrk(const wchar_t *<[s]>, const wchar_t *<[set]>); - -TRAD_SYNOPSIS - wchar_t *wcspbrk(<[s]>, <[set]> - const wchar_t *<[s]>; - const wchar_t *<[set]>; - -DESCRIPTION - The <<wcspbrk>> function locates the first occurrence in the - wide-character string pointed to by <[s]> of any wide-character code - from the wide-character string pointed to by <[set]>. - -RETURNS - Upon successful completion, <<wcspbrk>> returns a pointer to the - wide-character code or a null pointer if no wide-character code from - <[set]> occurs in <[s]>. - -PORTABILITY -<<wcspbrk>> is ISO/IEC 9899/AMD1:1995 (ISO C). -No supporting OS subroutines are required. -*/ - -/* $NetBSD: wcspbrk.c,v 1.1 2000/12/23 23:14:37 itojun Exp $ */ - -/*- - * Copyright (c)1999 Citrus Project, - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * citrus Id: wcspbrk.c,v 1.2 2000/12/21 05:07:25 itojun Exp - */ - -#include <_ansi.h> -#include <stddef.h> -#include <wchar.h> - -wchar_t * -_DEFUN (wcspbrk, (s, set), - _CONST wchar_t * s _AND - _CONST wchar_t * set) -{ - _CONST wchar_t *p; - _CONST wchar_t *q; - - p = s; - while (*p) - { - q = set; - while (*q) - { - if (*p == *q) - { - /* LINTED interface specification */ - return (wchar_t *) p; - } - q++; - } - p++; - } - return NULL; -} diff --git a/newlib/libc/string/wcsrchr.c b/newlib/libc/string/wcsrchr.c deleted file mode 100644 index d3dc7431e..000000000 --- a/newlib/libc/string/wcsrchr.c +++ /dev/null @@ -1,87 +0,0 @@ -/* -FUNCTION - <<wcsrchr>>---wide-character string scanning operation - -ANSI_SYNOPSIS - #include <wchar.h> - wchar_t *wcsrchr(const wchar_t *<[s]>, wchar_t <[c]>); - -TRAD_SYNOPSIS - #include <wchar.h> - wchar_t *wcsrchr(<[s]>, <[c]> - const wchar_t *<[s]>; - wchar_t <[c]>; - -DESCRIPTION - The <<wcsrchr>> function locates the last occurrence of <[c]> in the - wide-character string pointed to by <[s]>. The value of <[c]> must be a - character representable as a type wchar_t and must be a wide-character - code corresponding to a valid character in the current locale. - The terminating null wide-character code is considered to be part of - the wide-character string. - -RETURNS - Upon successful completion, <<wcsrchr>> returns a pointer to the - wide-character code or a null pointer if <[c]> does not occur in the - wide-character string. - -PORTABILITY -<<wcsrchr>> is ISO/IEC 9899/AMD1:1995 (ISO C). -No supporting OS subroutines are required. -*/ - -/* $NetBSD: wcsrchr.c,v 1.1 2000/12/23 23:14:37 itojun Exp $ */ - -/*- - * Copyright (c)1999 Citrus Project, - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * citrus Id: wcsrchr.c,v 1.2 2000/12/21 05:07:25 itojun Exp - */ - -#include <_ansi.h> -#include <stddef.h> -#include <wchar.h> - -wchar_t * -_DEFUN (wcsrchr, (s, c), - _CONST wchar_t * s _AND - wchar_t c) -{ - _CONST wchar_t *p; - - p = s; - while (*p) - p++; - while (s <= p) - { - if (*p == c) - { - /* LINTED interface specification */ - return (wchar_t *) p; - } - p--; - } - return NULL; -} diff --git a/newlib/libc/string/wcsspn.c b/newlib/libc/string/wcsspn.c deleted file mode 100644 index f0b2fb99f..000000000 --- a/newlib/libc/string/wcsspn.c +++ /dev/null @@ -1,86 +0,0 @@ -/* -FUNCTION - <<wcsspn>>---get length of a wide substring - -ANSI_SYNOPSIS - #include <wchar.h> - size_t wcsspn(const wchar_t *<[s]>, const wchar_t *<[set]>); - -TRAD_SYNOPSIS - size_t wcsspn(<[s]>, <[set]> - const wchar_t *<[s]>; - const wchar_t *<[set]>; - -DESCRIPTION - The <<wcsspn>> function computes the length of the maximum initial - segment of the wide-character string pointed to by <[s]> which consists - entirely of wide-character codes from the wide-character string - pointed to by <[set]>. - -RETURNS - The wcsspn() function returns the length <[s1]>; no return value is - reserved to indicate an error. - -PORTABILITY -<<wcsspn>> is ISO/IEC 9899/AMD1:1995 (ISO C). -No supporting OS subroutines are required. -*/ - -/* $NetBSD: wcsspn.c,v 1.1 2000/12/23 23:14:37 itojun Exp $ */ - -/*- - * Copyright (c)1999 Citrus Project, - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * citrus Id: wcsspn.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp - */ - -#include <_ansi.h> -#include <wchar.h> - -size_t -_DEFUN (wcsspn, (s, set), - _CONST wchar_t * s _AND - _CONST wchar_t * set) -{ - _CONST wchar_t *p; - _CONST wchar_t *q; - - p = s; - while (*p) - { - q = set; - while (*q) - { - if (*p == *q) - break; - } - if (!*q) - goto done; - p++; - } - -done: - return (p - s); -} diff --git a/newlib/libc/string/wcsstr.c b/newlib/libc/string/wcsstr.c deleted file mode 100644 index 30fc4631f..000000000 --- a/newlib/libc/string/wcsstr.c +++ /dev/null @@ -1,105 +0,0 @@ -/* -FUNCTION - <<wcsstr>>---find a wide-character substring - -ANSI_SYNOPSIS - #include <wchar.h> - wchar_t *wcsstr(const wchar_t *<[big]>, const wchar_t *<[little]>); - -TRAD_SYNOPSIS - wchar_t *wcsstr(<[big]>, <[little]> - const wchar_t *<[big]>; - const wchar_t *<[little]>; - -DESCRIPTION - The <<wcsstr>> function locates the first occurrence in the - wide-character string pointed to by <[big]> of the sequence of - wide-characters (excluding the terminating null wide-character) in the - wide-character string pointed to by <[little]>. - -RETURNS - On successful completion, <<wcsstr>> returns a pointer to the located - wide-character string, or a null pointer if the wide-character string - is not found. - - If <[little]> points to a wide-character string with zero length, - the function returns <[big]>. - -PORTABILITY -<<wcsstr>> is ISO/IEC 9899/AMD1:1995 (ISO C). - -*/ - -/* $NetBSD: wcsstr.c,v 1.1 2000/12/23 23:14:37 itojun Exp $ */ - -/*- - * Copyright (c)1999 Citrus Project, - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * citrus Id: wcsstr.c,v 1.2 2000/12/21 05:07:25 itojun Exp - */ - -#include <_ansi.h> -#include <stddef.h> -#include <wchar.h> - -wchar_t * -_DEFUN (wcsstr, (big, little), - _CONST wchar_t * big _AND - _CONST wchar_t * little) -{ - _CONST wchar_t *p; - _CONST wchar_t *q; - _CONST wchar_t *r; - - if (!*little) - { - /* LINTED interface specification */ - return (wchar_t *) big; - } - if (wcslen (big) < wcslen (little)) - return NULL; - - p = big; - q = little; - while (*p) - { - q = little; - r = p; - while (*q) - { - if (*r != *q) - break; - q++; - r++; - } - if (!*q) - { - /* LINTED interface specification */ - return (wchar_t *) p; - } - p++; - } - return NULL; -} diff --git a/newlib/libc/string/wcstrings.tex b/newlib/libc/string/wcstrings.tex deleted file mode 100644 index ccd029f49..000000000 --- a/newlib/libc/string/wcstrings.tex +++ /dev/null @@ -1,90 +0,0 @@ -@node Wchar strings -@chapter Wide Character Strings (@file{wchar.h}) - -This chapter describes wide-character string-handling functions and -managing areas of memory containing wide-characters. The corresponding -declarations are in @file{wchar.h}. - -@menu -* wmemchr:: Find wide-character in memory -* wmemcmp:: Compare two wide-character memory areas -* wmemcpy:: Copy wide-character memory regions -* wmemmove:: Move possibly overlapping wide-character memory -* wmemset:: Set an area of memory to a specified wide-character -* wcscat:: Concatenate wide-character strings -* wcschr:: Search for wide-character in string -* wcscmp:: Wide-character string compare -* wcscpy:: Copy wide-character string -* wcscspn:: Count wide-chars not in string -* wcslcat:: Concatenate wide-character strings to specified length -* wcslcpy:: Copy wide-character string to specified length -* wcslen:: Wide-character string length -* wcsncat:: Concatenate wide-character strings -* wcsncmp:: Wide-character string compare -* wcsncpy:: Counted copy wide-character string -* wcspbrk:: Find wide-chars in string -* wcsrchr:: Reverse search for wide-character in string -* wcsspn:: Find initial match in wide-character string -* wcsstr:: Find wide-character string segment -@end menu - -@page -@include string/wmemchr.def - -@page -@include string/wmemcmp.def - -@page -@include string/wmemcpy.def - -@page -@include string/wmemmove.def - -@page -@include string/wmemset.def - -@page -@include string/wcscat.def - -@page -@include string/wcschr.def - -@page -@include string/wcscmp.def - -@page -@include string/wcscpy.def - -@page -@include string/wcscspn.def - -@page -@include string/wcslcat.def - -@page -@include string/wcslcpy.def - -@page -@include string/wcslen.def - -@page -@include string/wcsncat.def - -@page -@include string/wcsncmp.def - -@page -@include string/wcsncpy.def - -@page -@include string/wcspbrk.def - -@page -@include string/wcsrchr.def - -@page -@include string/wcsspn.def - -@page -@include string/wcsstr.def - diff --git a/newlib/libc/string/wmemchr.c b/newlib/libc/string/wmemchr.c deleted file mode 100644 index e99991324..000000000 --- a/newlib/libc/string/wmemchr.c +++ /dev/null @@ -1,88 +0,0 @@ -/* -FUNCTION - <<wmemchr>>---find a wide-character in memory - - -ANSI_SYNOPSIS - #include <wchar.h> - wchar_t *wmemchr(const wchar_t *<[s]>, wchar_t <[c]>, size_t <[n]>); - -TRAD_SYNOPSIS - wchar_t *wmemchr(<[s]>, <[c]>, <[n]> - const wchar_t *<[s]>; - wchar_t <[c]>; - size_t <[n]>; - -DESCRIPTION - The <<wmemchr>> function locates the first occurrence of <[c]> in the - initial <[n]> wide-characters of the object pointed to be <[s]>. This - function is not affected by locale and all wchar_t values are treated - identically. The null wide-character and wchar_t values not - corresponding to valid characters are not treated specially. - - If <[n]> is zero, <[s]> must be a valid pointer and the function - behaves as if no valid occurrence of <[c]> is found. - -RETURNS - The <<wmemchr>> function returns a pointer to the located - wide-character, or a null pointer if the wide-character does not occur - in the object. - -PORTABILITY -<<wmemchr>> is ISO/IEC 9899/AMD1:1995 (ISO C). -No supporting OS subroutines are required. -*/ - -/* $NetBSD: wmemchr.c,v 1.1 2000/12/23 23:14:37 itojun Exp $ */ - -/*- - * Copyright (c)1999 Citrus Project, - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * citrus Id: wmemchr.c,v 1.2 2000/12/20 14:08:31 itojun Exp - */ - - -#include <_ansi.h> -#include <wchar.h> - -wchar_t * -_DEFUN (wmemchr, (s, c, n), - _CONST wchar_t * s _AND - wchar_t c _AND - size_t n) -{ - size_t i; - - for (i = 0; i < n; i++) - { - if (*s == c) - { - /* LINTED const castaway */ - return (wchar_t *) s; - } - s++; - } - return NULL; -} diff --git a/newlib/libc/string/wmemcmp.c b/newlib/libc/string/wmemcmp.c deleted file mode 100644 index 51072942c..000000000 --- a/newlib/libc/string/wmemcmp.c +++ /dev/null @@ -1,88 +0,0 @@ -/* -FUNCTION - <<wmemcmp>>---compare wide-characters in memory - -ANSI_SYNOPSIS - #include <wchar.h> - int wmemcmp(const wchar_t *<[s1]>, const wchar_t *<[s2]>, size_t <[n]>); - -TRAD_SYNOPSIS - int wmemcmp(<[s1]>, <[s2]>, <[n]> - const wchar_t *<[s1]>; - const wchar_t *<[s2]>; - size_t <[n]>; - -DESCRIPTION - The <<wmemcmp>> function compares the first <[n]> wide-characters of the - object pointed to by <[s1]> to the first <[n]> wide-characters of the - object pointed to by <[s2]>. This function is not affected by locale - and all wchar_t values are treated identically. The null wide-character - and wchar_t values not corresponding to valid characters are not treated - specially. - - If <[n]> is zero, <[s1]> and <[s2]> must be a valid pointers and the - function behaves as if the two objects compare equal. - -RETURNS - The <<wmemcmp>> function returns an integer greater than, equal to, - or less than zero, accordingly as the object pointed to by <[s1]> is - greater than, equal to, or less than the object pointed to by <[s2]>. - -PORTABILITY -<<wmemcmp>> is ISO/IEC 9899/AMD1:1995 (ISO C). -No supporting OS subroutines are required. -*/ - -/* $NetBSD: wmemcmp.c,v 1.1 2000/12/23 23:14:37 itojun Exp $ */ - -/*- - * Copyright (c)1999 Citrus Project, - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * citrus Id: wmemcmp.c,v 1.2 2000/12/20 14:08:31 itojun Exp - */ - -#include <_ansi.h> -#include <wchar.h> - -int -_DEFUN (wmemcmp, (s1, s2, n), - _CONST wchar_t * s1 _AND - _CONST wchar_t * s2 _AND - size_t n) -{ - size_t i; - - for (i = 0; i < n; i++) - { - if (*s1 != *s2) - { - /* wchar might be unsigned */ - return *s1 > *s2 ? 1 : -1; - } - s1++; - s2++; - } - return 0; -} diff --git a/newlib/libc/string/wmemcpy.c b/newlib/libc/string/wmemcpy.c deleted file mode 100644 index c3a96a32d..000000000 --- a/newlib/libc/string/wmemcpy.c +++ /dev/null @@ -1,75 +0,0 @@ -/* -FUNCTION - <<wmemcpy>>---copy wide-characters in memory - -ANSI_SYNOPSIS - #include <wchar.h> - wchar_t *wmemcpy(wchar_t *<[d]>, const wchar_t *<[s]>, size_t <[n]>); - -TRAD_SYNOPSIS - wchar_t *wmemcpy(<[d]>, <[s]>, <[n]> - wchar_t *<[d]>; - const wchar_t *<[s]>; - size_t <[n]>; - -DESCRIPTION - The <<wmemcpy>> function copies <[n]> wide-characters from the object - pointed to by <[s]> to the object pointed to be <[d]>. This function - is not affected by locale and all wchar_t values are treated - identically. The null wide-character and wchar_t values not - corresponding to valid characters are not treated specially. - - If <[n]> is zero, <[d]> and <[s]> must be a valid pointers, and the - function copies zero wide-characters. - -RETURNS - The <<wmemcpy>> function returns the value of <[d]>. - -PORTABILITY -<<wmemcpy>> is ISO/IEC 9899/AMD1:1995 (ISO C). -No supporting OS subroutines are required. -*/ - -/* $NetBSD: wmemcpy.c,v 1.1 2000/12/23 23:14:37 itojun Exp $ */ - -/*- - * Copyright (c)1999 Citrus Project, - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * citrus Id: wmemcpy.c,v 1.2 2000/12/20 14:08:31 itojun Exp - */ - -#include <_ansi.h> -#include <string.h> -#include <wchar.h> - -wchar_t * -_DEFUN (wmemcpy, (d, s, n), - wchar_t * d _AND - _CONST wchar_t * s _AND - size_t n) -{ - - return (wchar_t *) memcpy (d, s, n * sizeof (wchar_t)); -} diff --git a/newlib/libc/string/wmemmove.c b/newlib/libc/string/wmemmove.c deleted file mode 100644 index f49e359f3..000000000 --- a/newlib/libc/string/wmemmove.c +++ /dev/null @@ -1,81 +0,0 @@ -/* -FUNCTION - <<wmemmove>>---wmemmove - copy wide-characters in memory with overlapping areas - -ANSI_SYNOPSIS - #include <wchar.h> - wchar_t *wmemmove(wchar_t *<[d]>, const wchar_t *<[s]>, size_t <[n]>); - -TRAD_SYNOPSIS - wchar_t *wmemmove(<[d]>, <[s]>, <[n]> - wchar_t *<[d]>; - const wchar_t *<[s]>; - size_t <[n]>; - -DESCRIPTION - The <<wmemmove>> function copies <[n]> wide-characters from the object - pointed to by <[s]> to the object pointed to by <[d]>. Copying takes - place as if the <[n]> wide-characters from the object pointed to by - <[s]> are first copied into a temporary array of <[n]> wide-characters - that does not overlap the objects pointed to by <[d]> or <[s]>, and then - the <[n]> wide-characters from the temporary array are copied into the - object pointed to by <[d]>. - - This function is not affected by locale and all wchar_t values are - treated identically. The null wide-character and wchar_t values not - corresponding to valid characters are not treated specially. - - If <[n]> is zero, <[d]> and <[s]> must be a valid pointers, and the - function copies zero wide-characters. - -RETURNS - The <<wmemmove>> function returns the value of <[d]>. - -PORTABILITY -<<wmemmove>> is ISO/IEC 9899/AMD1:1995 (ISO C). -No supporting OS subroutines are required. -*/ - -/* $NetBSD: wmemmove.c,v 1.1 2000/12/23 23:14:37 itojun Exp $ */ - -/*- - * Copyright (c)1999 Citrus Project, - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * citrus Id: wmemmove.c,v 1.2 2000/12/20 14:08:31 itojun Exp - */ - -#include <_ansi.h> -#include <string.h> -#include <wchar.h> - -wchar_t * -_DEFUN (wmemmove, (d, s, n), - wchar_t * d _AND - _CONST wchar_t * s _AND - size_t n) -{ - - return (wchar_t *) memmove (d, s, n * sizeof (wchar_t)); -} diff --git a/newlib/libc/string/wmemset.c b/newlib/libc/string/wmemset.c deleted file mode 100644 index 4e05b93b6..000000000 --- a/newlib/libc/string/wmemset.c +++ /dev/null @@ -1,81 +0,0 @@ -/* -FUNCTION - <<wmemset>>---set wide-characters in memory - -ANSI_SYNOPSIS - #include <wchar.h> - wchar_t *wmemset(wchar_t *<[s]>, wchar_t <[c]>, size_t <[n]>); - -TRAD_SYNOPSIS - wchar_t *wmemset(<[s]>, <[c]>, <[n]> - wchar_t *<[s]>; - wchar_t <[c]>; - size_t <[n]>; - -DESCRIPTION - The <<wmemset>> function copies the value of <[c]> into each of the - first <[n]> wide-characters of the object pointed to by <[s]>. This - function is not affected by locale and all wchar_t values are treated - identically. The null wide-character and wchar_t values not - corresponding to valid characters are not treated specially. - - If <[n]> is zero, <[s]> must be a valid pointer and the function - copies zero wide-characters. - -RETURNS - The <<wmemset>> functions returns the value of <[s]>. - -PORTABILITY -<<wmemset>> is ISO/IEC 9899/AMD1:1995 (ISO C). -No supporting OS subroutines are required. -*/ - -/* $NetBSD: wmemset.c,v 1.1 2000/12/23 23:14:37 itojun Exp $ */ - -/*- - * Copyright (c)1999 Citrus Project, - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * citrus Id: wmemset.c,v 1.2 2000/12/20 14:08:31 itojun Exp - */ - -#include <_ansi.h> -#include <wchar.h> - -wchar_t * -_DEFUN(wmemset, (s, c, n), - wchar_t *s _AND - wchar_t c _AND - size_t n) -{ - size_t i; - wchar_t *p; - - p = (wchar_t *)s; - for (i = 0; i < n; i++) { - *p = c; - p++; - } - return s; -} |