[csw-devel] SF.net SVN: gar:[19894] csw/mgar/pkg/irrtoolset/trunk
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Sun Dec 16 01:33:57 CET 2012
Revision: 19894
http://gar.svn.sourceforge.net/gar/?rev=19894&view=rev
Author: wahwah
Date: 2012-12-16 00:33:56 +0000 (Sun, 16 Dec 2012)
Log Message:
-----------
irrtoolset/trunk: Added some gnulib, it still doesn't build.
Modified Paths:
--------------
csw/mgar/pkg/irrtoolset/trunk/Makefile
Added Paths:
-----------
csw/mgar/pkg/irrtoolset/trunk/files/0001-Add-missing-this-in-src-normalform-Stack.hh.patch
csw/mgar/pkg/irrtoolset/trunk/files/0002-Added-gnulib-strcasestr-module.patch
csw/mgar/pkg/irrtoolset/trunk/files/0003-Added-references-to-Makefile.am-and-configure.ac.patch
Modified: csw/mgar/pkg/irrtoolset/trunk/Makefile
===================================================================
--- csw/mgar/pkg/irrtoolset/trunk/Makefile 2012-12-15 12:29:38 UTC (rev 19893)
+++ csw/mgar/pkg/irrtoolset/trunk/Makefile 2012-12-16 00:33:56 UTC (rev 19894)
@@ -17,5 +17,12 @@
CONFIGURE_ARGS = $(DIRPATHS)
+PATCHFILES += 0001-Add-missing-this-in-src-normalform-Stack.hh.patch
+PATCHFILES += 0002-Added-gnulib-strcasestr-module.patch
+PATCHFILES += 0003-Added-references-to-Makefile.am-and-configure.ac.patch
+
include gar/category.mk
+pre-configure-modulated:
+ cd $(WORKSRC); autoreconf -fi
+ @$(MAKECOOKIE)
Added: csw/mgar/pkg/irrtoolset/trunk/files/0001-Add-missing-this-in-src-normalform-Stack.hh.patch
===================================================================
--- csw/mgar/pkg/irrtoolset/trunk/files/0001-Add-missing-this-in-src-normalform-Stack.hh.patch (rev 0)
+++ csw/mgar/pkg/irrtoolset/trunk/files/0001-Add-missing-this-in-src-normalform-Stack.hh.patch 2012-12-16 00:33:56 UTC (rev 19894)
@@ -0,0 +1,25 @@
+From 9de5a6294e19078f06cd02b477905aa9184b2ba8 Mon Sep 17 00:00:00 2001
+From: Maciej Blizinski <maciej at opencsw.org>
+Date: Sun, 16 Dec 2012 01:18:39 +0100
+Subject: [PATCH 1/3] Add missing "this" in src/normalform/Stack.hh
+
+---
+ src/normalform/Stack.hh | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/normalform/Stack.hh b/src/normalform/Stack.hh
+index 90c6a98..832101b 100644
+--- a/src/normalform/Stack.hh
++++ b/src/normalform/Stack.hh
+@@ -93,7 +93,7 @@ template <class TYPE>
+ class BoundedStack : BoundedQueue<TYPE> {
+ public:
+ BoundedStack(int size) : BoundedQueue<TYPE>(size) {}
+- void push(TYPE elt) { enq(elt); }
++ void push(TYPE elt) { this->enq(elt); }
+ TYPE pop() { return this->q[--(this->last)]; }
+ int getPosition() { return this->last; }
+ void setPosition(int pos) { this->last = pos; }
+--
+1.8.0
+
Added: csw/mgar/pkg/irrtoolset/trunk/files/0002-Added-gnulib-strcasestr-module.patch
===================================================================
--- csw/mgar/pkg/irrtoolset/trunk/files/0002-Added-gnulib-strcasestr-module.patch (rev 0)
+++ csw/mgar/pkg/irrtoolset/trunk/files/0002-Added-gnulib-strcasestr-module.patch 2012-12-16 00:33:56 UTC (rev 19894)
@@ -0,0 +1,4916 @@
+From d48d96410334de64c58b7b85bb00a0923491ce71 Mon Sep 17 00:00:00 2001
+From: Maciej Blizinski <maciej at opencsw.org>
+Date: Sun, 16 Dec 2012 01:19:02 +0100
+Subject: [PATCH 2/3] Added gnulib 'strcasestr' module
+
+---
+ lib/Makefile.am | 369 ++++++++++++++++++
+ lib/dummy.c | 42 +++
+ lib/memchr.c | 172 +++++++++
+ lib/memchr.valgrind | 14 +
+ lib/stdbool.in.h | 132 +++++++
+ lib/stddef.in.h | 86 +++++
+ lib/str-two-way.h | 452 ++++++++++++++++++++++
+ lib/strcasecmp.c | 62 ++++
+ lib/strcasestr.c | 82 ++++
+ lib/string.in.h | 1029 +++++++++++++++++++++++++++++++++++++++++++++++++++
+ lib/strings.in.h | 122 ++++++
+ lib/strncasecmp.c | 62 ++++
+ lib/sys_types.in.h | 51 +++
+ m4/00gnulib.m4 | 30 ++
+ m4/extensions.m4 | 123 ++++++
+ m4/gnulib-cache.m4 | 48 +++
+ m4/gnulib-common.m4 | 373 +++++++++++++++++++
+ m4/gnulib-comp.m4 | 280 ++++++++++++++
+ m4/gnulib-tool.m4 | 57 +++
+ m4/include_next.m4 | 270 ++++++++++++++
+ m4/memchr.m4 | 88 +++++
+ m4/mmap-anon.m4 | 55 +++
+ m4/off_t.m4 | 18 +
+ m4/ssize_t.m4 | 23 ++
+ m4/stdbool.m4 | 100 +++++
+ m4/stddef_h.m4 | 47 +++
+ m4/strcase.m4 | 45 +++
+ m4/strcasestr.m4 | 142 +++++++
+ m4/string_h.m4 | 120 ++++++
+ m4/strings_h.m4 | 52 +++
+ m4/sys_types_h.m4 | 24 ++
+ m4/warn-on-use.m4 | 47 +++
+ m4/wchar_t.m4 | 24 ++
+ 33 files changed, 4641 insertions(+)
+ create mode 100644 lib/Makefile.am
+ create mode 100644 lib/dummy.c
+ create mode 100644 lib/memchr.c
+ create mode 100644 lib/memchr.valgrind
+ create mode 100644 lib/stdbool.in.h
+ create mode 100644 lib/stddef.in.h
+ create mode 100644 lib/str-two-way.h
+ create mode 100644 lib/strcasecmp.c
+ create mode 100644 lib/strcasestr.c
+ create mode 100644 lib/string.in.h
+ create mode 100644 lib/strings.in.h
+ create mode 100644 lib/strncasecmp.c
+ create mode 100644 lib/sys_types.in.h
+ create mode 100644 m4/00gnulib.m4
+ create mode 100644 m4/extensions.m4
+ create mode 100644 m4/gnulib-cache.m4
+ create mode 100644 m4/gnulib-common.m4
+ create mode 100644 m4/gnulib-comp.m4
+ create mode 100644 m4/gnulib-tool.m4
+ create mode 100644 m4/include_next.m4
+ create mode 100644 m4/memchr.m4
+ create mode 100644 m4/mmap-anon.m4
+ create mode 100644 m4/off_t.m4
+ create mode 100644 m4/ssize_t.m4
+ create mode 100644 m4/stdbool.m4
+ create mode 100644 m4/stddef_h.m4
+ create mode 100644 m4/strcase.m4
+ create mode 100644 m4/strcasestr.m4
+ create mode 100644 m4/string_h.m4
+ create mode 100644 m4/strings_h.m4
+ create mode 100644 m4/sys_types_h.m4
+ create mode 100644 m4/warn-on-use.m4
+ create mode 100644 m4/wchar_t.m4
+
+diff --git a/lib/Makefile.am b/lib/Makefile.am
+new file mode 100644
+index 0000000..a49c32d
+--- /dev/null
++++ b/lib/Makefile.am
+@@ -0,0 +1,369 @@
++## DO NOT EDIT! GENERATED AUTOMATICALLY!
++## Process this file with automake to produce Makefile.in.
++# Copyright (C) 2002-2012 Free Software Foundation, Inc.
++#
++# This file is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This file is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this file. If not, see <http://www.gnu.org/licenses/>.
++#
++# As a special exception to the GNU General Public License,
++# this file may be distributed as part of a program that
++# contains a configuration script generated by Autoconf, under
++# the same distribution terms as the rest of that program.
++#
++# Generated by gnulib-tool.
++# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files strcasestr
++
++AUTOMAKE_OPTIONS = 1.5 gnits
++
++SUBDIRS =
++noinst_HEADERS =
++noinst_LIBRARIES =
++noinst_LTLIBRARIES =
++EXTRA_DIST =
++BUILT_SOURCES =
++SUFFIXES =
++MOSTLYCLEANFILES = core *.stackdump
++MOSTLYCLEANDIRS =
++CLEANFILES =
++DISTCLEANFILES =
++MAINTAINERCLEANFILES =
++
++AM_CPPFLAGS =
++AM_CFLAGS =
++
++noinst_LIBRARIES += libgnu.a
++
++libgnu_a_SOURCES =
++libgnu_a_LIBADD = $(gl_LIBOBJS)
++libgnu_a_DEPENDENCIES = $(gl_LIBOBJS)
++EXTRA_libgnu_a_SOURCES =
++
++## begin gnulib module memchr
++
++
++EXTRA_DIST += memchr.c memchr.valgrind
++
++EXTRA_libgnu_a_SOURCES += memchr.c
++
++## end gnulib module memchr
++
++## begin gnulib module snippet/arg-nonnull
++
++# The BUILT_SOURCES created by this Makefile snippet are not used via #include
++# statements but through direct file reference. Therefore this snippet must be
++# present in all Makefile.am that need it. This is ensured by the applicability
++# 'all' defined above.
++
++BUILT_SOURCES += arg-nonnull.h
++# The arg-nonnull.h that gets inserted into generated .h files is the same as
++# build-aux/snippet/arg-nonnull.h, except that it has the copyright header cut
++# off.
++arg-nonnull.h: $(top_srcdir)/./snippet/arg-nonnull.h
++ $(AM_V_GEN)rm -f $@-t $@ && \
++ sed -n -e '/GL_ARG_NONNULL/,$$p' \
++ < $(top_srcdir)/./snippet/arg-nonnull.h \
++ > $@-t && \
++ mv $@-t $@
++MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t
++
++ARG_NONNULL_H=arg-nonnull.h
++
++EXTRA_DIST += $(top_srcdir)/./snippet/arg-nonnull.h
++
++## end gnulib module snippet/arg-nonnull
++
++## begin gnulib module snippet/c++defs
++
++# The BUILT_SOURCES created by this Makefile snippet are not used via #include
++# statements but through direct file reference. Therefore this snippet must be
++# present in all Makefile.am that need it. This is ensured by the applicability
++# 'all' defined above.
++
++BUILT_SOURCES += c++defs.h
++# The c++defs.h that gets inserted into generated .h files is the same as
++# build-aux/snippet/c++defs.h, except that it has the copyright header cut off.
++c++defs.h: $(top_srcdir)/./snippet/c++defs.h
++ $(AM_V_GEN)rm -f $@-t $@ && \
++ sed -n -e '/_GL_CXXDEFS/,$$p' \
++ < $(top_srcdir)/./snippet/c++defs.h \
++ > $@-t && \
++ mv $@-t $@
++MOSTLYCLEANFILES += c++defs.h c++defs.h-t
++
++CXXDEFS_H=c++defs.h
++
++EXTRA_DIST += $(top_srcdir)/./snippet/c++defs.h
++
++## end gnulib module snippet/c++defs
++
++## begin gnulib module snippet/warn-on-use
++
++BUILT_SOURCES += warn-on-use.h
++# The warn-on-use.h that gets inserted into generated .h files is the same as
++# build-aux/snippet/warn-on-use.h, except that it has the copyright header cut
++# off.
++warn-on-use.h: $(top_srcdir)/./snippet/warn-on-use.h
++ $(AM_V_GEN)rm -f $@-t $@ && \
++ sed -n -e '/^.ifndef/,$$p' \
++ < $(top_srcdir)/./snippet/warn-on-use.h \
++ > $@-t && \
++ mv $@-t $@
++MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t
++
++WARN_ON_USE_H=warn-on-use.h
++
++EXTRA_DIST += $(top_srcdir)/./snippet/warn-on-use.h
++
++## end gnulib module snippet/warn-on-use
++
++## begin gnulib module stdbool
++
++BUILT_SOURCES += $(STDBOOL_H)
++
++# We need the following in order to create <stdbool.h> when the system
++# doesn't have one that works.
++if GL_GENERATE_STDBOOL_H
++stdbool.h: stdbool.in.h $(top_builddir)/config.status
++ $(AM_V_GEN)rm -f $@-t $@ && \
++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
++ sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \
++ } > $@-t && \
++ mv $@-t $@
++else
++stdbool.h: $(top_builddir)/config.status
++ rm -f $@
++endif
++MOSTLYCLEANFILES += stdbool.h stdbool.h-t
++
++EXTRA_DIST += stdbool.in.h
++
++## end gnulib module stdbool
++
++## begin gnulib module stddef
++
++BUILT_SOURCES += $(STDDEF_H)
++
++# We need the following in order to create <stddef.h> when the system
++# doesn't have one that works with the given compiler.
++if GL_GENERATE_STDDEF_H
++stddef.h: stddef.in.h $(top_builddir)/config.status
++ $(AM_V_GEN)rm -f $@-t $@ && \
++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
++ sed -e 's|@''GUARD_PREFIX''@|GL|g' \
++ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
++ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
++ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
++ -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \
++ -e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \
++ -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \
++ < $(srcdir)/stddef.in.h; \
++ } > $@-t && \
++ mv $@-t $@
++else
++stddef.h: $(top_builddir)/config.status
++ rm -f $@
++endif
++MOSTLYCLEANFILES += stddef.h stddef.h-t
++
++EXTRA_DIST += stddef.in.h
++
++## end gnulib module stddef
++
++## begin gnulib module strcase
++
++
++EXTRA_DIST += strcasecmp.c strncasecmp.c
++
++EXTRA_libgnu_a_SOURCES += strcasecmp.c strncasecmp.c
++
++## end gnulib module strcase
++
++## begin gnulib module strcasestr-simple
++
++
++EXTRA_DIST += str-two-way.h strcasestr.c
++
++EXTRA_libgnu_a_SOURCES += strcasestr.c
++
++## end gnulib module strcasestr-simple
++
++## begin gnulib module string
++
++BUILT_SOURCES += string.h
++
++# We need the following in order to create <string.h> when the system
++# doesn't have one that works with the given compiler.
++string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
++ $(AM_V_GEN)rm -f $@-t $@ && \
++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
++ sed -e 's|@''GUARD_PREFIX''@|GL|g' \
++ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
++ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
++ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
++ -e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \
++ -e 's/@''GNULIB_FFSL''@/$(GNULIB_FFSL)/g' \
++ -e 's/@''GNULIB_FFSLL''@/$(GNULIB_FFSLL)/g' \
++ -e 's/@''GNULIB_MBSLEN''@/$(GNULIB_MBSLEN)/g' \
++ -e 's/@''GNULIB_MBSNLEN''@/$(GNULIB_MBSNLEN)/g' \
++ -e 's/@''GNULIB_MBSCHR''@/$(GNULIB_MBSCHR)/g' \
++ -e 's/@''GNULIB_MBSRCHR''@/$(GNULIB_MBSRCHR)/g' \
++ -e 's/@''GNULIB_MBSSTR''@/$(GNULIB_MBSSTR)/g' \
++ -e 's/@''GNULIB_MBSCASECMP''@/$(GNULIB_MBSCASECMP)/g' \
++ -e 's/@''GNULIB_MBSNCASECMP''@/$(GNULIB_MBSNCASECMP)/g' \
++ -e 's/@''GNULIB_MBSPCASECMP''@/$(GNULIB_MBSPCASECMP)/g' \
++ -e 's/@''GNULIB_MBSCASESTR''@/$(GNULIB_MBSCASESTR)/g' \
++ -e 's/@''GNULIB_MBSCSPN''@/$(GNULIB_MBSCSPN)/g' \
++ -e 's/@''GNULIB_MBSPBRK''@/$(GNULIB_MBSPBRK)/g' \
++ -e 's/@''GNULIB_MBSSPN''@/$(GNULIB_MBSSPN)/g' \
++ -e 's/@''GNULIB_MBSSEP''@/$(GNULIB_MBSSEP)/g' \
++ -e 's/@''GNULIB_MBSTOK_R''@/$(GNULIB_MBSTOK_R)/g' \
++ -e 's/@''GNULIB_MEMCHR''@/$(GNULIB_MEMCHR)/g' \
++ -e 's/@''GNULIB_MEMMEM''@/$(GNULIB_MEMMEM)/g' \
++ -e 's/@''GNULIB_MEMPCPY''@/$(GNULIB_MEMPCPY)/g' \
++ -e 's/@''GNULIB_MEMRCHR''@/$(GNULIB_MEMRCHR)/g' \
++ -e 's/@''GNULIB_RAWMEMCHR''@/$(GNULIB_RAWMEMCHR)/g' \
++ -e 's/@''GNULIB_STPCPY''@/$(GNULIB_STPCPY)/g' \
++ -e 's/@''GNULIB_STPNCPY''@/$(GNULIB_STPNCPY)/g' \
++ -e 's/@''GNULIB_STRCHRNUL''@/$(GNULIB_STRCHRNUL)/g' \
++ -e 's/@''GNULIB_STRDUP''@/$(GNULIB_STRDUP)/g' \
++ -e 's/@''GNULIB_STRNCAT''@/$(GNULIB_STRNCAT)/g' \
++ -e 's/@''GNULIB_STRNDUP''@/$(GNULIB_STRNDUP)/g' \
++ -e 's/@''GNULIB_STRNLEN''@/$(GNULIB_STRNLEN)/g' \
++ -e 's/@''GNULIB_STRPBRK''@/$(GNULIB_STRPBRK)/g' \
++ -e 's/@''GNULIB_STRSEP''@/$(GNULIB_STRSEP)/g' \
++ -e 's/@''GNULIB_STRSTR''@/$(GNULIB_STRSTR)/g' \
++ -e 's/@''GNULIB_STRCASESTR''@/$(GNULIB_STRCASESTR)/g' \
++ -e 's/@''GNULIB_STRTOK_R''@/$(GNULIB_STRTOK_R)/g' \
++ -e 's/@''GNULIB_STRERROR''@/$(GNULIB_STRERROR)/g' \
++ -e 's/@''GNULIB_STRERROR_R''@/$(GNULIB_STRERROR_R)/g' \
++ -e 's/@''GNULIB_STRSIGNAL''@/$(GNULIB_STRSIGNAL)/g' \
++ -e 's/@''GNULIB_STRVERSCMP''@/$(GNULIB_STRVERSCMP)/g' \
++ < $(srcdir)/string.in.h | \
++ sed -e 's|@''HAVE_FFSL''@|$(HAVE_FFSL)|g' \
++ -e 's|@''HAVE_FFSLL''@|$(HAVE_FFSLL)|g' \
++ -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \
++ -e 's|@''HAVE_MEMCHR''@|$(HAVE_MEMCHR)|g' \
++ -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
++ -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
++ -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \
++ -e 's|@''HAVE_RAWMEMCHR''@|$(HAVE_RAWMEMCHR)|g' \
++ -e 's|@''HAVE_STPCPY''@|$(HAVE_STPCPY)|g' \
++ -e 's|@''HAVE_STPNCPY''@|$(HAVE_STPNCPY)|g' \
++ -e 's|@''HAVE_STRCHRNUL''@|$(HAVE_STRCHRNUL)|g' \
++ -e 's|@''HAVE_DECL_STRDUP''@|$(HAVE_DECL_STRDUP)|g' \
++ -e 's|@''HAVE_DECL_STRNDUP''@|$(HAVE_DECL_STRNDUP)|g' \
++ -e 's|@''HAVE_DECL_STRNLEN''@|$(HAVE_DECL_STRNLEN)|g' \
++ -e 's|@''HAVE_STRPBRK''@|$(HAVE_STRPBRK)|g' \
++ -e 's|@''HAVE_STRSEP''@|$(HAVE_STRSEP)|g' \
++ -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \
++ -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \
++ -e 's|@''HAVE_DECL_STRERROR_R''@|$(HAVE_DECL_STRERROR_R)|g' \
++ -e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \
++ -e 's|@''HAVE_STRVERSCMP''@|$(HAVE_STRVERSCMP)|g' \
++ -e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \
++ -e 's|@''REPLACE_MEMCHR''@|$(REPLACE_MEMCHR)|g' \
++ -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \
++ -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \
++ -e 's|@''REPLACE_STRCHRNUL''@|$(REPLACE_STRCHRNUL)|g' \
++ -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \
++ -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \
++ -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \
++ -e 's|@''REPLACE_STRERROR_R''@|$(REPLACE_STRERROR_R)|g' \
++ -e 's|@''REPLACE_STRNCAT''@|$(REPLACE_STRNCAT)|g' \
++ -e 's|@''REPLACE_STRNDUP''@|$(REPLACE_STRNDUP)|g' \
++ -e 's|@''REPLACE_STRNLEN''@|$(REPLACE_STRNLEN)|g' \
++ -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \
++ -e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \
++ -e 's|@''UNDEFINE_STRTOK_R''@|$(UNDEFINE_STRTOK_R)|g' \
++ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
++ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
++ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
++ < $(srcdir)/string.in.h; \
++ } > $@-t && \
++ mv $@-t $@
++MOSTLYCLEANFILES += string.h string.h-t
++
++EXTRA_DIST += string.in.h
++
++## end gnulib module string
++
++## begin gnulib module strings
++
++BUILT_SOURCES += strings.h
++
++# We need the following in order to create <strings.h> when the system
++# doesn't have one that works with the given compiler.
++strings.h: strings.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H)
++ $(AM_V_GEN)rm -f $@-t $@ && \
++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
++ sed -e 's|@''GUARD_PREFIX''@|GL|g' \
++ -e 's|@''HAVE_STRINGS_H''@|$(HAVE_STRINGS_H)|g' \
++ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
++ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
++ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
++ -e 's|@''NEXT_STRINGS_H''@|$(NEXT_STRINGS_H)|g' \
++ -e 's|@''GNULIB_FFS''@|$(GNULIB_FFS)|g' \
++ -e 's|@''HAVE_FFS''@|$(HAVE_FFS)|g' \
++ -e 's|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \
++ -e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \
++ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
++ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
++ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
++ < $(srcdir)/strings.in.h; \
++ } > $@-t && \
++ mv $@-t $@
++MOSTLYCLEANFILES += strings.h strings.h-t
++
++EXTRA_DIST += strings.in.h
++
++## end gnulib module strings
++
++## begin gnulib module sys_types
++
++BUILT_SOURCES += sys/types.h
++
++# We need the following in order to create <sys/types.h> when the system
++# doesn't have one that works with the given compiler.
++sys/types.h: sys_types.in.h $(top_builddir)/config.status
++ $(AM_V_at)$(MKDIR_P) sys
++ $(AM_V_GEN)rm -f $@-t $@ && \
++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
++ sed -e 's|@''GUARD_PREFIX''@|GL|g' \
++ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
++ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
++ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
++ -e 's|@''NEXT_SYS_TYPES_H''@|$(NEXT_SYS_TYPES_H)|g' \
++ -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \
++ < $(srcdir)/sys_types.in.h; \
++ } > $@-t && \
++ mv $@-t $@
++MOSTLYCLEANFILES += sys/types.h sys/types.h-t
++
++EXTRA_DIST += sys_types.in.h
++
++## end gnulib module sys_types
++
++## begin gnulib module dummy
++
++libgnu_a_SOURCES += dummy.c
++
++## end gnulib module dummy
++
++
++mostlyclean-local: mostlyclean-generic
++ @for dir in '' $(MOSTLYCLEANDIRS); do \
++ if test -n "$$dir" && test -d $$dir; then \
++ echo "rmdir $$dir"; rmdir $$dir; \
++ fi; \
++ done; \
++ :
+diff --git a/lib/dummy.c b/lib/dummy.c
+new file mode 100644
+index 0000000..6e4b76e
+--- /dev/null
++++ b/lib/dummy.c
+@@ -0,0 +1,42 @@
++/* A dummy file, to prevent empty libraries from breaking builds.
++ Copyright (C) 2004, 2007, 2009-2012 Free Software Foundation, Inc.
++
++ This program is free software: you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 3 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program. If not, see <http://www.gnu.org/licenses/>. */
++
++/* Some systems, reportedly OpenBSD and Mac OS X, refuse to create
++ libraries without any object files. You might get an error like:
++
++ > ar cru .libs/libgl.a
++ > ar: no archive members specified
++
++ Compiling this file, and adding its object file to the library, will
++ prevent the library from being empty. */
++
++/* Some systems, such as Solaris with cc 5.0, refuse to work with libraries
++ that don't export any symbol. You might get an error like:
++
++ > cc ... libgnu.a
++ > ild: (bad file) garbled symbol table in archive ../gllib/libgnu.a
++
++ Compiling this file, and adding its object file to the library, will
++ prevent the library from exporting no symbols. */
++
++#ifdef __sun
++/* This declaration ensures that the library will export at least 1 symbol. */
++int gl_dummy_symbol;
++#else
++/* This declaration is solely to ensure that after preprocessing
++ this file is never empty. */
++typedef int dummy;
++#endif
+diff --git a/lib/memchr.c b/lib/memchr.c
+new file mode 100644
+index 0000000..b8fb0ef
+--- /dev/null
++++ b/lib/memchr.c
+@@ -0,0 +1,172 @@
++/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2012
++ Free Software Foundation, Inc.
++
++ Based on strlen implementation by Torbjorn Granlund (tege at sics.se),
++ with help from Dan Sahlin (dan at sics.se) and
++ commentary by Jim Blandy (jimb at ai.mit.edu);
++ adaptation to memchr suggested by Dick Karpinski (dick at cca.ucsf.edu),
++ and implemented by Roland McGrath (roland at ai.mit.edu).
++
++NOTE: The canonical source of this file is maintained with the GNU C Library.
++Bugs can be reported to bug-glibc at prep.ai.mit.edu.
++
++This program is free software: you can redistribute it and/or modify it
++under the terms of the GNU General Public License as published by the
++Free Software Foundation; either version 3 of the License, or any
++later version.
++
++This program is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with this program. If not, see <http://www.gnu.org/licenses/>. */
++
++#ifndef _LIBC
++# include <config.h>
++#endif
++
++#include <string.h>
++
++#include <stddef.h>
++
++#if defined _LIBC
++# include <memcopy.h>
++#else
++# define reg_char char
++#endif
++
++#include <limits.h>
++
++#if HAVE_BP_SYM_H || defined _LIBC
++# include <bp-sym.h>
++#else
++# define BP_SYM(sym) sym
++#endif
++
++#undef __memchr
++#ifdef _LIBC
++# undef memchr
++#endif
++
++#ifndef weak_alias
++# define __memchr memchr
++#endif
++
++/* Search no more than N bytes of S for C. */
++void *
++__memchr (void const *s, int c_in, size_t n)
++{
++ /* On 32-bit hardware, choosing longword to be a 32-bit unsigned
++ long instead of a 64-bit uintmax_t tends to give better
++ performance. On 64-bit hardware, unsigned long is generally 64
++ bits already. Change this typedef to experiment with
++ performance. */
++ typedef unsigned long int longword;
++
++ const unsigned char *char_ptr;
++ const longword *longword_ptr;
++ longword repeated_one;
++ longword repeated_c;
++ unsigned reg_char c;
++
++ c = (unsigned char) c_in;
++
++ /* Handle the first few bytes by reading one byte at a time.
++ Do this until CHAR_PTR is aligned on a longword boundary. */
++ for (char_ptr = (const unsigned char *) s;
++ n > 0 && (size_t) char_ptr % sizeof (longword) != 0;
++ --n, ++char_ptr)
++ if (*char_ptr == c)
++ return (void *) char_ptr;
++
++ longword_ptr = (const longword *) char_ptr;
++
++ /* All these elucidatory comments refer to 4-byte longwords,
++ but the theory applies equally well to any size longwords. */
++
++ /* Compute auxiliary longword values:
++ repeated_one is a value which has a 1 in every byte.
++ repeated_c has c in every byte. */
++ repeated_one = 0x01010101;
++ repeated_c = c | (c << 8);
++ repeated_c |= repeated_c << 16;
++ if (0xffffffffU < (longword) -1)
++ {
++ repeated_one |= repeated_one << 31 << 1;
++ repeated_c |= repeated_c << 31 << 1;
++ if (8 < sizeof (longword))
++ {
++ size_t i;
++
++ for (i = 64; i < sizeof (longword) * 8; i *= 2)
++ {
++ repeated_one |= repeated_one << i;
++ repeated_c |= repeated_c << i;
++ }
++ }
++ }
++
++ /* Instead of the traditional loop which tests each byte, we will test a
++ longword at a time. The tricky part is testing if *any of the four*
++ bytes in the longword in question are equal to c. We first use an xor
++ with repeated_c. This reduces the task to testing whether *any of the
++ four* bytes in longword1 is zero.
++
++ We compute tmp =
++ ((longword1 - repeated_one) & ~longword1) & (repeated_one << 7).
++ That is, we perform the following operations:
++ 1. Subtract repeated_one.
++ 2. & ~longword1.
++ 3. & a mask consisting of 0x80 in every byte.
++ Consider what happens in each byte:
++ - If a byte of longword1 is zero, step 1 and 2 transform it into 0xff,
++ and step 3 transforms it into 0x80. A carry can also be propagated
++ to more significant bytes.
++ - If a byte of longword1 is nonzero, let its lowest 1 bit be at
++ position k (0 <= k <= 7); so the lowest k bits are 0. After step 1,
++ the byte ends in a single bit of value 0 and k bits of value 1.
++ After step 2, the result is just k bits of value 1: 2^k - 1. After
++ step 3, the result is 0. And no carry is produced.
++ So, if longword1 has only non-zero bytes, tmp is zero.
++ Whereas if longword1 has a zero byte, call j the position of the least
++ significant zero byte. Then the result has a zero at positions 0, ...,
++ j-1 and a 0x80 at position j. We cannot predict the result at the more
++ significant bytes (positions j+1..3), but it does not matter since we
++ already have a non-zero bit at position 8*j+7.
++
++ So, the test whether any byte in longword1 is zero is equivalent to
++ testing whether tmp is nonzero. */
++
++ while (n >= sizeof (longword))
++ {
++ longword longword1 = *longword_ptr ^ repeated_c;
++
++ if ((((longword1 - repeated_one) & ~longword1)
++ & (repeated_one << 7)) != 0)
++ break;
++ longword_ptr++;
++ n -= sizeof (longword);
++ }
++
++ char_ptr = (const unsigned char *) longword_ptr;
++
++ /* At this point, we know that either n < sizeof (longword), or one of the
++ sizeof (longword) bytes starting at char_ptr is == c. On little-endian
++ machines, we could determine the first such byte without any further
++ memory accesses, just by looking at the tmp result from the last loop
++ iteration. But this does not work on big-endian machines. Choose code
++ that works in both cases. */
++
++ for (; n > 0; --n, ++char_ptr)
++ {
++ if (*char_ptr == c)
++ return (void *) char_ptr;
++ }
++
++ return NULL;
++}
++#ifdef weak_alias
++weak_alias (__memchr, BP_SYM (memchr))
++#endif
+diff --git a/lib/memchr.valgrind b/lib/memchr.valgrind
+new file mode 100644
+index 0000000..60f247e
+--- /dev/null
++++ b/lib/memchr.valgrind
+@@ -0,0 +1,14 @@
++# Suppress a valgrind message about use of uninitialized memory in memchr().
++# POSIX states that when the character is found, memchr must not read extra
++# bytes in an overestimated length (for example, where memchr is used to
++# implement strnlen). However, we use a safe word read to provide a speedup.
++{
++ memchr-value4
++ Memcheck:Value4
++ fun:rpl_memchr
++}
++{
++ memchr-value8
++ Memcheck:Value8
++ fun:rpl_memchr
++}
+diff --git a/lib/stdbool.in.h b/lib/stdbool.in.h
+new file mode 100644
+index 0000000..1261936
+--- /dev/null
++++ b/lib/stdbool.in.h
+@@ -0,0 +1,132 @@
++/* Copyright (C) 2001-2003, 2006-2012 Free Software Foundation, Inc.
++ Written by Bruno Haible <haible at clisp.cons.org>, 2001.
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program; if not, see <http://www.gnu.org/licenses/>. */
++
++#ifndef _GL_STDBOOL_H
++#define _GL_STDBOOL_H
++
++/* ISO C 99 <stdbool.h> for platforms that lack it. */
++
++/* Usage suggestions:
++
++ Programs that use <stdbool.h> should be aware of some limitations
++ and standards compliance issues.
++
++ Standards compliance:
++
++ - <stdbool.h> must be #included before 'bool', 'false', 'true'
++ can be used.
++
++ - You cannot assume that sizeof (bool) == 1.
++
++ - Programs should not undefine the macros bool, true, and false,
++ as C99 lists that as an "obsolescent feature".
++
++ Limitations of this substitute, when used in a C89 environment:
++
++ - <stdbool.h> must be #included before the '_Bool' type can be used.
++
++ - You cannot assume that _Bool is a typedef; it might be a macro.
++
++ - Bit-fields of type 'bool' are not supported. Portable code
++ should use 'unsigned int foo : 1;' rather than 'bool foo : 1;'.
++
++ - In C99, casts and automatic conversions to '_Bool' or 'bool' are
++ performed in such a way that every nonzero value gets converted
++ to 'true', and zero gets converted to 'false'. This doesn't work
++ with this substitute. With this substitute, only the values 0 and 1
++ give the expected result when converted to _Bool' or 'bool'.
++
++ - C99 allows the use of (_Bool)0.0 in constant expressions, but
++ this substitute cannot always provide this property.
++
++ Also, it is suggested that programs use 'bool' rather than '_Bool';
++ this isn't required, but 'bool' is more common. */
++
++
++/* 7.16. Boolean type and values */
++
++/* BeOS <sys/socket.h> already #defines false 0, true 1. We use the same
++ definitions below, but temporarily we have to #undef them. */
++#if defined __BEOS__ && !defined __HAIKU__
++# include <OS.h> /* defines bool but not _Bool */
++# undef false
++# undef true
++#endif
++
++#ifdef __cplusplus
++# define _Bool bool
++# define bool bool
++#else
++# if defined __BEOS__ && !defined __HAIKU__
++ /* A compiler known to have 'bool'. */
++ /* If the compiler already has both 'bool' and '_Bool', we can assume they
++ are the same types. */
++# if !@HAVE__BOOL@
++typedef bool _Bool;
++# endif
++# else
++# if !defined __GNUC__
++ /* If @HAVE__BOOL@:
++ Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when
++ the built-in _Bool type is used. See
++ http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
++ http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
++ http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
++ Similar bugs are likely with other compilers as well; this file
++ wouldn't be used if <stdbool.h> was working.
++ So we override the _Bool type.
++ If !@HAVE__BOOL@:
++ Need to define _Bool ourselves. As 'signed char' or as an enum type?
++ Use of a typedef, with SunPRO C, leads to a stupid
++ "warning: _Bool is a keyword in ISO C99".
++ Use of an enum type, with IRIX cc, leads to a stupid
++ "warning(1185): enumerated type mixed with another type".
++ Even the existence of an enum type, without a typedef,
++ "Invalid enumerator. (badenum)" with HP-UX cc on Tru64.
++ The only benefit of the enum, debuggability, is not important
++ with these compilers. So use 'signed char' and no enum. */
++# define _Bool signed char
++# else
++ /* With this compiler, trust the _Bool type if the compiler has it. */
++# if !@HAVE__BOOL@
++ /* For the sake of symbolic names in gdb, define true and false as
++ enum constants, not only as macros.
++ It is tempting to write
++ typedef enum { false = 0, true = 1 } _Bool;
++ so that gdb prints values of type 'bool' symbolically. But then
++ values of type '_Bool' might promote to 'int' or 'unsigned int'
++ (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int'
++ (see ISO C 99 6.3.1.1.(2)). So add a negative value to the
++ enum; this ensures that '_Bool' promotes to 'int'. */
++typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool;
++# endif
++# endif
++# endif
++# define bool _Bool
++#endif
++
++/* The other macros must be usable in preprocessor directives. */
++#ifdef __cplusplus
++# define false false
++# define true true
++#else
++# define false 0
++# define true 1
++#endif
++
++#define __bool_true_false_are_defined 1
++
++#endif /* _GL_STDBOOL_H */
+diff --git a/lib/stddef.in.h b/lib/stddef.in.h
+new file mode 100644
+index 0000000..56c1b3b
+--- /dev/null
++++ b/lib/stddef.in.h
+@@ -0,0 +1,86 @@
++/* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues.
++
++ Copyright (C) 2009-2012 Free Software Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program; if not, see <http://www.gnu.org/licenses/>. */
++
++/* Written by Eric Blake. */
++
++/*
++ * POSIX 2008 <stddef.h> for platforms that have issues.
++ * <http://www.opengroup.org/susv3xbd/stddef.h.html>
++ */
++
++#if __GNUC__ >= 3
++ at PRAGMA_SYSTEM_HEADER@
++#endif
++ at PRAGMA_COLUMNS@
++
++#if defined __need_wchar_t || defined __need_size_t \
++ || defined __need_ptrdiff_t || defined __need_NULL \
++ || defined __need_wint_t
++/* Special invocation convention inside gcc header files. In
++ particular, gcc provides a version of <stddef.h> that blindly
++ redefines NULL even when __need_wint_t was defined, even though
++ wint_t is not normally provided by <stddef.h>. Hence, we must
++ remember if special invocation has ever been used to obtain wint_t,
++ in which case we need to clean up NULL yet again. */
++
++# if !(defined _ at GUARD_PREFIX@_STDDEF_H && defined _GL_STDDEF_WINT_T)
++# ifdef __need_wint_t
++# undef _ at GUARD_PREFIX@_STDDEF_H
++# define _GL_STDDEF_WINT_T
++# endif
++# @INCLUDE_NEXT@ @NEXT_STDDEF_H@
++# endif
++
++#else
++/* Normal invocation convention. */
++
++# ifndef _ at GUARD_PREFIX@_STDDEF_H
++
++/* The include_next requires a split double-inclusion guard. */
++
++# @INCLUDE_NEXT@ @NEXT_STDDEF_H@
++
++# ifndef _ at GUARD_PREFIX@_STDDEF_H
++# define _ at GUARD_PREFIX@_STDDEF_H
++
++/* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */
++#if @REPLACE_NULL@
++# undef NULL
++# ifdef __cplusplus
++ /* ISO C++ says that the macro NULL must expand to an integer constant
++ expression, hence '((void *) 0)' is not allowed in C++. */
++# if __GNUG__ >= 3
++ /* GNU C++ has a __null macro that behaves like an integer ('int' or
++ 'long') but has the same size as a pointer. Use that, to avoid
++ warnings. */
++# define NULL __null
++# else
++# define NULL 0L
++# endif
++# else
++# define NULL ((void *) 0)
++# endif
++#endif
++
++/* Some platforms lack wchar_t. */
++#if !@HAVE_WCHAR_T@
++# define wchar_t int
++#endif
++
++# endif /* _ at GUARD_PREFIX@_STDDEF_H */
++# endif /* _ at GUARD_PREFIX@_STDDEF_H */
++#endif /* __need_XXX */
+diff --git a/lib/str-two-way.h b/lib/str-two-way.h
+new file mode 100644
+index 0000000..da6cfba
+--- /dev/null
++++ b/lib/str-two-way.h
+@@ -0,0 +1,452 @@
++/* Byte-wise substring search, using the Two-Way algorithm.
++ Copyright (C) 2008-2012 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++ Written by Eric Blake <ebb9 at byu.net>, 2008.
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License along
++ with this program; if not, see <http://www.gnu.org/licenses/>. */
++
++/* Before including this file, you need to include <config.h> and
++ <string.h>, and define:
++ RESULT_TYPE A macro that expands to the return type.
++ AVAILABLE(h, h_l, j, n_l)
++ A macro that returns nonzero if there are
++ at least N_L bytes left starting at H[J].
++ H is 'unsigned char *', H_L, J, and N_L
++ are 'size_t'; H_L is an lvalue. For
++ NUL-terminated searches, H_L can be
++ modified each iteration to avoid having
++ to compute the end of H up front.
++
++ For case-insensitivity, you may optionally define:
++ CMP_FUNC(p1, p2, l) A macro that returns 0 iff the first L
++ characters of P1 and P2 are equal.
++ CANON_ELEMENT(c) A macro that canonicalizes an element right after
++ it has been fetched from one of the two strings.
++ The argument is an 'unsigned char'; the result
++ must be an 'unsigned char' as well.
++
++ This file undefines the macros documented above, and defines
++ LONG_NEEDLE_THRESHOLD.
++*/
++
++#include <limits.h>
++#include <stdint.h>
++
++/* We use the Two-Way string matching algorithm (also known as
++ Chrochemore-Perrin), which guarantees linear complexity with
++ constant space. Additionally, for long needles, we also use a bad
++ character shift table similar to the Boyer-Moore algorithm to
++ achieve improved (potentially sub-linear) performance.
++
++ See http://www-igm.univ-mlv.fr/~lecroq/string/node26.html#SECTION00260,
++ http://en.wikipedia.org/wiki/Boyer-Moore_string_search_algorithm,
++ http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.34.6641&rep=rep1&type=pdf
++*/
++
++/* Point at which computing a bad-byte shift table is likely to be
++ worthwhile. Small needles should not compute a table, since it
++ adds (1 << CHAR_BIT) + NEEDLE_LEN computations of preparation for a
++ speedup no greater than a factor of NEEDLE_LEN. The larger the
++ needle, the better the potential performance gain. On the other
++ hand, on non-POSIX systems with CHAR_BIT larger than eight, the
++ memory required for the table is prohibitive. */
++#if CHAR_BIT < 10
++# define LONG_NEEDLE_THRESHOLD 32U
++#else
++# define LONG_NEEDLE_THRESHOLD SIZE_MAX
++#endif
++
++#ifndef MAX
++# define MAX(a, b) ((a < b) ? (b) : (a))
++#endif
++
++#ifndef CANON_ELEMENT
++# define CANON_ELEMENT(c) c
++#endif
++#ifndef CMP_FUNC
++# define CMP_FUNC memcmp
++#endif
++
++/* Perform a critical factorization of NEEDLE, of length NEEDLE_LEN.
++ Return the index of the first byte in the right half, and set
++ *PERIOD to the global period of the right half.
++
++ The global period of a string is the smallest index (possibly its
++ length) at which all remaining bytes in the string are repetitions
++ of the prefix (the last repetition may be a subset of the prefix).
++
++ When NEEDLE is factored into two halves, a local period is the
++ length of the smallest word that shares a suffix with the left half
++ and shares a prefix with the right half. All factorizations of a
++ non-empty NEEDLE have a local period of at least 1 and no greater
++ than NEEDLE_LEN.
++
++ A critical factorization has the property that the local period
++ equals the global period. All strings have at least one critical
++ factorization with the left half smaller than the global period.
++ And while some strings have more than one critical factorization,
++ it is provable that with an ordered alphabet, at least one of the
++ critical factorizations corresponds to a maximal suffix.
++
++ Given an ordered alphabet, a critical factorization can be computed
++ in linear time, with 2 * NEEDLE_LEN comparisons, by computing the
++ shorter of two ordered maximal suffixes. The ordered maximal
++ suffixes are determined by lexicographic comparison while tracking
++ periodicity. */
++static size_t
++critical_factorization (const unsigned char *needle, size_t needle_len,
++ size_t *period)
++{
++ /* Index of last byte of left half, or SIZE_MAX. */
++ size_t max_suffix, max_suffix_rev;
++ size_t j; /* Index into NEEDLE for current candidate suffix. */
++ size_t k; /* Offset into current period. */
++ size_t p; /* Intermediate period. */
++ unsigned char a, b; /* Current comparison bytes. */
++
++ /* Special case NEEDLE_LEN of 1 or 2 (all callers already filtered
++ out 0-length needles. */
++ if (needle_len < 3)
++ {
++ *period = 1;
++ return needle_len - 1;
++ }
++
++ /* Invariants:
++ 0 <= j < NEEDLE_LEN - 1
++ -1 <= max_suffix{,_rev} < j (treating SIZE_MAX as if it were signed)
++ min(max_suffix, max_suffix_rev) < global period of NEEDLE
++ 1 <= p <= global period of NEEDLE
++ p == global period of the substring NEEDLE[max_suffix{,_rev}+1...j]
++ 1 <= k <= p
++ */
++
++ /* Perform lexicographic search. */
++ max_suffix = SIZE_MAX;
++ j = 0;
++ k = p = 1;
++ while (j + k < needle_len)
++ {
++ a = CANON_ELEMENT (needle[j + k]);
++ b = CANON_ELEMENT (needle[max_suffix + k]);
++ if (a < b)
++ {
++ /* Suffix is smaller, period is entire prefix so far. */
++ j += k;
++ k = 1;
++ p = j - max_suffix;
++ }
++ else if (a == b)
++ {
++ /* Advance through repetition of the current period. */
++ if (k != p)
++ ++k;
++ else
++ {
++ j += p;
++ k = 1;
++ }
++ }
++ else /* b < a */
++ {
++ /* Suffix is larger, start over from current location. */
++ max_suffix = j++;
++ k = p = 1;
++ }
++ }
++ *period = p;
++
++ /* Perform reverse lexicographic search. */
++ max_suffix_rev = SIZE_MAX;
++ j = 0;
++ k = p = 1;
++ while (j + k < needle_len)
++ {
++ a = CANON_ELEMENT (needle[j + k]);
++ b = CANON_ELEMENT (needle[max_suffix_rev + k]);
++ if (b < a)
++ {
++ /* Suffix is smaller, period is entire prefix so far. */
++ j += k;
++ k = 1;
++ p = j - max_suffix_rev;
++ }
++ else if (a == b)
++ {
++ /* Advance through repetition of the current period. */
++ if (k != p)
++ ++k;
++ else
++ {
++ j += p;
++ k = 1;
++ }
++ }
++ else /* a < b */
++ {
++ /* Suffix is larger, start over from current location. */
++ max_suffix_rev = j++;
++ k = p = 1;
++ }
++ }
++
++ /* Choose the shorter suffix. Return the index of the first byte of
++ the right half, rather than the last byte of the left half.
++
++ For some examples, 'banana' has two critical factorizations, both
++ exposed by the two lexicographic extreme suffixes of 'anana' and
++ 'nana', where both suffixes have a period of 2. On the other
++ hand, with 'aab' and 'bba', both strings have a single critical
++ factorization of the last byte, with the suffix having a period
++ of 1. While the maximal lexicographic suffix of 'aab' is 'b',
++ the maximal lexicographic suffix of 'bba' is 'ba', which is not a
++ critical factorization. Conversely, the maximal reverse
++ lexicographic suffix of 'a' works for 'bba', but not 'ab' for
++ 'aab'. The shorter suffix of the two will always be a critical
++ factorization. */
++ if (max_suffix_rev + 1 < max_suffix + 1)
++ return max_suffix + 1;
++ *period = p;
++ return max_suffix_rev + 1;
++}
++
++/* Return the first location of non-empty NEEDLE within HAYSTACK, or
++ NULL. HAYSTACK_LEN is the minimum known length of HAYSTACK. This
++ method is optimized for NEEDLE_LEN < LONG_NEEDLE_THRESHOLD.
++ Performance is guaranteed to be linear, with an initialization cost
++ of 2 * NEEDLE_LEN comparisons.
++
++ If AVAILABLE does not modify HAYSTACK_LEN (as in memmem), then at
++ most 2 * HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching.
++ If AVAILABLE modifies HAYSTACK_LEN (as in strstr), then at most 3 *
++ HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching. */
++static RETURN_TYPE
++two_way_short_needle (const unsigned char *haystack, size_t haystack_len,
++ const unsigned char *needle, size_t needle_len)
++{
++ size_t i; /* Index into current byte of NEEDLE. */
++ size_t j; /* Index into current window of HAYSTACK. */
++ size_t period; /* The period of the right half of needle. */
++ size_t suffix; /* The index of the right half of needle. */
++
++ /* Factor the needle into two halves, such that the left half is
++ smaller than the global period, and the right half is
++ periodic (with a period as large as NEEDLE_LEN - suffix). */
++ suffix = critical_factorization (needle, needle_len, &period);
++
++ /* Perform the search. Each iteration compares the right half
++ first. */
++ if (CMP_FUNC (needle, needle + period, suffix) == 0)
++ {
++ /* Entire needle is periodic; a mismatch in the left half can
++ only advance by the period, so use memory to avoid rescanning
++ known occurrences of the period in the right half. */
++ size_t memory = 0;
++ j = 0;
++ while (AVAILABLE (haystack, haystack_len, j, needle_len))
++ {
++ /* Scan for matches in right half. */
++ i = MAX (suffix, memory);
++ while (i < needle_len && (CANON_ELEMENT (needle[i])
++ == CANON_ELEMENT (haystack[i + j])))
++ ++i;
++ if (needle_len <= i)
++ {
++ /* Scan for matches in left half. */
++ i = suffix - 1;
++ while (memory < i + 1 && (CANON_ELEMENT (needle[i])
++ == CANON_ELEMENT (haystack[i + j])))
++ --i;
++ if (i + 1 < memory + 1)
++ return (RETURN_TYPE) (haystack + j);
++ /* No match, so remember how many repetitions of period
++ on the right half were scanned. */
++ j += period;
++ memory = needle_len - period;
++ }
++ else
++ {
++ j += i - suffix + 1;
++ memory = 0;
++ }
++ }
++ }
++ else
++ {
++ /* The two halves of needle are distinct; no extra memory is
++ required, and any mismatch results in a maximal shift. */
++ period = MAX (suffix, needle_len - suffix) + 1;
++ j = 0;
++ while (AVAILABLE (haystack, haystack_len, j, needle_len))
++ {
++ /* Scan for matches in right half. */
++ i = suffix;
++ while (i < needle_len && (CANON_ELEMENT (needle[i])
++ == CANON_ELEMENT (haystack[i + j])))
++ ++i;
++ if (needle_len <= i)
++ {
++ /* Scan for matches in left half. */
++ i = suffix - 1;
++ while (i != SIZE_MAX && (CANON_ELEMENT (needle[i])
++ == CANON_ELEMENT (haystack[i + j])))
++ --i;
++ if (i == SIZE_MAX)
++ return (RETURN_TYPE) (haystack + j);
++ j += period;
++ }
++ else
++ j += i - suffix + 1;
++ }
++ }
++ return NULL;
++}
++
++/* Return the first location of non-empty NEEDLE within HAYSTACK, or
++ NULL. HAYSTACK_LEN is the minimum known length of HAYSTACK. This
++ method is optimized for LONG_NEEDLE_THRESHOLD <= NEEDLE_LEN.
++ Performance is guaranteed to be linear, with an initialization cost
++ of 3 * NEEDLE_LEN + (1 << CHAR_BIT) operations.
++
++ If AVAILABLE does not modify HAYSTACK_LEN (as in memmem), then at
++ most 2 * HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching,
++ and sublinear performance O(HAYSTACK_LEN / NEEDLE_LEN) is possible.
++ If AVAILABLE modifies HAYSTACK_LEN (as in strstr), then at most 3 *
++ HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching, and
++ sublinear performance is not possible. */
++static RETURN_TYPE
++two_way_long_needle (const unsigned char *haystack, size_t haystack_len,
++ const unsigned char *needle, size_t needle_len)
++{
++ size_t i; /* Index into current byte of NEEDLE. */
++ size_t j; /* Index into current window of HAYSTACK. */
++ size_t period; /* The period of the right half of needle. */
++ size_t suffix; /* The index of the right half of needle. */
++ size_t shift_table[1U << CHAR_BIT]; /* See below. */
++
++ /* Factor the needle into two halves, such that the left half is
++ smaller than the global period, and the right half is
++ periodic (with a period as large as NEEDLE_LEN - suffix). */
++ suffix = critical_factorization (needle, needle_len, &period);
++
++ /* Populate shift_table. For each possible byte value c,
++ shift_table[c] is the distance from the last occurrence of c to
++ the end of NEEDLE, or NEEDLE_LEN if c is absent from the NEEDLE.
++ shift_table[NEEDLE[NEEDLE_LEN - 1]] contains the only 0. */
++ for (i = 0; i < 1U << CHAR_BIT; i++)
++ shift_table[i] = needle_len;
++ for (i = 0; i < needle_len; i++)
++ shift_table[CANON_ELEMENT (needle[i])] = needle_len - i - 1;
++
++ /* Perform the search. Each iteration compares the right half
++ first. */
++ if (CMP_FUNC (needle, needle + period, suffix) == 0)
++ {
++ /* Entire needle is periodic; a mismatch in the left half can
++ only advance by the period, so use memory to avoid rescanning
++ known occurrences of the period in the right half. */
++ size_t memory = 0;
++ size_t shift;
++ j = 0;
++ while (AVAILABLE (haystack, haystack_len, j, needle_len))
++ {
++ /* Check the last byte first; if it does not match, then
++ shift to the next possible match location. */
++ shift = shift_table[CANON_ELEMENT (haystack[j + needle_len - 1])];
++ if (0 < shift)
++ {
++ if (memory && shift < period)
++ {
++ /* Since needle is periodic, but the last period has
++ a byte out of place, there can be no match until
++ after the mismatch. */
++ shift = needle_len - period;
++ }
++ memory = 0;
++ j += shift;
++ continue;
++ }
++ /* Scan for matches in right half. The last byte has
++ already been matched, by virtue of the shift table. */
++ i = MAX (suffix, memory);
++ while (i < needle_len - 1 && (CANON_ELEMENT (needle[i])
++ == CANON_ELEMENT (haystack[i + j])))
++ ++i;
++ if (needle_len - 1 <= i)
++ {
++ /* Scan for matches in left half. */
++ i = suffix - 1;
++ while (memory < i + 1 && (CANON_ELEMENT (needle[i])
++ == CANON_ELEMENT (haystack[i + j])))
++ --i;
++ if (i + 1 < memory + 1)
++ return (RETURN_TYPE) (haystack + j);
++ /* No match, so remember how many repetitions of period
++ on the right half were scanned. */
++ j += period;
++ memory = needle_len - period;
++ }
++ else
++ {
++ j += i - suffix + 1;
++ memory = 0;
++ }
++ }
++ }
++ else
++ {
++ /* The two halves of needle are distinct; no extra memory is
++ required, and any mismatch results in a maximal shift. */
++ size_t shift;
++ period = MAX (suffix, needle_len - suffix) + 1;
++ j = 0;
++ while (AVAILABLE (haystack, haystack_len, j, needle_len))
++ {
++ /* Check the last byte first; if it does not match, then
++ shift to the next possible match location. */
++ shift = shift_table[CANON_ELEMENT (haystack[j + needle_len - 1])];
++ if (0 < shift)
++ {
++ j += shift;
++ continue;
++ }
++ /* Scan for matches in right half. The last byte has
++ already been matched, by virtue of the shift table. */
++ i = suffix;
++ while (i < needle_len - 1 && (CANON_ELEMENT (needle[i])
++ == CANON_ELEMENT (haystack[i + j])))
++ ++i;
++ if (needle_len - 1 <= i)
++ {
++ /* Scan for matches in left half. */
++ i = suffix - 1;
++ while (i != SIZE_MAX && (CANON_ELEMENT (needle[i])
++ == CANON_ELEMENT (haystack[i + j])))
++ --i;
++ if (i == SIZE_MAX)
++ return (RETURN_TYPE) (haystack + j);
++ j += period;
++ }
++ else
++ j += i - suffix + 1;
++ }
++ }
++ return NULL;
++}
++
++#undef AVAILABLE
++#undef CANON_ELEMENT
++#undef CMP_FUNC
++#undef MAX
++#undef RETURN_TYPE
+diff --git a/lib/strcasecmp.c b/lib/strcasecmp.c
+new file mode 100644
+index 0000000..cb1a875
+--- /dev/null
++++ b/lib/strcasecmp.c
+@@ -0,0 +1,62 @@
++/* Case-insensitive string comparison function.
++ Copyright (C) 1998-1999, 2005-2007, 2009-2012 Free Software Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program; if not, see <http://www.gnu.org/licenses/>. */
++
++#include <config.h>
++
++/* Specification. */
++#include <string.h>
++
++#include <ctype.h>
++#include <limits.h>
++
++#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
++
++/* Compare strings S1 and S2, ignoring case, returning less than, equal to or
++ greater than zero if S1 is lexicographically less than, equal to or greater
++ than S2.
++ Note: This function does not work with multibyte strings! */
++
++int
++strcasecmp (const char *s1, const char *s2)
++{
++ const unsigned char *p1 = (const unsigned char *) s1;
++ const unsigned char *p2 = (const unsigned char *) s2;
++ unsigned char c1, c2;
++
++ if (p1 == p2)
++ return 0;
++
++ do
++ {
++ c1 = TOLOWER (*p1);
++ c2 = TOLOWER (*p2);
++
++ if (c1 == '\0')
++ break;
++
++ ++p1;
++ ++p2;
++ }
++ while (c1 == c2);
++
++ if (UCHAR_MAX <= INT_MAX)
++ return c1 - c2;
++ else
++ /* On machines where 'char' and 'int' are types of the same size, the
++ difference of two 'unsigned char' values - including the sign bit -
++ doesn't fit in an 'int'. */
++ return (c1 > c2 ? 1 : c1 < c2 ? -1 : 0);
++}
+diff --git a/lib/strcasestr.c b/lib/strcasestr.c
+new file mode 100644
+index 0000000..e8ce38c
+--- /dev/null
++++ b/lib/strcasestr.c
+@@ -0,0 +1,82 @@
++/* Case-insensitive searching in a string.
++ Copyright (C) 2005-2012 Free Software Foundation, Inc.
++ Written by Bruno Haible <bruno at clisp.org>, 2005.
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program; if not, see <http://www.gnu.org/licenses/>. */
++
++#include <config.h>
++
++/* Specification. */
++#include <string.h>
++
++#include <ctype.h>
++#include <stdbool.h>
++#include <strings.h>
++
++#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
++
++/* Two-Way algorithm. */
++#define RETURN_TYPE char *
++#define AVAILABLE(h, h_l, j, n_l) \
++ (!memchr ((h) + (h_l), '\0', (j) + (n_l) - (h_l)) \
++ && ((h_l) = (j) + (n_l)))
++#define CANON_ELEMENT(c) TOLOWER (c)
++#define CMP_FUNC(p1, p2, l) \
++ strncasecmp ((const char *) (p1), (const char *) (p2), l)
++#include "str-two-way.h"
++
++/* Find the first occurrence of NEEDLE in HAYSTACK, using
++ case-insensitive comparison. This function gives unspecified
++ results in multibyte locales. */
++char *
++strcasestr (const char *haystack_start, const char *needle_start)
++{
++ const char *haystack = haystack_start;
++ const char *needle = needle_start;
++ size_t needle_len; /* Length of NEEDLE. */
++ size_t haystack_len; /* Known minimum length of HAYSTACK. */
++ bool ok = true; /* True if NEEDLE is prefix of HAYSTACK. */
++
++ /* Determine length of NEEDLE, and in the process, make sure
++ HAYSTACK is at least as long (no point processing all of a long
++ NEEDLE if HAYSTACK is too short). */
++ while (*haystack && *needle)
++ {
++ ok &= (TOLOWER ((unsigned char) *haystack)
++ == TOLOWER ((unsigned char) *needle));
++ haystack++;
++ needle++;
++ }
++ if (*needle)
++ return NULL;
++ if (ok)
++ return (char *) haystack_start;
++ needle_len = needle - needle_start;
++ haystack = haystack_start + 1;
++ haystack_len = needle_len - 1;
++
++ /* Perform the search. Abstract memory is considered to be an array
++ of 'unsigned char' values, not an array of 'char' values. See
++ ISO C 99 section 6.2.6.1. */
++ if (needle_len < LONG_NEEDLE_THRESHOLD)
++ return two_way_short_needle ((const unsigned char *) haystack,
++ haystack_len,
++ (const unsigned char *) needle_start,
++ needle_len);
++ return two_way_long_needle ((const unsigned char *) haystack, haystack_len,
++ (const unsigned char *) needle_start,
++ needle_len);
++}
++
++#undef LONG_NEEDLE_THRESHOLD
+diff --git a/lib/string.in.h b/lib/string.in.h
+new file mode 100644
+index 0000000..8cbe8cd
+--- /dev/null
++++ b/lib/string.in.h
+@@ -0,0 +1,1029 @@
++/* A GNU-like <string.h>.
++
++ Copyright (C) 1995-1996, 2001-2012 Free Software Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 2, or (at your option)
++ any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program; if not, see <http://www.gnu.org/licenses/>. */
++
++#ifndef _ at GUARD_PREFIX@_STRING_H
++
++#if __GNUC__ >= 3
++ at PRAGMA_SYSTEM_HEADER@
++#endif
++ at PRAGMA_COLUMNS@
++
++/* The include_next requires a split double-inclusion guard. */
++#@INCLUDE_NEXT@ @NEXT_STRING_H@
++
++#ifndef _ at GUARD_PREFIX@_STRING_H
++#define _ at GUARD_PREFIX@_STRING_H
++
++/* NetBSD 5.0 mis-defines NULL. */
++#include <stddef.h>
++
++/* MirBSD defines mbslen as a macro. */
++#if @GNULIB_MBSLEN@ && defined __MirBSD__
++# include <wchar.h>
++#endif
++
++/* The __attribute__ feature is available in gcc versions 2.5 and later.
++ The attribute __pure__ was added in gcc 2.96. */
++#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
++# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
++#else
++# define _GL_ATTRIBUTE_PURE /* empty */
++#endif
++
++/* NetBSD 5.0 declares strsignal in <unistd.h>, not in <string.h>. */
++/* But in any case avoid namespace pollution on glibc systems. */
++#if (@GNULIB_STRSIGNAL@ || defined GNULIB_POSIXCHECK) && defined __NetBSD__ \
++ && ! defined __GLIBC__
++# include <unistd.h>
++#endif
++
++/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
++
++/* The definition of _GL_ARG_NONNULL is copied here. */
++
++/* The definition of _GL_WARN_ON_USE is copied here. */
++
++
++/* Find the index of the least-significant set bit. */
++#if @GNULIB_FFSL@
++# if !@HAVE_FFSL@
++_GL_FUNCDECL_SYS (ffsl, int, (long int i));
++# endif
++_GL_CXXALIAS_SYS (ffsl, int, (long int i));
++_GL_CXXALIASWARN (ffsl);
++#elif defined GNULIB_POSIXCHECK
++# undef ffsl
++# if HAVE_RAW_DECL_FFSL
++_GL_WARN_ON_USE (ffsl, "ffsl is not portable - use the ffsl module");
++# endif
++#endif
++
++
++/* Find the index of the least-significant set bit. */
++#if @GNULIB_FFSLL@
++# if !@HAVE_FFSLL@
++_GL_FUNCDECL_SYS (ffsll, int, (long long int i));
++# endif
++_GL_CXXALIAS_SYS (ffsll, int, (long long int i));
++_GL_CXXALIASWARN (ffsll);
++#elif defined GNULIB_POSIXCHECK
++# undef ffsll
++# if HAVE_RAW_DECL_FFSLL
++_GL_WARN_ON_USE (ffsll, "ffsll is not portable - use the ffsll module");
++# endif
++#endif
++
++
++/* Return the first instance of C within N bytes of S, or NULL. */
++#if @GNULIB_MEMCHR@
++# if @REPLACE_MEMCHR@
++# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++# define memchr rpl_memchr
++# endif
++_GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n)
++ _GL_ATTRIBUTE_PURE
++ _GL_ARG_NONNULL ((1)));
++_GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n));
++# else
++# if ! @HAVE_MEMCHR@
++_GL_FUNCDECL_SYS (memchr, void *, (void const *__s, int __c, size_t __n)
++ _GL_ATTRIBUTE_PURE
++ _GL_ARG_NONNULL ((1)));
++# endif
++ /* On some systems, this function is defined as an overloaded function:
++ extern "C" { const void * std::memchr (const void *, int, size_t); }
++ extern "C++" { void * std::memchr (void *, int, size_t); } */
++_GL_CXXALIAS_SYS_CAST2 (memchr,
++ void *, (void const *__s, int __c, size_t __n),
++ void const *, (void const *__s, int __c, size_t __n));
++# endif
++# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
++ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
++_GL_CXXALIASWARN1 (memchr, void *, (void *__s, int __c, size_t __n));
++_GL_CXXALIASWARN1 (memchr, void const *,
++ (void const *__s, int __c, size_t __n));
++# else
++_GL_CXXALIASWARN (memchr);
++# endif
++#elif defined GNULIB_POSIXCHECK
++# undef memchr
++/* Assume memchr is always declared. */
++_GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - "
++ "use gnulib module memchr for portability" );
++#endif
++
++/* Return the first occurrence of NEEDLE in HAYSTACK. */
++#if @GNULIB_MEMMEM@
++# if @REPLACE_MEMMEM@
++# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++# define memmem rpl_memmem
++# endif
++_GL_FUNCDECL_RPL (memmem, void *,
++ (void const *__haystack, size_t __haystack_len,
++ void const *__needle, size_t __needle_len)
++ _GL_ATTRIBUTE_PURE
++ _GL_ARG_NONNULL ((1, 3)));
++_GL_CXXALIAS_RPL (memmem, void *,
++ (void const *__haystack, size_t __haystack_len,
++ void const *__needle, size_t __needle_len));
++# else
++# if ! @HAVE_DECL_MEMMEM@
++_GL_FUNCDECL_SYS (memmem, void *,
++ (void const *__haystack, size_t __haystack_len,
++ void const *__needle, size_t __needle_len)
++ _GL_ATTRIBUTE_PURE
++ _GL_ARG_NONNULL ((1, 3)));
++# endif
++_GL_CXXALIAS_SYS (memmem, void *,
++ (void const *__haystack, size_t __haystack_len,
++ void const *__needle, size_t __needle_len));
++# endif
++_GL_CXXALIASWARN (memmem);
++#elif defined GNULIB_POSIXCHECK
++# undef memmem
++# if HAVE_RAW_DECL_MEMMEM
++_GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - "
++ "use gnulib module memmem-simple for portability, "
++ "and module memmem for speed" );
++# endif
++#endif
++
++/* Copy N bytes of SRC to DEST, return pointer to bytes after the
++ last written byte. */
++#if @GNULIB_MEMPCPY@
++# if ! @HAVE_MEMPCPY@
++_GL_FUNCDECL_SYS (mempcpy, void *,
++ (void *restrict __dest, void const *restrict __src,
++ size_t __n)
++ _GL_ARG_NONNULL ((1, 2)));
++# endif
++_GL_CXXALIAS_SYS (mempcpy, void *,
++ (void *restrict __dest, void const *restrict __src,
++ size_t __n));
++_GL_CXXALIASWARN (mempcpy);
++#elif defined GNULIB_POSIXCHECK
++# undef mempcpy
++# if HAVE_RAW_DECL_MEMPCPY
++_GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - "
++ "use gnulib module mempcpy for portability");
++# endif
++#endif
++
++/* Search backwards through a block for a byte (specified as an int). */
++#if @GNULIB_MEMRCHR@
++# if ! @HAVE_DECL_MEMRCHR@
++_GL_FUNCDECL_SYS (memrchr, void *, (void const *, int, size_t)
++ _GL_ATTRIBUTE_PURE
++ _GL_ARG_NONNULL ((1)));
++# endif
++ /* On some systems, this function is defined as an overloaded function:
++ extern "C++" { const void * std::memrchr (const void *, int, size_t); }
++ extern "C++" { void * std::memrchr (void *, int, size_t); } */
++_GL_CXXALIAS_SYS_CAST2 (memrchr,
++ void *, (void const *, int, size_t),
++ void const *, (void const *, int, size_t));
++# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
++ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
++_GL_CXXALIASWARN1 (memrchr, void *, (void *, int, size_t));
++_GL_CXXALIASWARN1 (memrchr, void const *, (void const *, int, size_t));
++# else
++_GL_CXXALIASWARN (memrchr);
++# endif
++#elif defined GNULIB_POSIXCHECK
++# undef memrchr
++# if HAVE_RAW_DECL_MEMRCHR
++_GL_WARN_ON_USE (memrchr, "memrchr is unportable - "
++ "use gnulib module memrchr for portability");
++# endif
++#endif
++
++/* Find the first occurrence of C in S. More efficient than
++ memchr(S,C,N), at the expense of undefined behavior if C does not
++ occur within N bytes. */
++#if @GNULIB_RAWMEMCHR@
++# if ! @HAVE_RAWMEMCHR@
++_GL_FUNCDECL_SYS (rawmemchr, void *, (void const *__s, int __c_in)
++ _GL_ATTRIBUTE_PURE
++ _GL_ARG_NONNULL ((1)));
++# endif
++ /* On some systems, this function is defined as an overloaded function:
++ extern "C++" { const void * std::rawmemchr (const void *, int); }
++ extern "C++" { void * std::rawmemchr (void *, int); } */
++_GL_CXXALIAS_SYS_CAST2 (rawmemchr,
++ void *, (void const *__s, int __c_in),
++ void const *, (void const *__s, int __c_in));
++# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
++ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
++_GL_CXXALIASWARN1 (rawmemchr, void *, (void *__s, int __c_in));
++_GL_CXXALIASWARN1 (rawmemchr, void const *, (void const *__s, int __c_in));
++# else
++_GL_CXXALIASWARN (rawmemchr);
++# endif
++#elif defined GNULIB_POSIXCHECK
++# undef rawmemchr
++# if HAVE_RAW_DECL_RAWMEMCHR
++_GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - "
++ "use gnulib module rawmemchr for portability");
++# endif
++#endif
++
++/* Copy SRC to DST, returning the address of the terminating '\0' in DST. */
++#if @GNULIB_STPCPY@
++# if ! @HAVE_STPCPY@
++_GL_FUNCDECL_SYS (stpcpy, char *,
++ (char *restrict __dst, char const *restrict __src)
++ _GL_ARG_NONNULL ((1, 2)));
++# endif
++_GL_CXXALIAS_SYS (stpcpy, char *,
++ (char *restrict __dst, char const *restrict __src));
++_GL_CXXALIASWARN (stpcpy);
++#elif defined GNULIB_POSIXCHECK
++# undef stpcpy
++# if HAVE_RAW_DECL_STPCPY
++_GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - "
++ "use gnulib module stpcpy for portability");
++# endif
++#endif
++
++/* Copy no more than N bytes of SRC to DST, returning a pointer past the
++ last non-NUL byte written into DST. */
++#if @GNULIB_STPNCPY@
++# if @REPLACE_STPNCPY@
++# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++# undef stpncpy
++# define stpncpy rpl_stpncpy
++# endif
++_GL_FUNCDECL_RPL (stpncpy, char *,
++ (char *restrict __dst, char const *restrict __src,
++ size_t __n)
++ _GL_ARG_NONNULL ((1, 2)));
++_GL_CXXALIAS_RPL (stpncpy, char *,
++ (char *restrict __dst, char const *restrict __src,
++ size_t __n));
++# else
++# if ! @HAVE_STPNCPY@
++_GL_FUNCDECL_SYS (stpncpy, char *,
++ (char *restrict __dst, char const *restrict __src,
++ size_t __n)
++ _GL_ARG_NONNULL ((1, 2)));
++# endif
++_GL_CXXALIAS_SYS (stpncpy, char *,
++ (char *restrict __dst, char const *restrict __src,
++ size_t __n));
++# endif
++_GL_CXXALIASWARN (stpncpy);
++#elif defined GNULIB_POSIXCHECK
++# undef stpncpy
++# if HAVE_RAW_DECL_STPNCPY
++_GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - "
++ "use gnulib module stpncpy for portability");
++# endif
++#endif
++
++#if defined GNULIB_POSIXCHECK
++/* strchr() does not work with multibyte strings if the locale encoding is
++ GB18030 and the character to be searched is a digit. */
++# undef strchr
++/* Assume strchr is always declared. */
++_GL_WARN_ON_USE (strchr, "strchr cannot work correctly on character strings "
++ "in some multibyte locales - "
++ "use mbschr if you care about internationalization");
++#endif
++
++/* Find the first occurrence of C in S or the final NUL byte. */
++#if @GNULIB_STRCHRNUL@
++# if @REPLACE_STRCHRNUL@
++# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++# define strchrnul rpl_strchrnul
++# endif
++_GL_FUNCDECL_RPL (strchrnul, char *, (const char *__s, int __c_in)
++ _GL_ATTRIBUTE_PURE
++ _GL_ARG_NONNULL ((1)));
++_GL_CXXALIAS_RPL (strchrnul, char *,
++ (const char *str, int ch));
++# else
++# if ! @HAVE_STRCHRNUL@
++_GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in)
++ _GL_ATTRIBUTE_PURE
++ _GL_ARG_NONNULL ((1)));
++# endif
++ /* On some systems, this function is defined as an overloaded function:
++ extern "C++" { const char * std::strchrnul (const char *, int); }
++ extern "C++" { char * std::strchrnul (char *, int); } */
++_GL_CXXALIAS_SYS_CAST2 (strchrnul,
++ char *, (char const *__s, int __c_in),
++ char const *, (char const *__s, int __c_in));
++# endif
++# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
++ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
++_GL_CXXALIASWARN1 (strchrnul, char *, (char *__s, int __c_in));
++_GL_CXXALIASWARN1 (strchrnul, char const *, (char const *__s, int __c_in));
++# else
++_GL_CXXALIASWARN (strchrnul);
++# endif
++#elif defined GNULIB_POSIXCHECK
++# undef strchrnul
++# if HAVE_RAW_DECL_STRCHRNUL
++_GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - "
++ "use gnulib module strchrnul for portability");
++# endif
++#endif
++
++/* Duplicate S, returning an identical malloc'd string. */
++#if @GNULIB_STRDUP@
++# if @REPLACE_STRDUP@
++# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++# undef strdup
++# define strdup rpl_strdup
++# endif
++_GL_FUNCDECL_RPL (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1)));
++_GL_CXXALIAS_RPL (strdup, char *, (char const *__s));
++# else
++# if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup
++ /* strdup exists as a function and as a macro. Get rid of the macro. */
++# undef strdup
++# endif
++# if !(@HAVE_DECL_STRDUP@ || defined strdup)
++_GL_FUNCDECL_SYS (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1)));
++# endif
++_GL_CXXALIAS_SYS (strdup, char *, (char const *__s));
++# endif
++_GL_CXXALIASWARN (strdup);
++#elif defined GNULIB_POSIXCHECK
++# undef strdup
++# if HAVE_RAW_DECL_STRDUP
++_GL_WARN_ON_USE (strdup, "strdup is unportable - "
++ "use gnulib module strdup for portability");
++# endif
++#endif
++
++/* Append no more than N characters from SRC onto DEST. */
++#if @GNULIB_STRNCAT@
++# if @REPLACE_STRNCAT@
++# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++# undef strncat
++# define strncat rpl_strncat
++# endif
++_GL_FUNCDECL_RPL (strncat, char *, (char *dest, const char *src, size_t n)
++ _GL_ARG_NONNULL ((1, 2)));
++_GL_CXXALIAS_RPL (strncat, char *, (char *dest, const char *src, size_t n));
++# else
++_GL_CXXALIAS_SYS (strncat, char *, (char *dest, const char *src, size_t n));
++# endif
++_GL_CXXALIASWARN (strncat);
++#elif defined GNULIB_POSIXCHECK
++# undef strncat
++# if HAVE_RAW_DECL_STRNCAT
++_GL_WARN_ON_USE (strncat, "strncat is unportable - "
++ "use gnulib module strncat for portability");
++# endif
++#endif
++
++/* Return a newly allocated copy of at most N bytes of STRING. */
++#if @GNULIB_STRNDUP@
++# if @REPLACE_STRNDUP@
++# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++# undef strndup
++# define strndup rpl_strndup
++# endif
++_GL_FUNCDECL_RPL (strndup, char *, (char const *__string, size_t __n)
++ _GL_ARG_NONNULL ((1)));
++_GL_CXXALIAS_RPL (strndup, char *, (char const *__string, size_t __n));
++# else
++# if ! @HAVE_DECL_STRNDUP@
++_GL_FUNCDECL_SYS (strndup, char *, (char const *__string, size_t __n)
++ _GL_ARG_NONNULL ((1)));
++# endif
++_GL_CXXALIAS_SYS (strndup, char *, (char const *__string, size_t __n));
++# endif
++_GL_CXXALIASWARN (strndup);
++#elif defined GNULIB_POSIXCHECK
++# undef strndup
++# if HAVE_RAW_DECL_STRNDUP
++_GL_WARN_ON_USE (strndup, "strndup is unportable - "
++ "use gnulib module strndup for portability");
++# endif
++#endif
++
++/* Find the length (number of bytes) of STRING, but scan at most
++ MAXLEN bytes. If no '\0' terminator is found in that many bytes,
++ return MAXLEN. */
++#if @GNULIB_STRNLEN@
++# if @REPLACE_STRNLEN@
++# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++# undef strnlen
++# define strnlen rpl_strnlen
++# endif
++_GL_FUNCDECL_RPL (strnlen, size_t, (char const *__string, size_t __maxlen)
++ _GL_ATTRIBUTE_PURE
++ _GL_ARG_NONNULL ((1)));
++_GL_CXXALIAS_RPL (strnlen, size_t, (char const *__string, size_t __maxlen));
++# else
++# if ! @HAVE_DECL_STRNLEN@
++_GL_FUNCDECL_SYS (strnlen, size_t, (char const *__string, size_t __maxlen)
++ _GL_ATTRIBUTE_PURE
++ _GL_ARG_NONNULL ((1)));
++# endif
++_GL_CXXALIAS_SYS (strnlen, size_t, (char const *__string, size_t __maxlen));
++# endif
++_GL_CXXALIASWARN (strnlen);
++#elif defined GNULIB_POSIXCHECK
++# undef strnlen
++# if HAVE_RAW_DECL_STRNLEN
++_GL_WARN_ON_USE (strnlen, "strnlen is unportable - "
++ "use gnulib module strnlen for portability");
++# endif
++#endif
++
++#if defined GNULIB_POSIXCHECK
++/* strcspn() assumes the second argument is a list of single-byte characters.
++ Even in this simple case, it does not work with multibyte strings if the
++ locale encoding is GB18030 and one of the characters to be searched is a
++ digit. */
++# undef strcspn
++/* Assume strcspn is always declared. */
++_GL_WARN_ON_USE (strcspn, "strcspn cannot work correctly on character strings "
++ "in multibyte locales - "
++ "use mbscspn if you care about internationalization");
++#endif
++
++/* Find the first occurrence in S of any character in ACCEPT. */
++#if @GNULIB_STRPBRK@
++# if ! @HAVE_STRPBRK@
++_GL_FUNCDECL_SYS (strpbrk, char *, (char const *__s, char const *__accept)
++ _GL_ATTRIBUTE_PURE
++ _GL_ARG_NONNULL ((1, 2)));
++# endif
++ /* On some systems, this function is defined as an overloaded function:
++ extern "C" { const char * strpbrk (const char *, const char *); }
++ extern "C++" { char * strpbrk (char *, const char *); } */
++_GL_CXXALIAS_SYS_CAST2 (strpbrk,
++ char *, (char const *__s, char const *__accept),
++ const char *, (char const *__s, char const *__accept));
++# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
++ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
++_GL_CXXALIASWARN1 (strpbrk, char *, (char *__s, char const *__accept));
++_GL_CXXALIASWARN1 (strpbrk, char const *,
++ (char const *__s, char const *__accept));
++# else
++_GL_CXXALIASWARN (strpbrk);
++# endif
++# if defined GNULIB_POSIXCHECK
++/* strpbrk() assumes the second argument is a list of single-byte characters.
++ Even in this simple case, it does not work with multibyte strings if the
++ locale encoding is GB18030 and one of the characters to be searched is a
++ digit. */
++# undef strpbrk
++_GL_WARN_ON_USE (strpbrk, "strpbrk cannot work correctly on character strings "
++ "in multibyte locales - "
++ "use mbspbrk if you care about internationalization");
++# endif
++#elif defined GNULIB_POSIXCHECK
++# undef strpbrk
++# if HAVE_RAW_DECL_STRPBRK
++_GL_WARN_ON_USE (strpbrk, "strpbrk is unportable - "
++ "use gnulib module strpbrk for portability");
++# endif
++#endif
++
++#if defined GNULIB_POSIXCHECK
++/* strspn() assumes the second argument is a list of single-byte characters.
++ Even in this simple case, it cannot work with multibyte strings. */
++# undef strspn
++/* Assume strspn is always declared. */
++_GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings "
++ "in multibyte locales - "
++ "use mbsspn if you care about internationalization");
++#endif
++
++#if defined GNULIB_POSIXCHECK
++/* strrchr() does not work with multibyte strings if the locale encoding is
++ GB18030 and the character to be searched is a digit. */
++# undef strrchr
++/* Assume strrchr is always declared. */
++_GL_WARN_ON_USE (strrchr, "strrchr cannot work correctly on character strings "
++ "in some multibyte locales - "
++ "use mbsrchr if you care about internationalization");
++#endif
++
++/* Search the next delimiter (char listed in DELIM) starting at *STRINGP.
++ If one is found, overwrite it with a NUL, and advance *STRINGP
++ to point to the next char after it. Otherwise, set *STRINGP to NULL.
++ If *STRINGP was already NULL, nothing happens.
++ Return the old value of *STRINGP.
++
++ This is a variant of strtok() that is multithread-safe and supports
++ empty fields.
++
++ Caveat: It modifies the original string.
++ Caveat: These functions cannot be used on constant strings.
++ Caveat: The identity of the delimiting character is lost.
++ Caveat: It doesn't work with multibyte strings unless all of the delimiter
++ characters are ASCII characters < 0x30.
++
++ See also strtok_r(). */
++#if @GNULIB_STRSEP@
++# if ! @HAVE_STRSEP@
++_GL_FUNCDECL_SYS (strsep, char *,
++ (char **restrict __stringp, char const *restrict __delim)
++ _GL_ARG_NONNULL ((1, 2)));
++# endif
++_GL_CXXALIAS_SYS (strsep, char *,
++ (char **restrict __stringp, char const *restrict __delim));
++_GL_CXXALIASWARN (strsep);
++# if defined GNULIB_POSIXCHECK
++# undef strsep
++_GL_WARN_ON_USE (strsep, "strsep cannot work correctly on character strings "
++ "in multibyte locales - "
++ "use mbssep if you care about internationalization");
++# endif
++#elif defined GNULIB_POSIXCHECK
++# undef strsep
++# if HAVE_RAW_DECL_STRSEP
++_GL_WARN_ON_USE (strsep, "strsep is unportable - "
++ "use gnulib module strsep for portability");
++# endif
++#endif
++
++#if @GNULIB_STRSTR@
++# if @REPLACE_STRSTR@
++# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++# define strstr rpl_strstr
++# endif
++_GL_FUNCDECL_RPL (strstr, char *, (const char *haystack, const char *needle)
++ _GL_ATTRIBUTE_PURE
++ _GL_ARG_NONNULL ((1, 2)));
++_GL_CXXALIAS_RPL (strstr, char *, (const char *haystack, const char *needle));
++# else
++ /* On some systems, this function is defined as an overloaded function:
++ extern "C++" { const char * strstr (const char *, const char *); }
++ extern "C++" { char * strstr (char *, const char *); } */
++_GL_CXXALIAS_SYS_CAST2 (strstr,
++ char *, (const char *haystack, const char *needle),
++ const char *, (const char *haystack, const char *needle));
++# endif
++# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
++ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
++_GL_CXXALIASWARN1 (strstr, char *, (char *haystack, const char *needle));
++_GL_CXXALIASWARN1 (strstr, const char *,
++ (const char *haystack, const char *needle));
++# else
++_GL_CXXALIASWARN (strstr);
++# endif
++#elif defined GNULIB_POSIXCHECK
++/* strstr() does not work with multibyte strings if the locale encoding is
++ different from UTF-8:
++ POSIX says that it operates on "strings", and "string" in POSIX is defined
++ as a sequence of bytes, not of characters. */
++# undef strstr
++/* Assume strstr is always declared. */
++_GL_WARN_ON_USE (strstr, "strstr is quadratic on many systems, and cannot "
++ "work correctly on character strings in most "
++ "multibyte locales - "
++ "use mbsstr if you care about internationalization, "
++ "or use strstr if you care about speed");
++#endif
++
++/* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive
++ comparison. */
++#if @GNULIB_STRCASESTR@
++# if @REPLACE_STRCASESTR@
++# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++# define strcasestr rpl_strcasestr
++# endif
++_GL_FUNCDECL_RPL (strcasestr, char *,
++ (const char *haystack, const char *needle)
++ _GL_ATTRIBUTE_PURE
++ _GL_ARG_NONNULL ((1, 2)));
++_GL_CXXALIAS_RPL (strcasestr, char *,
++ (const char *haystack, const char *needle));
++# else
++# if ! @HAVE_STRCASESTR@
++_GL_FUNCDECL_SYS (strcasestr, char *,
++ (const char *haystack, const char *needle)
++ _GL_ATTRIBUTE_PURE
++ _GL_ARG_NONNULL ((1, 2)));
++# endif
++ /* On some systems, this function is defined as an overloaded function:
++ extern "C++" { const char * strcasestr (const char *, const char *); }
++ extern "C++" { char * strcasestr (char *, const char *); } */
++_GL_CXXALIAS_SYS_CAST2 (strcasestr,
++ char *, (const char *haystack, const char *needle),
++ const char *, (const char *haystack, const char *needle));
++# endif
++# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
++ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
++_GL_CXXALIASWARN1 (strcasestr, char *, (char *haystack, const char *needle));
++_GL_CXXALIASWARN1 (strcasestr, const char *,
++ (const char *haystack, const char *needle));
++# else
++_GL_CXXALIASWARN (strcasestr);
++# endif
++#elif defined GNULIB_POSIXCHECK
++/* strcasestr() does not work with multibyte strings:
++ It is a glibc extension, and glibc implements it only for unibyte
++ locales. */
++# undef strcasestr
++# if HAVE_RAW_DECL_STRCASESTR
++_GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character "
++ "strings in multibyte locales - "
++ "use mbscasestr if you care about "
++ "internationalization, or use c-strcasestr if you want "
++ "a locale independent function");
++# endif
++#endif
++
++/* Parse S into tokens separated by characters in DELIM.
++ If S is NULL, the saved pointer in SAVE_PTR is used as
++ the next starting point. For example:
++ char s[] = "-abc-=-def";
++ char *sp;
++ x = strtok_r(s, "-", &sp); // x = "abc", sp = "=-def"
++ x = strtok_r(NULL, "-=", &sp); // x = "def", sp = NULL
++ x = strtok_r(NULL, "=", &sp); // x = NULL
++ // s = "abc\0-def\0"
++
++ This is a variant of strtok() that is multithread-safe.
++
++ For the POSIX documentation for this function, see:
++ http://www.opengroup.org/susv3xsh/strtok.html
++
++ Caveat: It modifies the original string.
++ Caveat: These functions cannot be used on constant strings.
++ Caveat: The identity of the delimiting character is lost.
++ Caveat: It doesn't work with multibyte strings unless all of the delimiter
++ characters are ASCII characters < 0x30.
++
++ See also strsep(). */
++#if @GNULIB_STRTOK_R@
++# if @REPLACE_STRTOK_R@
++# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++# undef strtok_r
++# define strtok_r rpl_strtok_r
++# endif
++_GL_FUNCDECL_RPL (strtok_r, char *,
++ (char *restrict s, char const *restrict delim,
++ char **restrict save_ptr)
++ _GL_ARG_NONNULL ((2, 3)));
++_GL_CXXALIAS_RPL (strtok_r, char *,
++ (char *restrict s, char const *restrict delim,
++ char **restrict save_ptr));
++# else
++# if @UNDEFINE_STRTOK_R@ || defined GNULIB_POSIXCHECK
++# undef strtok_r
++# endif
++# if ! @HAVE_DECL_STRTOK_R@
++_GL_FUNCDECL_SYS (strtok_r, char *,
++ (char *restrict s, char const *restrict delim,
++ char **restrict save_ptr)
++ _GL_ARG_NONNULL ((2, 3)));
++# endif
++_GL_CXXALIAS_SYS (strtok_r, char *,
++ (char *restrict s, char const *restrict delim,
++ char **restrict save_ptr));
++# endif
++_GL_CXXALIASWARN (strtok_r);
++# if defined GNULIB_POSIXCHECK
++_GL_WARN_ON_USE (strtok_r, "strtok_r cannot work correctly on character "
++ "strings in multibyte locales - "
++ "use mbstok_r if you care about internationalization");
++# endif
++#elif defined GNULIB_POSIXCHECK
++# undef strtok_r
++# if HAVE_RAW_DECL_STRTOK_R
++_GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - "
++ "use gnulib module strtok_r for portability");
++# endif
++#endif
++
++
++/* The following functions are not specified by POSIX. They are gnulib
++ extensions. */
++
++#if @GNULIB_MBSLEN@
++/* Return the number of multibyte characters in the character string STRING.
++ This considers multibyte characters, unlike strlen, which counts bytes. */
++# ifdef __MirBSD__ /* MirBSD defines mbslen as a macro. Override it. */
++# undef mbslen
++# endif
++# if @HAVE_MBSLEN@ /* AIX, OSF/1, MirBSD define mbslen already in libc. */
++# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++# define mbslen rpl_mbslen
++# endif
++_GL_FUNCDECL_RPL (mbslen, size_t, (const char *string)
++ _GL_ATTRIBUTE_PURE
++ _GL_ARG_NONNULL ((1)));
++_GL_CXXALIAS_RPL (mbslen, size_t, (const char *string));
++# else
++_GL_FUNCDECL_SYS (mbslen, size_t, (const char *string)
++ _GL_ATTRIBUTE_PURE
++ _GL_ARG_NONNULL ((1)));
++_GL_CXXALIAS_SYS (mbslen, size_t, (const char *string));
++# endif
++_GL_CXXALIASWARN (mbslen);
++#endif
++
++#if @GNULIB_MBSNLEN@
++/* Return the number of multibyte characters in the character string starting
++ at STRING and ending at STRING + LEN. */
++_GL_EXTERN_C size_t mbsnlen (const char *string, size_t len)
++ _GL_ATTRIBUTE_PURE
++ _GL_ARG_NONNULL ((1));
++#endif
++
++#if @GNULIB_MBSCHR@
++/* Locate the first single-byte character C in the character string STRING,
++ and return a pointer to it. Return NULL if C is not found in STRING.
++ Unlike strchr(), this function works correctly in multibyte locales with
++ encodings such as GB18030. */
++# if defined __hpux
++# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++# define mbschr rpl_mbschr /* avoid collision with HP-UX function */
++# endif
++_GL_FUNCDECL_RPL (mbschr, char *, (const char *string, int c)
++ _GL_ATTRIBUTE_PURE
++ _GL_ARG_NONNULL ((1)));
++_GL_CXXALIAS_RPL (mbschr, char *, (const char *string, int c));
++# else
++_GL_FUNCDECL_SYS (mbschr, char *, (const char *string, int c)
++ _GL_ATTRIBUTE_PURE
++ _GL_ARG_NONNULL ((1)));
++_GL_CXXALIAS_SYS (mbschr, char *, (const char *string, int c));
++# endif
++_GL_CXXALIASWARN (mbschr);
++#endif
++
++#if @GNULIB_MBSRCHR@
++/* Locate the last single-byte character C in the character string STRING,
++ and return a pointer to it. Return NULL if C is not found in STRING.
++ Unlike strrchr(), this function works correctly in multibyte locales with
++ encodings such as GB18030. */
++# if defined __hpux || defined __INTERIX
++# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++# define mbsrchr rpl_mbsrchr /* avoid collision with system function */
++# endif
++_GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c)
++ _GL_ATTRIBUTE_PURE
++ _GL_ARG_NONNULL ((1)));
++_GL_CXXALIAS_RPL (mbsrchr, char *, (const char *string, int c));
++# else
++_GL_FUNCDECL_SYS (mbsrchr, char *, (const char *string, int c)
++ _GL_ATTRIBUTE_PURE
++ _GL_ARG_NONNULL ((1)));
++_GL_CXXALIAS_SYS (mbsrchr, char *, (const char *string, int c));
++# endif
++_GL_CXXALIASWARN (mbsrchr);
++#endif
++
++#if @GNULIB_MBSSTR@
++/* Find the first occurrence of the character string NEEDLE in the character
++ string HAYSTACK. Return NULL if NEEDLE is not found in HAYSTACK.
++ Unlike strstr(), this function works correctly in multibyte locales with
++ encodings different from UTF-8. */
++_GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle)
++ _GL_ATTRIBUTE_PURE
++ _GL_ARG_NONNULL ((1, 2));
++#endif
++
++#if @GNULIB_MBSCASECMP@
++/* Compare the character strings S1 and S2, ignoring case, returning less than,
++ equal to or greater than zero if S1 is lexicographically less than, equal to
++ or greater than S2.
++ Note: This function may, in multibyte locales, return 0 for strings of
++ different lengths!
++ Unlike strcasecmp(), this function works correctly in multibyte locales. */
++_GL_EXTERN_C int mbscasecmp (const char *s1, const char *s2)
++ _GL_ATTRIBUTE_PURE
++ _GL_ARG_NONNULL ((1, 2));
++#endif
++
++#if @GNULIB_MBSNCASECMP@
++/* Compare the initial segment of the character string S1 consisting of at most
++ N characters with the initial segment of the character string S2 consisting
++ of at most N characters, ignoring case, returning less than, equal to or
++ greater than zero if the initial segment of S1 is lexicographically less
++ than, equal to or greater than the initial segment of S2.
++ Note: This function may, in multibyte locales, return 0 for initial segments
++ of different lengths!
++ Unlike strncasecmp(), this function works correctly in multibyte locales.
++ But beware that N is not a byte count but a character count! */
++_GL_EXTERN_C int mbsncasecmp (const char *s1, const char *s2, size_t n)
++ _GL_ATTRIBUTE_PURE
++ _GL_ARG_NONNULL ((1, 2));
++#endif
++
++#if @GNULIB_MBSPCASECMP@
++/* Compare the initial segment of the character string STRING consisting of
++ at most mbslen (PREFIX) characters with the character string PREFIX,
++ ignoring case. If the two match, return a pointer to the first byte
++ after this prefix in STRING. Otherwise, return NULL.
++ Note: This function may, in multibyte locales, return non-NULL if STRING
++ is of smaller length than PREFIX!
++ Unlike strncasecmp(), this function works correctly in multibyte
++ locales. */
++_GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix)
++ _GL_ATTRIBUTE_PURE
++ _GL_ARG_NONNULL ((1, 2));
++#endif
++
++#if @GNULIB_MBSCASESTR@
++/* Find the first occurrence of the character string NEEDLE in the character
++ string HAYSTACK, using case-insensitive comparison.
++ Note: This function may, in multibyte locales, return success even if
++ strlen (haystack) < strlen (needle) !
++ Unlike strcasestr(), this function works correctly in multibyte locales. */
++_GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle)
++ _GL_ATTRIBUTE_PURE
++ _GL_ARG_NONNULL ((1, 2));
++#endif
++
++#if @GNULIB_MBSCSPN@
++/* Find the first occurrence in the character string STRING of any character
++ in the character string ACCEPT. Return the number of bytes from the
++ beginning of the string to this occurrence, or to the end of the string
++ if none exists.
++ Unlike strcspn(), this function works correctly in multibyte locales. */
++_GL_EXTERN_C size_t mbscspn (const char *string, const char *accept)
++ _GL_ATTRIBUTE_PURE
++ _GL_ARG_NONNULL ((1, 2));
++#endif
++
++#if @GNULIB_MBSPBRK@
++/* Find the first occurrence in the character string STRING of any character
++ in the character string ACCEPT. Return the pointer to it, or NULL if none
++ exists.
++ Unlike strpbrk(), this function works correctly in multibyte locales. */
++# if defined __hpux
++# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++# define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */
++# endif
++_GL_FUNCDECL_RPL (mbspbrk, char *, (const char *string, const char *accept)
++ _GL_ATTRIBUTE_PURE
++ _GL_ARG_NONNULL ((1, 2)));
++_GL_CXXALIAS_RPL (mbspbrk, char *, (const char *string, const char *accept));
++# else
++_GL_FUNCDECL_SYS (mbspbrk, char *, (const char *string, const char *accept)
++ _GL_ATTRIBUTE_PURE
++ _GL_ARG_NONNULL ((1, 2)));
++_GL_CXXALIAS_SYS (mbspbrk, char *, (const char *string, const char *accept));
++# endif
++_GL_CXXALIASWARN (mbspbrk);
++#endif
++
++#if @GNULIB_MBSSPN@
++/* Find the first occurrence in the character string STRING of any character
++ not in the character string REJECT. Return the number of bytes from the
++ beginning of the string to this occurrence, or to the end of the string
++ if none exists.
++ Unlike strspn(), this function works correctly in multibyte locales. */
++_GL_EXTERN_C size_t mbsspn (const char *string, const char *reject)
++ _GL_ATTRIBUTE_PURE
++ _GL_ARG_NONNULL ((1, 2));
++#endif
++
++#if @GNULIB_MBSSEP@
++/* Search the next delimiter (multibyte character listed in the character
++ string DELIM) starting at the character string *STRINGP.
++ If one is found, overwrite it with a NUL, and advance *STRINGP to point
++ to the next multibyte character after it. Otherwise, set *STRINGP to NULL.
++ If *STRINGP was already NULL, nothing happens.
++ Return the old value of *STRINGP.
++
++ This is a variant of mbstok_r() that supports empty fields.
++
++ Caveat: It modifies the original string.
++ Caveat: These functions cannot be used on constant strings.
++ Caveat: The identity of the delimiting character is lost.
++
++ See also mbstok_r(). */
++_GL_EXTERN_C char * mbssep (char **stringp, const char *delim)
++ _GL_ARG_NONNULL ((1, 2));
++#endif
++
++#if @GNULIB_MBSTOK_R@
++/* Parse the character string STRING into tokens separated by characters in
++ the character string DELIM.
++ If STRING is NULL, the saved pointer in SAVE_PTR is used as
++ the next starting point. For example:
++ char s[] = "-abc-=-def";
++ char *sp;
++ x = mbstok_r(s, "-", &sp); // x = "abc", sp = "=-def"
++ x = mbstok_r(NULL, "-=", &sp); // x = "def", sp = NULL
++ x = mbstok_r(NULL, "=", &sp); // x = NULL
++ // s = "abc\0-def\0"
++
++ Caveat: It modifies the original string.
++ Caveat: These functions cannot be used on constant strings.
++ Caveat: The identity of the delimiting character is lost.
++
++ See also mbssep(). */
++_GL_EXTERN_C char * mbstok_r (char *string, const char *delim, char **save_ptr)
++ _GL_ARG_NONNULL ((2, 3));
++#endif
++
++/* Map any int, typically from errno, into an error message. */
++#if @GNULIB_STRERROR@
++# if @REPLACE_STRERROR@
++# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++# undef strerror
++# define strerror rpl_strerror
++# endif
++_GL_FUNCDECL_RPL (strerror, char *, (int));
++_GL_CXXALIAS_RPL (strerror, char *, (int));
++# else
++_GL_CXXALIAS_SYS (strerror, char *, (int));
++# endif
++_GL_CXXALIASWARN (strerror);
++#elif defined GNULIB_POSIXCHECK
++# undef strerror
++/* Assume strerror is always declared. */
++_GL_WARN_ON_USE (strerror, "strerror is unportable - "
++ "use gnulib module strerror to guarantee non-NULL result");
++#endif
++
++/* Map any int, typically from errno, into an error message. Multithread-safe.
++ Uses the POSIX declaration, not the glibc declaration. */
++#if @GNULIB_STRERROR_R@
++# if @REPLACE_STRERROR_R@
++# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++# undef strerror_r
++# define strerror_r rpl_strerror_r
++# endif
++_GL_FUNCDECL_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen)
++ _GL_ARG_NONNULL ((2)));
++_GL_CXXALIAS_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen));
++# else
++# if !@HAVE_DECL_STRERROR_R@
++_GL_FUNCDECL_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen)
++ _GL_ARG_NONNULL ((2)));
++# endif
++_GL_CXXALIAS_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen));
++# endif
++# if @HAVE_DECL_STRERROR_R@
++_GL_CXXALIASWARN (strerror_r);
++# endif
++#elif defined GNULIB_POSIXCHECK
++# undef strerror_r
++# if HAVE_RAW_DECL_STRERROR_R
++_GL_WARN_ON_USE (strerror_r, "strerror_r is unportable - "
++ "use gnulib module strerror_r-posix for portability");
++# endif
++#endif
++
++#if @GNULIB_STRSIGNAL@
++# if @REPLACE_STRSIGNAL@
++# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
++# define strsignal rpl_strsignal
++# endif
++_GL_FUNCDECL_RPL (strsignal, char *, (int __sig));
++_GL_CXXALIAS_RPL (strsignal, char *, (int __sig));
++# else
++# if ! @HAVE_DECL_STRSIGNAL@
++_GL_FUNCDECL_SYS (strsignal, char *, (int __sig));
++# endif
@@ Diff output truncated at 100000 characters. @@
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the devel
mailing list