aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-02-23 08:14:11 +0000
committerChristian Grothoff <christian@grothoff.org>2011-02-23 08:14:11 +0000
commit68408afa1244d8a1efec4abbeb4068088c626940 (patch)
tree51dc99426191f64bddefc95496ce4023eecf36ba /src/util
parent9173f13cc42380833bdb1ec3e3fcd0c971ddbe74 (diff)
downloadgnunet-68408afa1244d8a1efec4abbeb4068088c626940.tar.gz
gnunet-68408afa1244d8a1efec4abbeb4068088c626940.zip
die strtok_r
Diffstat (limited to 'src/util')
-rw-r--r--src/util/libgnu/Makefile.am250
-rw-r--r--src/util/libgnu/dummy.c42
-rw-r--r--src/util/libgnu/stddef.in.h87
-rw-r--r--src/util/libgnu/string.in.h970
-rw-r--r--src/util/libgnu/strtok_r.c76
5 files changed, 0 insertions, 1425 deletions
diff --git a/src/util/libgnu/Makefile.am b/src/util/libgnu/Makefile.am
deleted file mode 100644
index b373e5297..000000000
--- a/src/util/libgnu/Makefile.am
+++ /dev/null
@@ -1,250 +0,0 @@
1## DO NOT EDIT! GENERATED AUTOMATICALLY!
2## Process this file with automake to produce Makefile.in.
3# Copyright (C) 2002-2011 Free Software Foundation, Inc.
4#
5# This file is free software, distributed under the terms of the GNU
6# General Public License. As a special exception to the GNU General
7# Public License, this file may be distributed as part of a program
8# that contains a configuration script generated by Autoconf, under
9# the same distribution terms as the rest of that program.
10#
11# Generated by gnulib-tool.
12# Reproduce by: gnulib-tool --import --dir=/home/nils/workspace/gnunet --lib=libgnu --source-base=src/util/libgnu --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --libtool --macro-prefix=gl strtok_r
13
14INCLUDES = -I$(top_srcdir)/src/include
15
16AUTOMAKE_OPTIONS = 1.5 gnits
17
18SUBDIRS =
19noinst_HEADERS =
20noinst_LIBRARIES =
21noinst_LTLIBRARIES =
22EXTRA_DIST =
23BUILT_SOURCES =
24SUFFIXES =
25MOSTLYCLEANFILES = core *.stackdump
26MOSTLYCLEANDIRS =
27CLEANFILES =
28DISTCLEANFILES =
29MAINTAINERCLEANFILES =
30
31AM_CPPFLAGS =
32AM_CFLAGS =
33
34noinst_LTLIBRARIES += libgnu.la
35
36libgnu_la_SOURCES =
37libgnu_la_LIBADD = $(gl_LTLIBOBJS)
38libgnu_la_DEPENDENCIES = $(gl_LTLIBOBJS)
39EXTRA_libgnu_la_SOURCES =
40libgnu_la_LDFLAGS = $(AM_LDFLAGS)
41libgnu_la_LDFLAGS += -no-undefined
42
43## begin gnulib module arg-nonnull
44
45# The BUILT_SOURCES created by this Makefile snippet are not used via #include
46# statements but through direct file reference. Therefore this snippet must be
47# present in all Makefile.am that need it. This is ensured by the applicability
48# 'all' defined above.
49
50BUILT_SOURCES += arg-nonnull.h
51# The arg-nonnull.h that gets inserted into generated .h files is the same as
52# build-aux/arg-nonnull.h, except that it has the copyright header cut off.
53arg-nonnull.h: $(top_srcdir)/src/include/arg-nonnull.h
54 $(AM_V_GEN)rm -f $@-t $@ && \
55 sed -n -e '/GL_ARG_NONNULL/,$$p' \
56 < $(top_srcdir)/src/include/arg-nonnull.h \
57 > $@-t && \
58 mv $@-t $@
59MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t
60
61ARG_NONNULL_H=arg-nonnull.h
62
63EXTRA_DIST += $(top_srcdir)/src/include/arg-nonnull.h
64
65## end gnulib module arg-nonnull
66
67## begin gnulib module c++defs
68
69# The BUILT_SOURCES created by this Makefile snippet are not used via #include
70# statements but through direct file reference. Therefore this snippet must be
71# present in all Makefile.am that need it. This is ensured by the applicability
72# 'all' defined above.
73
74BUILT_SOURCES += c++defs.h
75# The c++defs.h that gets inserted into generated .h files is the same as
76# build-aux/c++defs.h, except that it has the copyright header cut off.
77c++defs.h: $(top_srcdir)/src/include/c++defs.h
78 $(AM_V_GEN)rm -f $@-t $@ && \
79 sed -n -e '/_GL_CXXDEFS/,$$p' \
80 < $(top_srcdir)/src/include/c++defs.h \
81 > $@-t && \
82 mv $@-t $@
83MOSTLYCLEANFILES += c++defs.h c++defs.h-t
84
85CXXDEFS_H=c++defs.h
86
87EXTRA_DIST += $(top_srcdir)/src/include/c++defs.h
88
89## end gnulib module c++defs
90
91## begin gnulib module stddef
92
93BUILT_SOURCES += $(STDDEF_H)
94
95# We need the following in order to create <stddef.h> when the system
96# doesn't have one that works with the given compiler.
97stddef.h: stddef.in.h
98 $(AM_V_GEN)rm -f $@-t $@ && \
99 { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
100 sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
101 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
102 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
103 -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \
104 -e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \
105 -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \
106 < $(srcdir)/stddef.in.h; \
107 } > $@-t && \
108 mv $@-t $@
109MOSTLYCLEANFILES += stddef.h stddef.h-t
110
111EXTRA_DIST += stddef.in.h
112
113## end gnulib module stddef
114
115## begin gnulib module string
116
117BUILT_SOURCES += string.h
118
119# We need the following in order to create <string.h> when the system
120# doesn't have one that works with the given compiler.
121string.h: string.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
122 $(AM_V_GEN)rm -f $@-t $@ && \
123 { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
124 sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
125 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
126 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
127 -e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \
128 -e 's|@''GNULIB_MBSLEN''@|$(GNULIB_MBSLEN)|g' \
129 -e 's|@''GNULIB_MBSNLEN''@|$(GNULIB_MBSNLEN)|g' \
130 -e 's|@''GNULIB_MBSCHR''@|$(GNULIB_MBSCHR)|g' \
131 -e 's|@''GNULIB_MBSRCHR''@|$(GNULIB_MBSRCHR)|g' \
132 -e 's|@''GNULIB_MBSSTR''@|$(GNULIB_MBSSTR)|g' \
133 -e 's|@''GNULIB_MBSCASECMP''@|$(GNULIB_MBSCASECMP)|g' \
134 -e 's|@''GNULIB_MBSNCASECMP''@|$(GNULIB_MBSNCASECMP)|g' \
135 -e 's|@''GNULIB_MBSPCASECMP''@|$(GNULIB_MBSPCASECMP)|g' \
136 -e 's|@''GNULIB_MBSCASESTR''@|$(GNULIB_MBSCASESTR)|g' \
137 -e 's|@''GNULIB_MBSCSPN''@|$(GNULIB_MBSCSPN)|g' \
138 -e 's|@''GNULIB_MBSPBRK''@|$(GNULIB_MBSPBRK)|g' \
139 -e 's|@''GNULIB_MBSSPN''@|$(GNULIB_MBSSPN)|g' \
140 -e 's|@''GNULIB_MBSSEP''@|$(GNULIB_MBSSEP)|g' \
141 -e 's|@''GNULIB_MBSTOK_R''@|$(GNULIB_MBSTOK_R)|g' \
142 -e 's|@''GNULIB_MEMCHR''@|$(GNULIB_MEMCHR)|g' \
143 -e 's|@''GNULIB_MEMMEM''@|$(GNULIB_MEMMEM)|g' \
144 -e 's|@''GNULIB_MEMPCPY''@|$(GNULIB_MEMPCPY)|g' \
145 -e 's|@''GNULIB_MEMRCHR''@|$(GNULIB_MEMRCHR)|g' \
146 -e 's|@''GNULIB_RAWMEMCHR''@|$(GNULIB_RAWMEMCHR)|g' \
147 -e 's|@''GNULIB_STPCPY''@|$(GNULIB_STPCPY)|g' \
148 -e 's|@''GNULIB_STPNCPY''@|$(GNULIB_STPNCPY)|g' \
149 -e 's|@''GNULIB_STRCHRNUL''@|$(GNULIB_STRCHRNUL)|g' \
150 -e 's|@''GNULIB_STRDUP''@|$(GNULIB_STRDUP)|g' \
151 -e 's|@''GNULIB_STRNCAT''@|$(GNULIB_STRNCAT)|g' \
152 -e 's|@''GNULIB_STRNDUP''@|$(GNULIB_STRNDUP)|g' \
153 -e 's|@''GNULIB_STRNLEN''@|$(GNULIB_STRNLEN)|g' \
154 -e 's|@''GNULIB_STRPBRK''@|$(GNULIB_STRPBRK)|g' \
155 -e 's|@''GNULIB_STRSEP''@|$(GNULIB_STRSEP)|g' \
156 -e 's|@''GNULIB_STRSTR''@|$(GNULIB_STRSTR)|g' \
157 -e 's|@''GNULIB_STRCASESTR''@|$(GNULIB_STRCASESTR)|g' \
158 -e 's|@''GNULIB_STRTOK_R''@|$(GNULIB_STRTOK_R)|g' \
159 -e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \
160 -e 's|@''GNULIB_STRERROR_R''@|$(GNULIB_STRERROR_R)|g' \
161 -e 's|@''GNULIB_STRSIGNAL''@|$(GNULIB_STRSIGNAL)|g' \
162 -e 's|@''GNULIB_STRVERSCMP''@|$(GNULIB_STRVERSCMP)|g' \
163 < $(srcdir)/string.in.h | \
164 sed -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \
165 -e 's|@''HAVE_MEMCHR''@|$(HAVE_MEMCHR)|g' \
166 -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
167 -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
168 -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \
169 -e 's|@''HAVE_RAWMEMCHR''@|$(HAVE_RAWMEMCHR)|g' \
170 -e 's|@''HAVE_STPCPY''@|$(HAVE_STPCPY)|g' \
171 -e 's|@''HAVE_STPNCPY''@|$(HAVE_STPNCPY)|g' \
172 -e 's|@''HAVE_STRCHRNUL''@|$(HAVE_STRCHRNUL)|g' \
173 -e 's|@''HAVE_DECL_STRDUP''@|$(HAVE_DECL_STRDUP)|g' \
174 -e 's|@''HAVE_DECL_STRNDUP''@|$(HAVE_DECL_STRNDUP)|g' \
175 -e 's|@''HAVE_DECL_STRNLEN''@|$(HAVE_DECL_STRNLEN)|g' \
176 -e 's|@''HAVE_STRPBRK''@|$(HAVE_STRPBRK)|g' \
177 -e 's|@''HAVE_STRSEP''@|$(HAVE_STRSEP)|g' \
178 -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \
179 -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \
180 -e 's|@''HAVE_DECL_STRERROR_R''@|$(HAVE_DECL_STRERROR_R)|g' \
181 -e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \
182 -e 's|@''HAVE_STRVERSCMP''@|$(HAVE_STRVERSCMP)|g' \
183 -e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \
184 -e 's|@''REPLACE_MEMCHR''@|$(REPLACE_MEMCHR)|g' \
185 -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \
186 -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \
187 -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \
188 -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \
189 -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \
190 -e 's|@''REPLACE_STRERROR_R''@|$(REPLACE_STRERROR_R)|g' \
191 -e 's|@''REPLACE_STRNCAT''@|$(REPLACE_STRNCAT)|g' \
192 -e 's|@''REPLACE_STRNDUP''@|$(REPLACE_STRNDUP)|g' \
193 -e 's|@''REPLACE_STRNLEN''@|$(REPLACE_STRNLEN)|g' \
194 -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \
195 -e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \
196 -e 's|@''UNDEFINE_STRTOK_R''@|$(UNDEFINE_STRTOK_R)|g' \
197 -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
198 -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
199 -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
200 < $(srcdir)/string.in.h; \
201 } > $@-t && \
202 mv $@-t $@
203MOSTLYCLEANFILES += string.h string.h-t
204
205EXTRA_DIST += string.in.h
206
207## end gnulib module string
208
209## begin gnulib module strtok_r
210
211
212EXTRA_DIST += strtok_r.c
213
214EXTRA_libgnu_la_SOURCES += strtok_r.c
215
216## end gnulib module strtok_r
217
218## begin gnulib module warn-on-use
219
220BUILT_SOURCES += warn-on-use.h
221# The warn-on-use.h that gets inserted into generated .h files is the same as
222# build-aux/warn-on-use.h, except that it has the copyright header cut off.
223warn-on-use.h: $(top_srcdir)/src/include/warn-on-use.h
224 $(AM_V_GEN)rm -f $@-t $@ && \
225 sed -n -e '/^.ifndef/,$$p' \
226 < $(top_srcdir)/src/include/warn-on-use.h \
227 > $@-t && \
228 mv $@-t $@
229MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t
230
231WARN_ON_USE_H=warn-on-use.h
232
233EXTRA_DIST += $(top_srcdir)/src/include/warn-on-use.h
234
235## end gnulib module warn-on-use
236
237## begin gnulib module dummy
238
239libgnu_la_SOURCES += dummy.c
240
241## end gnulib module dummy
242
243
244mostlyclean-local: mostlyclean-generic
245 @for dir in '' $(MOSTLYCLEANDIRS); do \
246 if test -n "$$dir" && test -d $$dir; then \
247 echo "rmdir $$dir"; rmdir $$dir; \
248 fi; \
249 done; \
250 :
diff --git a/src/util/libgnu/dummy.c b/src/util/libgnu/dummy.c
deleted file mode 100644
index c958ea05d..000000000
--- a/src/util/libgnu/dummy.c
+++ /dev/null
@@ -1,42 +0,0 @@
1/* A dummy file, to prevent empty libraries from breaking builds.
2 Copyright (C) 2004, 2007, 2009-2011 Free Software Foundation, Inc.
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
16
17/* Some systems, reportedly OpenBSD and Mac OS X, refuse to create
18 libraries without any object files. You might get an error like:
19
20 > ar cru .libs/libgl.a
21 > ar: no archive members specified
22
23 Compiling this file, and adding its object file to the library, will
24 prevent the library from being empty. */
25
26/* Some systems, such as Solaris with cc 5.0, refuse to work with libraries
27 that don't export any symbol. You might get an error like:
28
29 > cc ... libgnu.a
30 > ild: (bad file) garbled symbol table in archive ../gllib/libgnu.a
31
32 Compiling this file, and adding its object file to the library, will
33 prevent the library from exporting no symbols. */
34
35#ifdef __sun
36/* This declaration ensures that the library will export at least 1 symbol. */
37int gl_dummy_symbol;
38#else
39/* This declaration is solely to ensure that after preprocessing
40 this file is never empty. */
41typedef int dummy;
42#endif
diff --git a/src/util/libgnu/stddef.in.h b/src/util/libgnu/stddef.in.h
deleted file mode 100644
index 62a91a7a6..000000000
--- a/src/util/libgnu/stddef.in.h
+++ /dev/null
@@ -1,87 +0,0 @@
1/* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues.
2
3 Copyright (C) 2009-2011 Free Software Foundation, Inc.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3, or (at your option)
8 any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software Foundation,
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
18
19/* Written by Eric Blake. */
20
21/*
22 * POSIX 2008 <stddef.h> for platforms that have issues.
23 * <http://www.opengroup.org/susv3xbd/stddef.h.html>
24 */
25
26#if __GNUC__ >= 3
27@PRAGMA_SYSTEM_HEADER@
28#endif
29@PRAGMA_COLUMNS@
30
31#if defined __need_wchar_t || defined __need_size_t \
32 || defined __need_ptrdiff_t || defined __need_NULL \
33 || defined __need_wint_t
34/* Special invocation convention inside gcc header files. In
35 particular, gcc provides a version of <stddef.h> that blindly
36 redefines NULL even when __need_wint_t was defined, even though
37 wint_t is not normally provided by <stddef.h>. Hence, we must
38 remember if special invocation has ever been used to obtain wint_t,
39 in which case we need to clean up NULL yet again. */
40
41# if !(defined _GL_STDDEF_H && defined _GL_STDDEF_WINT_T)
42# ifdef __need_wint_t
43# undef _GL_STDDEF_H
44# define _GL_STDDEF_WINT_T
45# endif
46# @INCLUDE_NEXT@ @NEXT_STDDEF_H@
47# endif
48
49#else
50/* Normal invocation convention. */
51
52# ifndef _GL_STDDEF_H
53
54/* The include_next requires a split double-inclusion guard. */
55
56# @INCLUDE_NEXT@ @NEXT_STDDEF_H@
57
58# ifndef _GL_STDDEF_H
59# define _GL_STDDEF_H
60
61/* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */
62#if @REPLACE_NULL@
63# undef NULL
64# ifdef __cplusplus
65 /* ISO C++ says that the macro NULL must expand to an integer constant
66 expression, hence '((void *) 0)' is not allowed in C++. */
67# if __GNUG__ >= 3
68 /* GNU C++ has a __null macro that behaves like an integer ('int' or
69 'long') but has the same size as a pointer. Use that, to avoid
70 warnings. */
71# define NULL __null
72# else
73# define NULL 0L
74# endif
75# else
76# define NULL ((void *) 0)
77# endif
78#endif
79
80/* Some platforms lack wchar_t. */
81#if !@HAVE_WCHAR_T@
82# define wchar_t int
83#endif
84
85# endif /* _GL_STDDEF_H */
86# endif /* _GL_STDDEF_H */
87#endif /* __need_XXX */
diff --git a/src/util/libgnu/string.in.h b/src/util/libgnu/string.in.h
deleted file mode 100644
index 336e24651..000000000
--- a/src/util/libgnu/string.in.h
+++ /dev/null
@@ -1,970 +0,0 @@
1/* A GNU-like <string.h>.
2
3 Copyright (C) 1995-1996, 2001-2011 Free Software Foundation, Inc.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3, or (at your option)
8 any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software Foundation,
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
18
19#ifndef _GL_STRING_H
20
21#if __GNUC__ >= 3
22@PRAGMA_SYSTEM_HEADER@
23#endif
24@PRAGMA_COLUMNS@
25
26/* The include_next requires a split double-inclusion guard. */
27#@INCLUDE_NEXT@ @NEXT_STRING_H@
28
29#ifndef _GL_STRING_H
30#define _GL_STRING_H
31
32/* NetBSD 5.0 mis-defines NULL. */
33#include <stddef.h>
34
35/* MirBSD defines mbslen as a macro. */
36#if @GNULIB_MBSLEN@ && defined __MirBSD__
37# include <wchar.h>
38#endif
39
40/* The __attribute__ feature is available in gcc versions 2.5 and later.
41 The attribute __pure__ was added in gcc 2.96. */
42#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
43# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
44#else
45# define _GL_ATTRIBUTE_PURE /* empty */
46#endif
47
48/* NetBSD 5.0 declares strsignal in <unistd.h>, not in <string.h>. */
49/* But in any case avoid namespace pollution on glibc systems. */
50#if (@GNULIB_STRSIGNAL@ || defined GNULIB_POSIXCHECK) && defined __NetBSD__ \
51 && ! defined __GLIBC__
52# include <unistd.h>
53#endif
54
55/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
56
57/* The definition of _GL_ARG_NONNULL is copied here. */
58
59/* The definition of _GL_WARN_ON_USE is copied here. */
60
61
62/* Return the first instance of C within N bytes of S, or NULL. */
63#if @GNULIB_MEMCHR@
64# if @REPLACE_MEMCHR@
65# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
66# define memchr rpl_memchr
67# endif
68_GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n)
69 _GL_ATTRIBUTE_PURE
70 _GL_ARG_NONNULL ((1)));
71_GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n));
72# else
73# if ! @HAVE_MEMCHR@
74_GL_FUNCDECL_SYS (memchr, void *, (void const *__s, int __c, size_t __n)
75 _GL_ATTRIBUTE_PURE
76 _GL_ARG_NONNULL ((1)));
77# endif
78 /* On some systems, this function is defined as an overloaded function:
79 extern "C" { const void * std::memchr (const void *, int, size_t); }
80 extern "C++" { void * std::memchr (void *, int, size_t); } */
81_GL_CXXALIAS_SYS_CAST2 (memchr,
82 void *, (void const *__s, int __c, size_t __n),
83 void const *, (void const *__s, int __c, size_t __n));
84# endif
85# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
86 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
87_GL_CXXALIASWARN1 (memchr, void *, (void *__s, int __c, size_t __n));
88_GL_CXXALIASWARN1 (memchr, void const *,
89 (void const *__s, int __c, size_t __n));
90# else
91_GL_CXXALIASWARN (memchr);
92# endif
93#elif defined GNULIB_POSIXCHECK
94# undef memchr
95/* Assume memchr is always declared. */
96_GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - "
97 "use gnulib module memchr for portability" );
98#endif
99
100/* Return the first occurrence of NEEDLE in HAYSTACK. */
101#if @GNULIB_MEMMEM@
102# if @REPLACE_MEMMEM@
103# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
104# define memmem rpl_memmem
105# endif
106_GL_FUNCDECL_RPL (memmem, void *,
107 (void const *__haystack, size_t __haystack_len,
108 void const *__needle, size_t __needle_len)
109 _GL_ATTRIBUTE_PURE
110 _GL_ARG_NONNULL ((1, 3)));
111_GL_CXXALIAS_RPL (memmem, void *,
112 (void const *__haystack, size_t __haystack_len,
113 void const *__needle, size_t __needle_len));
114# else
115# if ! @HAVE_DECL_MEMMEM@
116_GL_FUNCDECL_SYS (memmem, void *,
117 (void const *__haystack, size_t __haystack_len,
118 void const *__needle, size_t __needle_len)
119 _GL_ATTRIBUTE_PURE
120 _GL_ARG_NONNULL ((1, 3)));
121# endif
122_GL_CXXALIAS_SYS (memmem, void *,
123 (void const *__haystack, size_t __haystack_len,
124 void const *__needle, size_t __needle_len));
125# endif
126_GL_CXXALIASWARN (memmem);
127#elif defined GNULIB_POSIXCHECK
128# undef memmem
129# if HAVE_RAW_DECL_MEMMEM
130_GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - "
131 "use gnulib module memmem-simple for portability, "
132 "and module memmem for speed" );
133# endif
134#endif
135
136/* Copy N bytes of SRC to DEST, return pointer to bytes after the
137 last written byte. */
138#if @GNULIB_MEMPCPY@
139# if ! @HAVE_MEMPCPY@
140_GL_FUNCDECL_SYS (mempcpy, void *,
141 (void *restrict __dest, void const *restrict __src,
142 size_t __n)
143 _GL_ARG_NONNULL ((1, 2)));
144# endif
145_GL_CXXALIAS_SYS (mempcpy, void *,
146 (void *restrict __dest, void const *restrict __src,
147 size_t __n));
148_GL_CXXALIASWARN (mempcpy);
149#elif defined GNULIB_POSIXCHECK
150# undef mempcpy
151# if HAVE_RAW_DECL_MEMPCPY
152_GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - "
153 "use gnulib module mempcpy for portability");
154# endif
155#endif
156
157/* Search backwards through a block for a byte (specified as an int). */
158#if @GNULIB_MEMRCHR@
159# if ! @HAVE_DECL_MEMRCHR@
160_GL_FUNCDECL_SYS (memrchr, void *, (void const *, int, size_t)
161 _GL_ATTRIBUTE_PURE
162 _GL_ARG_NONNULL ((1)));
163# endif
164 /* On some systems, this function is defined as an overloaded function:
165 extern "C++" { const void * std::memrchr (const void *, int, size_t); }
166 extern "C++" { void * std::memrchr (void *, int, size_t); } */
167_GL_CXXALIAS_SYS_CAST2 (memrchr,
168 void *, (void const *, int, size_t),
169 void const *, (void const *, int, size_t));
170# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
171 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
172_GL_CXXALIASWARN1 (memrchr, void *, (void *, int, size_t));
173_GL_CXXALIASWARN1 (memrchr, void const *, (void const *, int, size_t));
174# else
175_GL_CXXALIASWARN (memrchr);
176# endif
177#elif defined GNULIB_POSIXCHECK
178# undef memrchr
179# if HAVE_RAW_DECL_MEMRCHR
180_GL_WARN_ON_USE (memrchr, "memrchr is unportable - "
181 "use gnulib module memrchr for portability");
182# endif
183#endif
184
185/* Find the first occurrence of C in S. More efficient than
186 memchr(S,C,N), at the expense of undefined behavior if C does not
187 occur within N bytes. */
188#if @GNULIB_RAWMEMCHR@
189# if ! @HAVE_RAWMEMCHR@
190_GL_FUNCDECL_SYS (rawmemchr, void *, (void const *__s, int __c_in)
191 _GL_ATTRIBUTE_PURE
192 _GL_ARG_NONNULL ((1)));
193# endif
194 /* On some systems, this function is defined as an overloaded function:
195 extern "C++" { const void * std::rawmemchr (const void *, int); }
196 extern "C++" { void * std::rawmemchr (void *, int); } */
197_GL_CXXALIAS_SYS_CAST2 (rawmemchr,
198 void *, (void const *__s, int __c_in),
199 void const *, (void const *__s, int __c_in));
200# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
201 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
202_GL_CXXALIASWARN1 (rawmemchr, void *, (void *__s, int __c_in));
203_GL_CXXALIASWARN1 (rawmemchr, void const *, (void const *__s, int __c_in));
204# else
205_GL_CXXALIASWARN (rawmemchr);
206# endif
207#elif defined GNULIB_POSIXCHECK
208# undef rawmemchr
209# if HAVE_RAW_DECL_RAWMEMCHR
210_GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - "
211 "use gnulib module rawmemchr for portability");
212# endif
213#endif
214
215/* Copy SRC to DST, returning the address of the terminating '\0' in DST. */
216#if @GNULIB_STPCPY@
217# if ! @HAVE_STPCPY@
218_GL_FUNCDECL_SYS (stpcpy, char *,
219 (char *restrict __dst, char const *restrict __src)
220 _GL_ARG_NONNULL ((1, 2)));
221# endif
222_GL_CXXALIAS_SYS (stpcpy, char *,
223 (char *restrict __dst, char const *restrict __src));
224_GL_CXXALIASWARN (stpcpy);
225#elif defined GNULIB_POSIXCHECK
226# undef stpcpy
227# if HAVE_RAW_DECL_STPCPY
228_GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - "
229 "use gnulib module stpcpy for portability");
230# endif
231#endif
232
233/* Copy no more than N bytes of SRC to DST, returning a pointer past the
234 last non-NUL byte written into DST. */
235#if @GNULIB_STPNCPY@
236# if @REPLACE_STPNCPY@
237# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
238# undef stpncpy
239# define stpncpy rpl_stpncpy
240# endif
241_GL_FUNCDECL_RPL (stpncpy, char *,
242 (char *restrict __dst, char const *restrict __src,
243 size_t __n)
244 _GL_ARG_NONNULL ((1, 2)));
245_GL_CXXALIAS_RPL (stpncpy, char *,
246 (char *restrict __dst, char const *restrict __src,
247 size_t __n));
248# else
249# if ! @HAVE_STPNCPY@
250_GL_FUNCDECL_SYS (stpncpy, char *,
251 (char *restrict __dst, char const *restrict __src,
252 size_t __n)
253 _GL_ARG_NONNULL ((1, 2)));
254# endif
255_GL_CXXALIAS_SYS (stpncpy, char *,
256 (char *restrict __dst, char const *restrict __src,
257 size_t __n));
258# endif
259_GL_CXXALIASWARN (stpncpy);
260#elif defined GNULIB_POSIXCHECK
261# undef stpncpy
262# if HAVE_RAW_DECL_STPNCPY
263_GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - "
264 "use gnulib module stpncpy for portability");
265# endif
266#endif
267
268#if defined GNULIB_POSIXCHECK
269/* strchr() does not work with multibyte strings if the locale encoding is
270 GB18030 and the character to be searched is a digit. */
271# undef strchr
272/* Assume strchr is always declared. */
273_GL_WARN_ON_USE (strchr, "strchr cannot work correctly on character strings "
274 "in some multibyte locales - "
275 "use mbschr if you care about internationalization");
276#endif
277
278/* Find the first occurrence of C in S or the final NUL byte. */
279#if @GNULIB_STRCHRNUL@
280# if ! @HAVE_STRCHRNUL@
281_GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in)
282 _GL_ATTRIBUTE_PURE
283 _GL_ARG_NONNULL ((1)));
284# endif
285 /* On some systems, this function is defined as an overloaded function:
286 extern "C++" { const char * std::strchrnul (const char *, int); }
287 extern "C++" { char * std::strchrnul (char *, int); } */
288_GL_CXXALIAS_SYS_CAST2 (strchrnul,
289 char *, (char const *__s, int __c_in),
290 char const *, (char const *__s, int __c_in));
291# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
292 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
293_GL_CXXALIASWARN1 (strchrnul, char *, (char *__s, int __c_in));
294_GL_CXXALIASWARN1 (strchrnul, char const *, (char const *__s, int __c_in));
295# else
296_GL_CXXALIASWARN (strchrnul);
297# endif
298#elif defined GNULIB_POSIXCHECK
299# undef strchrnul
300# if HAVE_RAW_DECL_STRCHRNUL
301_GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - "
302 "use gnulib module strchrnul for portability");
303# endif
304#endif
305
306/* Duplicate S, returning an identical malloc'd string. */
307#if @GNULIB_STRDUP@
308# if @REPLACE_STRDUP@
309# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
310# undef strdup
311# define strdup rpl_strdup
312# endif
313_GL_FUNCDECL_RPL (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1)));
314_GL_CXXALIAS_RPL (strdup, char *, (char const *__s));
315# else
316# if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup
317 /* strdup exists as a function and as a macro. Get rid of the macro. */
318# undef strdup
319# endif
320# if !(@HAVE_DECL_STRDUP@ || defined strdup)
321_GL_FUNCDECL_SYS (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1)));
322# endif
323_GL_CXXALIAS_SYS (strdup, char *, (char const *__s));
324# endif
325_GL_CXXALIASWARN (strdup);
326#elif defined GNULIB_POSIXCHECK
327# undef strdup
328# if HAVE_RAW_DECL_STRDUP
329_GL_WARN_ON_USE (strdup, "strdup is unportable - "
330 "use gnulib module strdup for portability");
331# endif
332#endif
333
334/* Append no more than N characters from SRC onto DEST. */
335#if @GNULIB_STRNCAT@
336# if @REPLACE_STRNCAT@
337# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
338# undef strncat
339# define strncat rpl_strncat
340# endif
341_GL_FUNCDECL_RPL (strncat, char *, (char *dest, const char *src, size_t n)
342 _GL_ARG_NONNULL ((1, 2)));
343_GL_CXXALIAS_RPL (strncat, char *, (char *dest, const char *src, size_t n));
344# else
345_GL_CXXALIAS_SYS (strncat, char *, (char *dest, const char *src, size_t n));
346# endif
347_GL_CXXALIASWARN (strncat);
348#elif defined GNULIB_POSIXCHECK
349# undef strncat
350# if HAVE_RAW_DECL_STRNCAT
351_GL_WARN_ON_USE (strncat, "strncat is unportable - "
352 "use gnulib module strncat for portability");
353# endif
354#endif
355
356/* Return a newly allocated copy of at most N bytes of STRING. */
357#if @GNULIB_STRNDUP@
358# if @REPLACE_STRNDUP@
359# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
360# undef strndup
361# define strndup rpl_strndup
362# endif
363_GL_FUNCDECL_RPL (strndup, char *, (char const *__string, size_t __n)
364 _GL_ARG_NONNULL ((1)));
365_GL_CXXALIAS_RPL (strndup, char *, (char const *__string, size_t __n));
366# else
367# if ! @HAVE_DECL_STRNDUP@
368_GL_FUNCDECL_SYS (strndup, char *, (char const *__string, size_t __n)
369 _GL_ARG_NONNULL ((1)));
370# endif
371_GL_CXXALIAS_SYS (strndup, char *, (char const *__string, size_t __n));
372# endif
373_GL_CXXALIASWARN (strndup);
374#elif defined GNULIB_POSIXCHECK
375# undef strndup
376# if HAVE_RAW_DECL_STRNDUP
377_GL_WARN_ON_USE (strndup, "strndup is unportable - "
378 "use gnulib module strndup for portability");
379# endif
380#endif
381
382/* Find the length (number of bytes) of STRING, but scan at most
383 MAXLEN bytes. If no '\0' terminator is found in that many bytes,
384 return MAXLEN. */
385#if @GNULIB_STRNLEN@
386# if @REPLACE_STRNLEN@
387# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
388# undef strnlen
389# define strnlen rpl_strnlen
390# endif
391_GL_FUNCDECL_RPL (strnlen, size_t, (char const *__string, size_t __maxlen)
392 _GL_ATTRIBUTE_PURE
393 _GL_ARG_NONNULL ((1)));
394_GL_CXXALIAS_RPL (strnlen, size_t, (char const *__string, size_t __maxlen));
395# else
396# if ! @HAVE_DECL_STRNLEN@
397_GL_FUNCDECL_SYS (strnlen, size_t, (char const *__string, size_t __maxlen)
398 _GL_ATTRIBUTE_PURE
399 _GL_ARG_NONNULL ((1)));
400# endif
401_GL_CXXALIAS_SYS (strnlen, size_t, (char const *__string, size_t __maxlen));
402# endif
403_GL_CXXALIASWARN (strnlen);
404#elif defined GNULIB_POSIXCHECK
405# undef strnlen
406# if HAVE_RAW_DECL_STRNLEN
407_GL_WARN_ON_USE (strnlen, "strnlen is unportable - "
408 "use gnulib module strnlen for portability");
409# endif
410#endif
411
412#if defined GNULIB_POSIXCHECK
413/* strcspn() assumes the second argument is a list of single-byte characters.
414 Even in this simple case, it does not work with multibyte strings if the
415 locale encoding is GB18030 and one of the characters to be searched is a
416 digit. */
417# undef strcspn
418/* Assume strcspn is always declared. */
419_GL_WARN_ON_USE (strcspn, "strcspn cannot work correctly on character strings "
420 "in multibyte locales - "
421 "use mbscspn if you care about internationalization");
422#endif
423
424/* Find the first occurrence in S of any character in ACCEPT. */
425#if @GNULIB_STRPBRK@
426# if ! @HAVE_STRPBRK@
427_GL_FUNCDECL_SYS (strpbrk, char *, (char const *__s, char const *__accept)
428 _GL_ATTRIBUTE_PURE
429 _GL_ARG_NONNULL ((1, 2)));
430# endif
431 /* On some systems, this function is defined as an overloaded function:
432 extern "C" { const char * strpbrk (const char *, const char *); }
433 extern "C++" { char * strpbrk (char *, const char *); } */
434_GL_CXXALIAS_SYS_CAST2 (strpbrk,
435 char *, (char const *__s, char const *__accept),
436 const char *, (char const *__s, char const *__accept));
437# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
438 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
439_GL_CXXALIASWARN1 (strpbrk, char *, (char *__s, char const *__accept));
440_GL_CXXALIASWARN1 (strpbrk, char const *,
441 (char const *__s, char const *__accept));
442# else
443_GL_CXXALIASWARN (strpbrk);
444# endif
445# if defined GNULIB_POSIXCHECK
446/* strpbrk() assumes the second argument is a list of single-byte characters.
447 Even in this simple case, it does not work with multibyte strings if the
448 locale encoding is GB18030 and one of the characters to be searched is a
449 digit. */
450# undef strpbrk
451_GL_WARN_ON_USE (strpbrk, "strpbrk cannot work correctly on character strings "
452 "in multibyte locales - "
453 "use mbspbrk if you care about internationalization");
454# endif
455#elif defined GNULIB_POSIXCHECK
456# undef strpbrk
457# if HAVE_RAW_DECL_STRPBRK
458_GL_WARN_ON_USE (strpbrk, "strpbrk is unportable - "
459 "use gnulib module strpbrk for portability");
460# endif
461#endif
462
463#if defined GNULIB_POSIXCHECK
464/* strspn() assumes the second argument is a list of single-byte characters.
465 Even in this simple case, it cannot work with multibyte strings. */
466# undef strspn
467/* Assume strspn is always declared. */
468_GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings "
469 "in multibyte locales - "
470 "use mbsspn if you care about internationalization");
471#endif
472
473#if defined GNULIB_POSIXCHECK
474/* strrchr() does not work with multibyte strings if the locale encoding is
475 GB18030 and the character to be searched is a digit. */
476# undef strrchr
477/* Assume strrchr is always declared. */
478_GL_WARN_ON_USE (strrchr, "strrchr cannot work correctly on character strings "
479 "in some multibyte locales - "
480 "use mbsrchr if you care about internationalization");
481#endif
482
483/* Search the next delimiter (char listed in DELIM) starting at *STRINGP.
484 If one is found, overwrite it with a NUL, and advance *STRINGP
485 to point to the next char after it. Otherwise, set *STRINGP to NULL.
486 If *STRINGP was already NULL, nothing happens.
487 Return the old value of *STRINGP.
488
489 This is a variant of strtok() that is multithread-safe and supports
490 empty fields.
491
492 Caveat: It modifies the original string.
493 Caveat: These functions cannot be used on constant strings.
494 Caveat: The identity of the delimiting character is lost.
495 Caveat: It doesn't work with multibyte strings unless all of the delimiter
496 characters are ASCII characters < 0x30.
497
498 See also strtok_r(). */
499#if @GNULIB_STRSEP@
500# if ! @HAVE_STRSEP@
501_GL_FUNCDECL_SYS (strsep, char *,
502 (char **restrict __stringp, char const *restrict __delim)
503 _GL_ARG_NONNULL ((1, 2)));
504# endif
505_GL_CXXALIAS_SYS (strsep, char *,
506 (char **restrict __stringp, char const *restrict __delim));
507_GL_CXXALIASWARN (strsep);
508# if defined GNULIB_POSIXCHECK
509# undef strsep
510_GL_WARN_ON_USE (strsep, "strsep cannot work correctly on character strings "
511 "in multibyte locales - "
512 "use mbssep if you care about internationalization");
513# endif
514#elif defined GNULIB_POSIXCHECK
515# undef strsep
516# if HAVE_RAW_DECL_STRSEP
517_GL_WARN_ON_USE (strsep, "strsep is unportable - "
518 "use gnulib module strsep for portability");
519# endif
520#endif
521
522#if @GNULIB_STRSTR@
523# if @REPLACE_STRSTR@
524# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
525# define strstr rpl_strstr
526# endif
527_GL_FUNCDECL_RPL (strstr, char *, (const char *haystack, const char *needle)
528 _GL_ATTRIBUTE_PURE
529 _GL_ARG_NONNULL ((1, 2)));
530_GL_CXXALIAS_RPL (strstr, char *, (const char *haystack, const char *needle));
531# else
532 /* On some systems, this function is defined as an overloaded function:
533 extern "C++" { const char * strstr (const char *, const char *); }
534 extern "C++" { char * strstr (char *, const char *); } */
535_GL_CXXALIAS_SYS_CAST2 (strstr,
536 char *, (const char *haystack, const char *needle),
537 const char *, (const char *haystack, const char *needle));
538# endif
539# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
540 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
541_GL_CXXALIASWARN1 (strstr, char *, (char *haystack, const char *needle));
542_GL_CXXALIASWARN1 (strstr, const char *,
543 (const char *haystack, const char *needle));
544# else
545_GL_CXXALIASWARN (strstr);
546# endif
547#elif defined GNULIB_POSIXCHECK
548/* strstr() does not work with multibyte strings if the locale encoding is
549 different from UTF-8:
550 POSIX says that it operates on "strings", and "string" in POSIX is defined
551 as a sequence of bytes, not of characters. */
552# undef strstr
553/* Assume strstr is always declared. */
554_GL_WARN_ON_USE (strstr, "strstr is quadratic on many systems, and cannot "
555 "work correctly on character strings in most "
556 "multibyte locales - "
557 "use mbsstr if you care about internationalization, "
558 "or use strstr if you care about speed");
559#endif
560
561/* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive
562 comparison. */
563#if @GNULIB_STRCASESTR@
564# if @REPLACE_STRCASESTR@
565# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
566# define strcasestr rpl_strcasestr
567# endif
568_GL_FUNCDECL_RPL (strcasestr, char *,
569 (const char *haystack, const char *needle)
570 _GL_ATTRIBUTE_PURE
571 _GL_ARG_NONNULL ((1, 2)));
572_GL_CXXALIAS_RPL (strcasestr, char *,
573 (const char *haystack, const char *needle));
574# else
575# if ! @HAVE_STRCASESTR@
576_GL_FUNCDECL_SYS (strcasestr, char *,
577 (const char *haystack, const char *needle)
578 _GL_ATTRIBUTE_PURE
579 _GL_ARG_NONNULL ((1, 2)));
580# endif
581 /* On some systems, this function is defined as an overloaded function:
582 extern "C++" { const char * strcasestr (const char *, const char *); }
583 extern "C++" { char * strcasestr (char *, const char *); } */
584_GL_CXXALIAS_SYS_CAST2 (strcasestr,
585 char *, (const char *haystack, const char *needle),
586 const char *, (const char *haystack, const char *needle));
587# endif
588# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
589 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
590_GL_CXXALIASWARN1 (strcasestr, char *, (char *haystack, const char *needle));
591_GL_CXXALIASWARN1 (strcasestr, const char *,
592 (const char *haystack, const char *needle));
593# else
594_GL_CXXALIASWARN (strcasestr);
595# endif
596#elif defined GNULIB_POSIXCHECK
597/* strcasestr() does not work with multibyte strings:
598 It is a glibc extension, and glibc implements it only for unibyte
599 locales. */
600# undef strcasestr
601# if HAVE_RAW_DECL_STRCASESTR
602_GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character "
603 "strings in multibyte locales - "
604 "use mbscasestr if you care about "
605 "internationalization, or use c-strcasestr if you want "
606 "a locale independent function");
607# endif
608#endif
609
610/* Parse S into tokens separated by characters in DELIM.
611 If S is NULL, the saved pointer in SAVE_PTR is used as
612 the next starting point. For example:
613 char s[] = "-abc-=-def";
614 char *sp;
615 x = strtok_r(s, "-", &sp); // x = "abc", sp = "=-def"
616 x = strtok_r(NULL, "-=", &sp); // x = "def", sp = NULL
617 x = strtok_r(NULL, "=", &sp); // x = NULL
618 // s = "abc\0-def\0"
619
620 This is a variant of strtok() that is multithread-safe.
621
622 For the POSIX documentation for this function, see:
623 http://www.opengroup.org/susv3xsh/strtok.html
624
625 Caveat: It modifies the original string.
626 Caveat: These functions cannot be used on constant strings.
627 Caveat: The identity of the delimiting character is lost.
628 Caveat: It doesn't work with multibyte strings unless all of the delimiter
629 characters are ASCII characters < 0x30.
630
631 See also strsep(). */
632#if @GNULIB_STRTOK_R@
633# if @REPLACE_STRTOK_R@
634# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
635# undef strtok_r
636# define strtok_r rpl_strtok_r
637# endif
638_GL_FUNCDECL_RPL (strtok_r, char *,
639 (char *restrict s, char const *restrict delim,
640 char **restrict save_ptr)
641 _GL_ARG_NONNULL ((2, 3)));
642_GL_CXXALIAS_RPL (strtok_r, char *,
643 (char *restrict s, char const *restrict delim,
644 char **restrict save_ptr));
645# else
646# if @UNDEFINE_STRTOK_R@ || defined GNULIB_POSIXCHECK
647# undef strtok_r
648# endif
649# if ! @HAVE_DECL_STRTOK_R@
650_GL_FUNCDECL_SYS (strtok_r, char *,
651 (char *restrict s, char const *restrict delim,
652 char **restrict save_ptr)
653 _GL_ARG_NONNULL ((2, 3)));
654# endif
655_GL_CXXALIAS_SYS (strtok_r, char *,
656 (char *restrict s, char const *restrict delim,
657 char **restrict save_ptr));
658# endif
659_GL_CXXALIASWARN (strtok_r);
660# if defined GNULIB_POSIXCHECK
661_GL_WARN_ON_USE (strtok_r, "strtok_r cannot work correctly on character "
662 "strings in multibyte locales - "
663 "use mbstok_r if you care about internationalization");
664# endif
665#elif defined GNULIB_POSIXCHECK
666# undef strtok_r
667# if HAVE_RAW_DECL_STRTOK_R
668_GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - "
669 "use gnulib module strtok_r for portability");
670# endif
671#endif
672
673
674/* The following functions are not specified by POSIX. They are gnulib
675 extensions. */
676
677#if @GNULIB_MBSLEN@
678/* Return the number of multibyte characters in the character string STRING.
679 This considers multibyte characters, unlike strlen, which counts bytes. */
680# ifdef __MirBSD__ /* MirBSD defines mbslen as a macro. Override it. */
681# undef mbslen
682# endif
683# if @HAVE_MBSLEN@ /* AIX, OSF/1, MirBSD define mbslen already in libc. */
684# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
685# define mbslen rpl_mbslen
686# endif
687_GL_FUNCDECL_RPL (mbslen, size_t, (const char *string) _GL_ARG_NONNULL ((1)));
688_GL_CXXALIAS_RPL (mbslen, size_t, (const char *string));
689# else
690_GL_FUNCDECL_SYS (mbslen, size_t, (const char *string) _GL_ARG_NONNULL ((1)));
691_GL_CXXALIAS_SYS (mbslen, size_t, (const char *string));
692# endif
693_GL_CXXALIASWARN (mbslen);
694#endif
695
696#if @GNULIB_MBSNLEN@
697/* Return the number of multibyte characters in the character string starting
698 at STRING and ending at STRING + LEN. */
699_GL_EXTERN_C size_t mbsnlen (const char *string, size_t len)
700 _GL_ARG_NONNULL ((1));
701#endif
702
703#if @GNULIB_MBSCHR@
704/* Locate the first single-byte character C in the character string STRING,
705 and return a pointer to it. Return NULL if C is not found in STRING.
706 Unlike strchr(), this function works correctly in multibyte locales with
707 encodings such as GB18030. */
708# if defined __hpux
709# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
710# define mbschr rpl_mbschr /* avoid collision with HP-UX function */
711# endif
712_GL_FUNCDECL_RPL (mbschr, char *, (const char *string, int c)
713 _GL_ARG_NONNULL ((1)));
714_GL_CXXALIAS_RPL (mbschr, char *, (const char *string, int c));
715# else
716_GL_FUNCDECL_SYS (mbschr, char *, (const char *string, int c)
717 _GL_ARG_NONNULL ((1)));
718_GL_CXXALIAS_SYS (mbschr, char *, (const char *string, int c));
719# endif
720_GL_CXXALIASWARN (mbschr);
721#endif
722
723#if @GNULIB_MBSRCHR@
724/* Locate the last single-byte character C in the character string STRING,
725 and return a pointer to it. Return NULL if C is not found in STRING.
726 Unlike strrchr(), this function works correctly in multibyte locales with
727 encodings such as GB18030. */
728# if defined __hpux
729# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
730# define mbsrchr rpl_mbsrchr /* avoid collision with HP-UX function */
731# endif
732_GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c)
733 _GL_ARG_NONNULL ((1)));
734_GL_CXXALIAS_RPL (mbsrchr, char *, (const char *string, int c));
735# else
736_GL_FUNCDECL_SYS (mbsrchr, char *, (const char *string, int c)
737 _GL_ARG_NONNULL ((1)));
738_GL_CXXALIAS_SYS (mbsrchr, char *, (const char *string, int c));
739# endif
740_GL_CXXALIASWARN (mbsrchr);
741#endif
742
743#if @GNULIB_MBSSTR@
744/* Find the first occurrence of the character string NEEDLE in the character
745 string HAYSTACK. Return NULL if NEEDLE is not found in HAYSTACK.
746 Unlike strstr(), this function works correctly in multibyte locales with
747 encodings different from UTF-8. */
748_GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle)
749 _GL_ARG_NONNULL ((1, 2));
750#endif
751
752#if @GNULIB_MBSCASECMP@
753/* Compare the character strings S1 and S2, ignoring case, returning less than,
754 equal to or greater than zero if S1 is lexicographically less than, equal to
755 or greater than S2.
756 Note: This function may, in multibyte locales, return 0 for strings of
757 different lengths!
758 Unlike strcasecmp(), this function works correctly in multibyte locales. */
759_GL_EXTERN_C int mbscasecmp (const char *s1, const char *s2)
760 _GL_ARG_NONNULL ((1, 2));
761#endif
762
763#if @GNULIB_MBSNCASECMP@
764/* Compare the initial segment of the character string S1 consisting of at most
765 N characters with the initial segment of the character string S2 consisting
766 of at most N characters, ignoring case, returning less than, equal to or
767 greater than zero if the initial segment of S1 is lexicographically less
768 than, equal to or greater than the initial segment of S2.
769 Note: This function may, in multibyte locales, return 0 for initial segments
770 of different lengths!
771 Unlike strncasecmp(), this function works correctly in multibyte locales.
772 But beware that N is not a byte count but a character count! */
773_GL_EXTERN_C int mbsncasecmp (const char *s1, const char *s2, size_t n)
774 _GL_ARG_NONNULL ((1, 2));
775#endif
776
777#if @GNULIB_MBSPCASECMP@
778/* Compare the initial segment of the character string STRING consisting of
779 at most mbslen (PREFIX) characters with the character string PREFIX,
780 ignoring case. If the two match, return a pointer to the first byte
781 after this prefix in STRING. Otherwise, return NULL.
782 Note: This function may, in multibyte locales, return non-NULL if STRING
783 is of smaller length than PREFIX!
784 Unlike strncasecmp(), this function works correctly in multibyte
785 locales. */
786_GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix)
787 _GL_ARG_NONNULL ((1, 2));
788#endif
789
790#if @GNULIB_MBSCASESTR@
791/* Find the first occurrence of the character string NEEDLE in the character
792 string HAYSTACK, using case-insensitive comparison.
793 Note: This function may, in multibyte locales, return success even if
794 strlen (haystack) < strlen (needle) !
795 Unlike strcasestr(), this function works correctly in multibyte locales. */
796_GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle)
797 _GL_ARG_NONNULL ((1, 2));
798#endif
799
800#if @GNULIB_MBSCSPN@
801/* Find the first occurrence in the character string STRING of any character
802 in the character string ACCEPT. Return the number of bytes from the
803 beginning of the string to this occurrence, or to the end of the string
804 if none exists.
805 Unlike strcspn(), this function works correctly in multibyte locales. */
806_GL_EXTERN_C size_t mbscspn (const char *string, const char *accept)
807 _GL_ARG_NONNULL ((1, 2));
808#endif
809
810#if @GNULIB_MBSPBRK@
811/* Find the first occurrence in the character string STRING of any character
812 in the character string ACCEPT. Return the pointer to it, or NULL if none
813 exists.
814 Unlike strpbrk(), this function works correctly in multibyte locales. */
815# if defined __hpux
816# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
817# define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */
818# endif
819_GL_FUNCDECL_RPL (mbspbrk, char *, (const char *string, const char *accept)
820 _GL_ARG_NONNULL ((1, 2)));
821_GL_CXXALIAS_RPL (mbspbrk, char *, (const char *string, const char *accept));
822# else
823_GL_FUNCDECL_SYS (mbspbrk, char *, (const char *string, const char *accept)
824 _GL_ARG_NONNULL ((1, 2)));
825_GL_CXXALIAS_SYS (mbspbrk, char *, (const char *string, const char *accept));
826# endif
827_GL_CXXALIASWARN (mbspbrk);
828#endif
829
830#if @GNULIB_MBSSPN@
831/* Find the first occurrence in the character string STRING of any character
832 not in the character string REJECT. Return the number of bytes from the
833 beginning of the string to this occurrence, or to the end of the string
834 if none exists.
835 Unlike strspn(), this function works correctly in multibyte locales. */
836_GL_EXTERN_C size_t mbsspn (const char *string, const char *reject)
837 _GL_ARG_NONNULL ((1, 2));
838#endif
839
840#if @GNULIB_MBSSEP@
841/* Search the next delimiter (multibyte character listed in the character
842 string DELIM) starting at the character string *STRINGP.
843 If one is found, overwrite it with a NUL, and advance *STRINGP to point
844 to the next multibyte character after it. Otherwise, set *STRINGP to NULL.
845 If *STRINGP was already NULL, nothing happens.
846 Return the old value of *STRINGP.
847
848 This is a variant of mbstok_r() that supports empty fields.
849
850 Caveat: It modifies the original string.
851 Caveat: These functions cannot be used on constant strings.
852 Caveat: The identity of the delimiting character is lost.
853
854 See also mbstok_r(). */
855_GL_EXTERN_C char * mbssep (char **stringp, const char *delim)
856 _GL_ARG_NONNULL ((1, 2));
857#endif
858
859#if @GNULIB_MBSTOK_R@
860/* Parse the character string STRING into tokens separated by characters in
861 the character string DELIM.
862 If STRING is NULL, the saved pointer in SAVE_PTR is used as
863 the next starting point. For example:
864 char s[] = "-abc-=-def";
865 char *sp;
866 x = mbstok_r(s, "-", &sp); // x = "abc", sp = "=-def"
867 x = mbstok_r(NULL, "-=", &sp); // x = "def", sp = NULL
868 x = mbstok_r(NULL, "=", &sp); // x = NULL
869 // s = "abc\0-def\0"
870
871 Caveat: It modifies the original string.
872 Caveat: These functions cannot be used on constant strings.
873 Caveat: The identity of the delimiting character is lost.
874
875 See also mbssep(). */
876_GL_EXTERN_C char * mbstok_r (char *string, const char *delim, char **save_ptr)
877 _GL_ARG_NONNULL ((2, 3));
878#endif
879
880/* Map any int, typically from errno, into an error message. */
881#if @GNULIB_STRERROR@
882# if @REPLACE_STRERROR@
883# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
884# undef strerror
885# define strerror rpl_strerror
886# endif
887_GL_FUNCDECL_RPL (strerror, char *, (int));
888_GL_CXXALIAS_RPL (strerror, char *, (int));
889# else
890_GL_CXXALIAS_SYS (strerror, char *, (int));
891# endif
892_GL_CXXALIASWARN (strerror);
893#elif defined GNULIB_POSIXCHECK
894# undef strerror
895/* Assume strerror is always declared. */
896_GL_WARN_ON_USE (strerror, "strerror is unportable - "
897 "use gnulib module strerror to guarantee non-NULL result");
898#endif
899
900/* Map any int, typically from errno, into an error message. Multithread-safe.
901 Uses the POSIX declaration, not the glibc declaration. */
902#if @GNULIB_STRERROR_R@
903# if @REPLACE_STRERROR_R@
904# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
905# undef strerror_r
906# define strerror_r rpl_strerror_r
907# endif
908_GL_FUNCDECL_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen)
909 _GL_ARG_NONNULL ((2)));
910_GL_CXXALIAS_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen));
911# else
912# if !@HAVE_DECL_STRERROR_R@
913_GL_FUNCDECL_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen)
914 _GL_ARG_NONNULL ((2)));
915# endif
916_GL_CXXALIAS_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen));
917# endif
918# if @HAVE_DECL_STRERROR_R@
919_GL_CXXALIASWARN (strerror_r);
920# endif
921#elif defined GNULIB_POSIXCHECK
922# undef strerror_r
923# if HAVE_RAW_DECL_STRERROR_R
924_GL_WARN_ON_USE (strerror_r, "strerror_r is unportable - "
925 "use gnulib module strerror_r-posix for portability");
926# endif
927#endif
928
929#if @GNULIB_STRSIGNAL@
930# if @REPLACE_STRSIGNAL@
931# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
932# define strsignal rpl_strsignal
933# endif
934_GL_FUNCDECL_RPL (strsignal, char *, (int __sig));
935_GL_CXXALIAS_RPL (strsignal, char *, (int __sig));
936# else
937# if ! @HAVE_DECL_STRSIGNAL@
938_GL_FUNCDECL_SYS (strsignal, char *, (int __sig));
939# endif
940/* Need to cast, because on Cygwin 1.5.x systems, the return type is
941 'const char *'. */
942_GL_CXXALIAS_SYS_CAST (strsignal, char *, (int __sig));
943# endif
944_GL_CXXALIASWARN (strsignal);
945#elif defined GNULIB_POSIXCHECK
946# undef strsignal
947# if HAVE_RAW_DECL_STRSIGNAL
948_GL_WARN_ON_USE (strsignal, "strsignal is unportable - "
949 "use gnulib module strsignal for portability");
950# endif
951#endif
952
953#if @GNULIB_STRVERSCMP@
954# if !@HAVE_STRVERSCMP@
955_GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *)
956 _GL_ARG_NONNULL ((1, 2)));
957# endif
958_GL_CXXALIAS_SYS (strverscmp, int, (const char *, const char *));
959_GL_CXXALIASWARN (strverscmp);
960#elif defined GNULIB_POSIXCHECK
961# undef strverscmp
962# if HAVE_RAW_DECL_STRVERSCMP
963_GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - "
964 "use gnulib module strverscmp for portability");
965# endif
966#endif
967
968
969#endif /* _GL_STRING_H */
970#endif /* _GL_STRING_H */
diff --git a/src/util/libgnu/strtok_r.c b/src/util/libgnu/strtok_r.c
deleted file mode 100644
index 789c95c79..000000000
--- a/src/util/libgnu/strtok_r.c
+++ /dev/null
@@ -1,76 +0,0 @@
1/* Reentrant string tokenizer. Generic version.
2 Copyright (C) 1991, 1996-1999, 2001, 2004, 2007, 2009-2011 Free Software
3 Foundation, Inc.
4 This file is part of the GNU C Library.
5
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
18
19#ifdef HAVE_CONFIG_H
20# include <gnunet_config.h>
21#endif
22
23#include <string.h>
24
25#ifdef _LIBC
26# undef strtok_r
27# undef __strtok_r
28#else
29# define __strtok_r strtok_r
30# define __rawmemchr strchr
31#endif
32
33/* Parse S into tokens separated by characters in DELIM.
34 If S is NULL, the saved pointer in SAVE_PTR is used as
35 the next starting point. For example:
36 char s[] = "-abc-=-def";
37 char *sp;
38 x = strtok_r(s, "-", &sp); // x = "abc", sp = "=-def"
39 x = strtok_r(NULL, "-=", &sp); // x = "def", sp = NULL
40 x = strtok_r(NULL, "=", &sp); // x = NULL
41 // s = "abc\0-def\0"
42*/
43char *
44__strtok_r (char *s, const char *delim, char **save_ptr)
45{
46 char *token;
47
48 if (s == NULL)
49 s = *save_ptr;
50
51 /* Scan leading delimiters. */
52 s += strspn (s, delim);
53 if (*s == '\0')
54 {
55 *save_ptr = s;
56 return NULL;
57 }
58
59 /* Find the end of the token. */
60 token = s;
61 s = strpbrk (token, delim);
62 if (s == NULL)
63 /* This token finishes the string. */
64 *save_ptr = __rawmemchr (token, '\0');
65 else
66 {
67 /* Terminate the token and make *SAVE_PTR point past it. */
68 *s = '\0';
69 *save_ptr = s + 1;
70 }
71 return token;
72}
73#ifdef weak_alias
74libc_hidden_def (__strtok_r)
75weak_alias (__strtok_r, strtok_r)
76#endif