summaryrefslogtreecommitdiff
path: root/gl
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2007-01-31 04:48:42 +0000
committerSimon Josefsson <simon@josefsson.org>2007-01-31 04:48:42 +0000
commite7fb1c2a2085133739a9e661866f97da146d8137 (patch)
tree593e71e3da1e85175a201b8e682c3a959492994d /gl
parent554e4119202f749b36c72b79b4969a1794867bcf (diff)
downloadgnutls-e7fb1c2a2085133739a9e661866f97da146d8137.tar.gz
Update.
Diffstat (limited to 'gl')
-rw-r--r--gl/getaddrinfo.c5
-rw-r--r--gl/gnulib.mk40
-rw-r--r--gl/m4/absolute-header.m444
-rw-r--r--gl/m4/extensions.m458
-rw-r--r--gl/m4/gnulib-common.m411
-rw-r--r--gl/m4/gnulib-comp.m49
-rw-r--r--gl/m4/strdup.m411
-rw-r--r--gl/m4/string_h.m446
-rw-r--r--gl/socket_.h10
-rw-r--r--gl/strdup.c8
-rw-r--r--gl/string_.h182
11 files changed, 411 insertions, 13 deletions
diff --git a/gl/getaddrinfo.c b/gl/getaddrinfo.c
index f523f7658e..add56ba1bd 100644
--- a/gl/getaddrinfo.c
+++ b/gl/getaddrinfo.c
@@ -1,5 +1,5 @@
/* Get address information (partial implementation).
- Copyright (C) 1997, 2001, 2002, 2004, 2005, 2006 Free Software
+ Copyright (C) 1997, 2001, 2002, 2004, 2005, 2006, 2007 Free Software
Foundation, Inc.
Contributed by Simon Josefsson <simon@josefsson.org>.
@@ -28,7 +28,7 @@
/* Get calloc. */
#include <stdlib.h>
-/* Get memcpy. */
+/* Get memcpy, strdup. */
#include <string.h>
#include <stdbool.h>
@@ -39,7 +39,6 @@
#include "inet_ntop.h"
#include "snprintf.h"
-#include "strdup.h"
/* BeOS has AF_INET, but not PF_INET. */
#ifndef PF_INET
diff --git a/gl/gnulib.mk b/gl/gnulib.mk
index 8cadb62120..85c3104bdc 100644
--- a/gl/gnulib.mk
+++ b/gl/gnulib.mk
@@ -148,12 +148,48 @@ EXTRA_DIST += stdbool_.h
## begin gnulib module strdup
-EXTRA_DIST += strdup.c strdup.h
+EXTRA_DIST += strdup.c
EXTRA_libgnu_la_SOURCES += strdup.c
## end gnulib module strdup
+## 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_.h
+ rm -f $@-t $@
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+ sed -e 's|@''ABSOLUTE_STRING_H''@|$(ABSOLUTE_STRING_H)|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_STPCPY''@|$(HAVE_STPCPY)|g' \
+ -e 's|@''HAVE_STPNCPY''@|$(HAVE_STPNCPY)|g' \
+ -e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \
+ -e 's|@''HAVE_STRCHRNUL''@|$(HAVE_STRCHRNUL)|g' \
+ -e 's|@''HAVE_DECL_STRDUP''@|$(HAVE_DECL_STRDUP)|g' \
+ -e 's|@''HAVE_STRNDUP''@|$(HAVE_STRNDUP)|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_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \
+ -e 's|@''REPLACE_STRCASECMP''@|$(REPLACE_STRCASECMP)|g' \
+ -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \
+ -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \
+ < $(srcdir)/string_.h; \
+ } > $@-t
+ mv $@-t $@
+MOSTLYCLEANFILES += string.h string.h-t
+
+EXTRA_DIST += string_.h
+
+## end gnulib module string
+
## begin gnulib module sys_socket
BUILT_SOURCES += $(SYS_SOCKET_H)
@@ -161,7 +197,7 @@ BUILT_SOURCES += $(SYS_SOCKET_H)
# We need the following in order to create <sys/socket.h> when the system
# doesn't have one that works with the given compiler.
sys/socket.h: socket_.h
- test -d sys || mkdir sys
+ @MKDIR_P@ sys
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
cat $(srcdir)/socket_.h; \
} > $@-t
diff --git a/gl/m4/absolute-header.m4 b/gl/m4/absolute-header.m4
new file mode 100644
index 0000000000..c649df0840
--- /dev/null
+++ b/gl/m4/absolute-header.m4
@@ -0,0 +1,44 @@
+# absolute-header.m4 serial 6
+dnl Copyright (C) 2006 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Derek Price.
+
+# gl_ABSOLUTE_HEADER(HEADER1 HEADER2 ...)
+# ---------------------------------------
+# Find the absolute name of a header file, assuming the header exists.
+# If the header were sys/inttypes.h, this macro would define
+# ABSOLUTE_SYS_INTTYPES_H to the `""' quoted absolute name of sys/inttypes.h
+# in config.h
+# (e.g. `#define ABSOLUTE_SYS_INTTYPES_H "///usr/include/sys/inttypes.h"').
+# The three "///" are to pacify Sun C 5.8, which otherwise would say
+# "warning: #include of /usr/include/... may be non-portable".
+# Use `""', not `<>', so that the /// cannot be confused with a C99 comment.
+AC_DEFUN([gl_ABSOLUTE_HEADER],
+[AC_LANG_PREPROC_REQUIRE()dnl
+AC_FOREACH([gl_HEADER_NAME], [$1],
+ [AS_VAR_PUSHDEF([gl_absolute_header],
+ [gl_cv_absolute_]m4_quote(m4_defn([gl_HEADER_NAME])))dnl
+ AC_CACHE_CHECK([absolute name of <]m4_quote(m4_defn([gl_HEADER_NAME]))[>],
+ m4_quote(m4_defn([gl_absolute_header])),
+ [AS_VAR_PUSHDEF([ac_header_exists],
+ [ac_cv_header_]m4_quote(m4_defn([gl_HEADER_NAME])))dnl
+ AC_CHECK_HEADERS_ONCE(m4_quote(m4_defn([gl_HEADER_NAME])))dnl
+ if test AS_VAR_GET(ac_header_exists) = yes; then
+ AC_LANG_CONFTEST([AC_LANG_SOURCE([[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]])])
+dnl eval is necessary to expand ac_cpp.
+dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell.
+ AS_VAR_SET(gl_absolute_header,
+[`(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
+sed -n '\#/]m4_quote(m4_defn([gl_HEADER_NAME]))[#{s#.*"\(.*/]m4_quote(m4_defn([gl_HEADER_NAME]))[\)".*#\1#;s#^/[^/]#//&#;p;q;}'`])
+ fi
+ AS_VAR_POPDEF([ac_header_exists])dnl
+ ])dnl
+ AC_DEFINE_UNQUOTED(AS_TR_CPP([ABSOLUTE_]m4_quote(m4_defn([gl_HEADER_NAME]))),
+ ["AS_VAR_GET(gl_absolute_header)"],
+ [Define this to an absolute name of <]m4_quote(m4_defn([gl_HEADER_NAME]))[>.])
+ AS_VAR_POPDEF([gl_absolute_header])dnl
+])dnl
+])# gl_ABSOLUTE_HEADER
diff --git a/gl/m4/extensions.m4 b/gl/m4/extensions.m4
new file mode 100644
index 0000000000..143a9e5403
--- /dev/null
+++ b/gl/m4/extensions.m4
@@ -0,0 +1,58 @@
+# serial 4 -*- Autoconf -*-
+# Enable extensions on systems that normally disable them.
+
+# Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS
+# Autoconf. Perhaps we can remove this once we can assume Autoconf
+# 2.61 or later everywhere, but since CVS Autoconf mutates rapidly
+# enough in this area it's likely we'll need to redefine
+# AC_USE_SYSTEM_EXTENSIONS for quite some time.
+
+# AC_USE_SYSTEM_EXTENSIONS
+# ------------------------
+# Enable extensions on systems that normally disable them,
+# typically due to standards-conformance issues.
+AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
+[
+ AC_BEFORE([$0], [AC_COMPILE_IFELSE])
+ AC_BEFORE([$0], [AC_RUN_IFELSE])
+
+ AC_REQUIRE([AC_GNU_SOURCE])
+ AC_REQUIRE([AC_AIX])
+ AC_REQUIRE([AC_MINIX])
+
+ AH_VERBATIM([__EXTENSIONS__],
+[/* Enable extensions on Solaris. */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# undef _POSIX_PTHREAD_SEMANTICS
+#endif
+#ifndef _TANDEM_SOURCE
+# undef _TANDEM_SOURCE
+#endif])
+ AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
+ [ac_cv_safe_to_define___extensions__],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([
+# define __EXTENSIONS__ 1
+ AC_INCLUDES_DEFAULT])],
+ [ac_cv_safe_to_define___extensions__=yes],
+ [ac_cv_safe_to_define___extensions__=no])])
+ test $ac_cv_safe_to_define___extensions__ = yes &&
+ AC_DEFINE([__EXTENSIONS__])
+ AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
+ AC_DEFINE([_TANDEM_SOURCE])
+])
+
+# gl_USE_SYSTEM_EXTENSIONS
+# ------------------------
+# Enable extensions on systems that normally disable them,
+# typically due to standards-conformance issues.
+AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS],
+ [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])])
diff --git a/gl/m4/gnulib-common.m4 b/gl/m4/gnulib-common.m4
index be4cb3389d..539801080d 100644
--- a/gl/m4/gnulib-common.m4
+++ b/gl/m4/gnulib-common.m4
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 1
+# gnulib-common.m4 serial 2
dnl Copyright (C) 2007 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -11,3 +11,12 @@ AC_DEFUN([gl_MODULE_INDICATOR],
AC_DEFINE([GNULIB_]translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___]), [1],
[Define to 1 when using the gnulib module ]$1[.])
])
+
+# AC_PROG_MKDIR_P
+# is a backport of autoconf-2.60's AC_PROG_MKDIR_P.
+# Remove this macro when we can assume autoconf >= 2.60.
+m4_ifdef([AC_PROG_MKDIR_P], [], [
+ AC_DEFUN([AC_PROG_MKDIR_P],
+ [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
+ MKDIR_P='$(mkdir_p)'
+ AC_SUBST([MKDIR_P])])])
diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4
index 02ac7350c8..e2bf48a432 100644
--- a/gl/m4/gnulib-comp.m4
+++ b/gl/m4/gnulib-comp.m4
@@ -26,6 +26,7 @@ AC_DEFUN([gl_EARLY],
m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable
AC_REQUIRE([AC_PROG_RANLIB])
AC_REQUIRE([AC_GNU_SOURCE])
+ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
AC_REQUIRE([gl_LOCK_EARLY])
])
@@ -40,6 +41,7 @@ AC_DEFUN([gl_INIT],
gl_cond_libtool=true
gl_source_base='gl'
gl_HEADER_ARPA_INET
+ dnl gl_USE_SYSTEM_EXTENSIONS must be added quite early to configure.ac.
gl_GETADDRINFO
gl_FUNC_GETDELIM
gl_FUNC_GETLINE
@@ -51,7 +53,9 @@ AC_DEFUN([gl_INIT],
gl_TYPE_SOCKLEN_T
AM_STDBOOL_H
gl_FUNC_STRDUP
+ gl_HEADER_STRING_H
gl_HEADER_SYS_SOCKET
+ AC_PROG_MKDIR_P
m4_popdef([AC_LIBSOURCES])
m4_popdef([AC_REPLACE_FUNCS])
m4_popdef([AC_LIBOBJ])
@@ -117,8 +121,10 @@ AC_DEFUN([gl_FILE_LIST], [
lib/socket_.h
lib/stdbool_.h
lib/strdup.c
- lib/strdup.h
+ lib/string_.h
+ m4/absolute-header.m4
m4/arpa_inet_h.m4
+ m4/extensions.m4
m4/getaddrinfo.m4
m4/getdelim.m4
m4/getline.m4
@@ -135,5 +141,6 @@ AC_DEFUN([gl_FILE_LIST], [
m4/sockpfaf.m4
m4/stdbool.m4
m4/strdup.m4
+ m4/string_h.m4
m4/sys_socket_h.m4
])
diff --git a/gl/m4/strdup.m4 b/gl/m4/strdup.m4
index f7786e944b..8796e9e02f 100644
--- a/gl/m4/strdup.m4
+++ b/gl/m4/strdup.m4
@@ -1,13 +1,20 @@
-# strdup.m4 serial 7
-dnl Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# strdup.m4 serial 9
+
+dnl Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software
+dnl Foundation, Inc.
+
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_STRDUP],
[
+ AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
AC_REPLACE_FUNCS(strdup)
AC_CHECK_DECLS_ONCE(strdup)
+ if test $ac_cv_have_decl_strdup = no; then
+ HAVE_DECL_STRDUP=0
+ fi
gl_PREREQ_STRDUP
])
diff --git a/gl/m4/string_h.m4 b/gl/m4/string_h.m4
new file mode 100644
index 0000000000..84db7a59ba
--- /dev/null
+++ b/gl/m4/string_h.m4
@@ -0,0 +1,46 @@
+# Configure a GNU-like replacement for <string.h>.
+
+# Copyright (C) 2007 Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# Written by Paul Eggert.
+
+AC_DEFUN([gl_HEADER_STRING_H],
+[
+ dnl Use AC_REQUIRE here, so that the default behavior below is expanded
+ dnl once only, before all statements that occur in other macros.
+ AC_REQUIRE([gl_HEADER_STRING_H_BODY])
+])
+
+AC_DEFUN([gl_HEADER_STRING_H_BODY],
+[
+ AC_REQUIRE([AC_C_RESTRICT])
+ AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
+ gl_ABSOLUTE_HEADER([string.h])
+ ABSOLUTE_STRING_H=\"$gl_cv_absolute_string_h\"
+ AC_SUBST([ABSOLUTE_STRING_H])
+])
+
+AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
+[
+ dnl Assume proper GNU behavior unless another module says otherwise.
+ HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM])
+ HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY])
+ HAVE_DECL_MEMRCHR=1; AC_SUBST([HAVE_DECL_MEMRCHR])
+ HAVE_STPCPY=1; AC_SUBST([HAVE_STPCPY])
+ HAVE_STPNCPY=1; AC_SUBST([HAVE_STPNCPY])
+ HAVE_DECL_STRNCASECMP=1; AC_SUBST([HAVE_DECL_STRNCASECMP])
+ HAVE_STRCHRNUL=1; AC_SUBST([HAVE_STRCHRNUL])
+ HAVE_DECL_STRDUP=1; AC_SUBST([HAVE_DECL_STRDUP])
+ HAVE_STRNDUP=1; AC_SUBST([HAVE_STRNDUP])
+ HAVE_DECL_STRNDUP=1; AC_SUBST([HAVE_DECL_STRNDUP])
+ HAVE_DECL_STRNLEN=1; AC_SUBST([HAVE_DECL_STRNLEN])
+ HAVE_STRPBRK=1; AC_SUBST([HAVE_STRPBRK])
+ HAVE_STRSEP=1; AC_SUBST([HAVE_STRSEP])
+ HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R])
+ REPLACE_STRCASECMP=0; AC_SUBST([REPLACE_STRCASECMP])
+ REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR])
+ REPLACE_STRCASESTR=0; AC_SUBST([REPLACE_STRCASESTR])
+])
diff --git a/gl/socket_.h b/gl/socket_.h
index fbf0483339..8b28b5ed39 100644
--- a/gl/socket_.h
+++ b/gl/socket_.h
@@ -57,4 +57,14 @@
# define SHUT_RDWR SD_BOTH
#endif
+#if defined _WIN32 || defined __WIN32__
+# define ENOTSOCK WSAENOTSOCK
+# define EADDRINUSE WSAEADDRINUSE
+# define ENETRESET WSAENETRESET
+# define ECONNABORTED WSAECONNABORTED
+# define ECONNRESET WSAECONNRESET
+# define ENOTCONN WSAENOTCONN
+# define ESHUTDOWN WSAESHUTDOWN
+#endif
+
#endif /* _SYS_SOCKET_H */
diff --git a/gl/strdup.c b/gl/strdup.c
index 17d40d622d..c614108786 100644
--- a/gl/strdup.c
+++ b/gl/strdup.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1996, 1997, 1998, 2002, 2003, 2004, 2006 Free
+/* Copyright (C) 1991, 1996, 1997, 1998, 2002, 2003, 2004, 2006, 2007 Free
Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -19,13 +19,13 @@
#ifndef _LIBC
# include <config.h>
-/* Get specification. */
-# include "strdup.h"
#endif
-#include <stdlib.h>
+/* Get specification. */
#include <string.h>
+#include <stdlib.h>
+
#undef __strdup
#ifdef _LIBC
# undef strdup
diff --git a/gl/string_.h b/gl/string_.h
new file mode 100644
index 0000000000..94d991cf06
--- /dev/null
+++ b/gl/string_.h
@@ -0,0 +1,182 @@
+/* A GNU-like <string.h>.
+
+ Copyright (C) 1995-1996, 2001-2007 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, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifndef _GL_STRING_H
+#define _GL_STRING_H
+
+#include @ABSOLUTE_STRING_H@
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Return the first occurrence of NEEDLE in HAYSTACK. */
+#if ! @HAVE_DECL_MEMMEM@
+extern void *memmem (void const *__haystack, size_t __haystack_len,
+ void const *__needle, size_t __needle_len);
+#endif
+
+/* Copy N bytes of SRC to DEST, return pointer to bytes after the
+ last written byte. */
+#if ! @HAVE_MEMPCPY@
+extern void *mempcpy (void *restrict __dest, void const *restrict __src,
+ size_t __n);
+#endif
+
+/* Search backwards through a block for a byte (specified as an int). */
+#if ! @HAVE_DECL_MEMRCHR@
+extern void *memrchr (void const *, int, size_t);
+#endif
+
+/* Copy SRC to DST, returning the address of the terminating '\0' in DST. */
+#if ! @HAVE_STPCPY@
+extern char *stpcpy (char *restrict __dst, char const *restrict __src);
+#endif
+
+/* Copy no more than N bytes of SRC to DST, returning a pointer past the
+ last non-NUL byte written into DST. */
+#if ! @HAVE_STPNCPY@
+# define stpncpy gnu_stpncpy
+extern char *stpncpy (char *restrict __dst, char const *restrict __src,
+ size_t __n);
+#endif
+
+/* 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 may, in multibyte locales, return 0 for strings of
+ different lengths!
+ No known system has a strcasecmp() function that works correctly in
+ multibyte locales. Therefore use our version always, if the
+ strcase module is available. */
+#if @REPLACE_STRCASECMP@
+# define strcasecmp rpl_strcasecmp
+extern int strcasecmp (char const *__s1, char const *__s2);
+#endif
+
+/* Compare no more than N bytes of 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 cannot work correctly in multibyte locales. */
+#if ! @HAVE_DECL_STRNCASECMP@
+extern int strncasecmp (char const *__s1, char const *__s2, size_t __n);
+#endif
+
+/* Find the first occurrence of C in S or the final NUL byte. */
+#if ! @HAVE_STRCHRNUL@
+extern char *strchrnul (char const *__s, int __c_in);
+#endif
+
+/* Duplicate S, returning an identical malloc'd string. */
+#if ! @HAVE_DECL_STRDUP@ && ! defined strdup
+extern char *strdup (char const *__s);
+#endif
+
+/* Return a newly allocated copy of at most N bytes of STRING. */
+#if ! @HAVE_STRNDUP@
+# undef strndup
+# define strndup rpl_strndup
+# if ! @HAVE_DECL_STRNDUP@
+extern char *strndup (char const *__string, size_t __n);
+# 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 ! @HAVE_DECL_STRNLEN@
+extern size_t strnlen (char const *__string, size_t __maxlen);
+#endif
+
+/* Find the first occurrence in S of any character in ACCEPT. */
+#if ! @HAVE_STRPBRK@
+extern char *strpbrk (char const *__s, char const *__accept);
+#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 ! @HAVE_STRSEP@
+extern char *strsep (char **restrict __stringp, char const *restrict __delim);
+#endif
+
+/* Find the first occurrence of NEEDLE in HAYSTACK.
+ No known system has a strstr() function that works correctly in
+ multibyte locales. Therefore use our version always, if the strstr
+ module is available. */
+#if @REPLACE_STRSTR@
+# undef strstr
+# define strstr rpl_strstr
+extern char *strstr (char const *__haystack, char const *__needle);
+#endif
+
+/* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive
+ comparison.
+ Note: This function may, in multibyte locales, return success even if
+ strlen (haystack) < strlen (needle) ! */
+#if @REPLACE_STRCASESTR@
+# undef strcasestr
+# define strcasestr rpl_strcasestr
+extern char *strcasestr (const char *haystack, const char *needle);
+#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 ! @HAVE_DECL_STRTOK_R@
+extern char *strtok_r (char *restrict __s, char const *restrict __sep,
+ char **restrict __lasts);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif