xref: /Universal-ctags/gnulib/string.in.h (revision a939078a69878851c19820eb92e6cb95ba429546)
1*a939078aSHiroo HAYASHI /* A GNU-like <string.h>.
2*a939078aSHiroo HAYASHI 
3*a939078aSHiroo HAYASHI    Copyright (C) 1995-1996, 2001-2021 Free Software Foundation, Inc.
4*a939078aSHiroo HAYASHI 
5*a939078aSHiroo HAYASHI    This file is free software: you can redistribute it and/or modify
6*a939078aSHiroo HAYASHI    it under the terms of the GNU Lesser General Public License as
7*a939078aSHiroo HAYASHI    published by the Free Software Foundation; either version 2.1 of the
8*a939078aSHiroo HAYASHI    License, or (at your option) any later version.
9*a939078aSHiroo HAYASHI 
10*a939078aSHiroo HAYASHI    This file is distributed in the hope that it will be useful,
11*a939078aSHiroo HAYASHI    but WITHOUT ANY WARRANTY; without even the implied warranty of
12*a939078aSHiroo HAYASHI    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13*a939078aSHiroo HAYASHI    GNU Lesser General Public License for more details.
14*a939078aSHiroo HAYASHI 
15*a939078aSHiroo HAYASHI    You should have received a copy of the GNU Lesser General Public License
16*a939078aSHiroo HAYASHI    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
17*a939078aSHiroo HAYASHI 
18*a939078aSHiroo HAYASHI #if __GNUC__ >= 3
19*a939078aSHiroo HAYASHI @PRAGMA_SYSTEM_HEADER@
20*a939078aSHiroo HAYASHI #endif
21*a939078aSHiroo HAYASHI @PRAGMA_COLUMNS@
22*a939078aSHiroo HAYASHI 
23*a939078aSHiroo HAYASHI #if defined _GL_ALREADY_INCLUDING_STRING_H
24*a939078aSHiroo HAYASHI /* Special invocation convention:
25*a939078aSHiroo HAYASHI    - On OS X/NetBSD we have a sequence of nested includes
26*a939078aSHiroo HAYASHI        <string.h> -> <strings.h> -> "string.h"
27*a939078aSHiroo HAYASHI      In this situation system _chk variants due to -D_FORTIFY_SOURCE
28*a939078aSHiroo HAYASHI      might be used after any replacements defined here.  */
29*a939078aSHiroo HAYASHI 
30*a939078aSHiroo HAYASHI #@INCLUDE_NEXT@ @NEXT_STRING_H@
31*a939078aSHiroo HAYASHI 
32*a939078aSHiroo HAYASHI #else
33*a939078aSHiroo HAYASHI /* Normal invocation convention.  */
34*a939078aSHiroo HAYASHI 
35*a939078aSHiroo HAYASHI #ifndef _@GUARD_PREFIX@_STRING_H
36*a939078aSHiroo HAYASHI 
37*a939078aSHiroo HAYASHI #define _GL_ALREADY_INCLUDING_STRING_H
38*a939078aSHiroo HAYASHI 
39*a939078aSHiroo HAYASHI /* The include_next requires a split double-inclusion guard.  */
40*a939078aSHiroo HAYASHI #@INCLUDE_NEXT@ @NEXT_STRING_H@
41*a939078aSHiroo HAYASHI 
42*a939078aSHiroo HAYASHI #undef _GL_ALREADY_INCLUDING_STRING_H
43*a939078aSHiroo HAYASHI 
44*a939078aSHiroo HAYASHI #ifndef _@GUARD_PREFIX@_STRING_H
45*a939078aSHiroo HAYASHI #define _@GUARD_PREFIX@_STRING_H
46*a939078aSHiroo HAYASHI 
47*a939078aSHiroo HAYASHI /* NetBSD 5.0 mis-defines NULL.  */
48*a939078aSHiroo HAYASHI #include <stddef.h>
49*a939078aSHiroo HAYASHI 
50*a939078aSHiroo HAYASHI /* MirBSD defines mbslen as a macro.  */
51*a939078aSHiroo HAYASHI #if @GNULIB_MBSLEN@ && defined __MirBSD__
52*a939078aSHiroo HAYASHI # include <wchar.h>
53*a939078aSHiroo HAYASHI #endif
54*a939078aSHiroo HAYASHI 
55*a939078aSHiroo HAYASHI /* The __attribute__ feature is available in gcc versions 2.5 and later.
56*a939078aSHiroo HAYASHI    The attribute __pure__ was added in gcc 2.96.  */
57*a939078aSHiroo HAYASHI #ifndef _GL_ATTRIBUTE_PURE
58*a939078aSHiroo HAYASHI # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
59*a939078aSHiroo HAYASHI #  define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
60*a939078aSHiroo HAYASHI # else
61*a939078aSHiroo HAYASHI #  define _GL_ATTRIBUTE_PURE /* empty */
62*a939078aSHiroo HAYASHI # endif
63*a939078aSHiroo HAYASHI #endif
64*a939078aSHiroo HAYASHI 
65*a939078aSHiroo HAYASHI /* NetBSD 5.0 declares strsignal in <unistd.h>, not in <string.h>.  */
66*a939078aSHiroo HAYASHI /* But in any case avoid namespace pollution on glibc systems.  */
67*a939078aSHiroo HAYASHI #if (@GNULIB_STRSIGNAL@ || defined GNULIB_POSIXCHECK) && defined __NetBSD__ \
68*a939078aSHiroo HAYASHI     && ! defined __GLIBC__
69*a939078aSHiroo HAYASHI # include <unistd.h>
70*a939078aSHiroo HAYASHI #endif
71*a939078aSHiroo HAYASHI 
72*a939078aSHiroo HAYASHI /* AIX 7.2 declares ffsl and ffsll in <strings.h>, not in <string.h>.  */
73*a939078aSHiroo HAYASHI /* But in any case avoid namespace pollution on glibc systems.  */
74*a939078aSHiroo HAYASHI #if ((@GNULIB_FFSL@ || @GNULIB_FFSLL@ || defined GNULIB_POSIXCHECK) \
75*a939078aSHiroo HAYASHI      && defined _AIX) \
76*a939078aSHiroo HAYASHI     && ! defined __GLIBC__
77*a939078aSHiroo HAYASHI # include <strings.h>
78*a939078aSHiroo HAYASHI #endif
79*a939078aSHiroo HAYASHI 
80*a939078aSHiroo HAYASHI /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
81*a939078aSHiroo HAYASHI 
82*a939078aSHiroo HAYASHI /* The definition of _GL_ARG_NONNULL is copied here.  */
83*a939078aSHiroo HAYASHI 
84*a939078aSHiroo HAYASHI /* The definition of _GL_WARN_ON_USE is copied here.  */
85*a939078aSHiroo HAYASHI 
86*a939078aSHiroo HAYASHI 
87*a939078aSHiroo HAYASHI /* Clear a block of memory.  The compiler will not delete a call to
88*a939078aSHiroo HAYASHI    this function, even if the block is dead after the call.  */
89*a939078aSHiroo HAYASHI #if @GNULIB_EXPLICIT_BZERO@
90*a939078aSHiroo HAYASHI # if ! @HAVE_EXPLICIT_BZERO@
91*a939078aSHiroo HAYASHI _GL_FUNCDECL_SYS (explicit_bzero, void,
92*a939078aSHiroo HAYASHI                   (void *__dest, size_t __n) _GL_ARG_NONNULL ((1)));
93*a939078aSHiroo HAYASHI # endif
94*a939078aSHiroo HAYASHI _GL_CXXALIAS_SYS (explicit_bzero, void, (void *__dest, size_t __n));
95*a939078aSHiroo HAYASHI _GL_CXXALIASWARN (explicit_bzero);
96*a939078aSHiroo HAYASHI #elif defined GNULIB_POSIXCHECK
97*a939078aSHiroo HAYASHI # undef explicit_bzero
98*a939078aSHiroo HAYASHI # if HAVE_RAW_DECL_EXPLICIT_BZERO
99*a939078aSHiroo HAYASHI _GL_WARN_ON_USE (explicit_bzero, "explicit_bzero is unportable - "
100*a939078aSHiroo HAYASHI                  "use gnulib module explicit_bzero for portability");
101*a939078aSHiroo HAYASHI # endif
102*a939078aSHiroo HAYASHI #endif
103*a939078aSHiroo HAYASHI 
104*a939078aSHiroo HAYASHI /* Find the index of the least-significant set bit.  */
105*a939078aSHiroo HAYASHI #if @GNULIB_FFSL@
106*a939078aSHiroo HAYASHI # if !@HAVE_FFSL@
107*a939078aSHiroo HAYASHI _GL_FUNCDECL_SYS (ffsl, int, (long int i));
108*a939078aSHiroo HAYASHI # endif
109*a939078aSHiroo HAYASHI _GL_CXXALIAS_SYS (ffsl, int, (long int i));
110*a939078aSHiroo HAYASHI _GL_CXXALIASWARN (ffsl);
111*a939078aSHiroo HAYASHI #elif defined GNULIB_POSIXCHECK
112*a939078aSHiroo HAYASHI # undef ffsl
113*a939078aSHiroo HAYASHI # if HAVE_RAW_DECL_FFSL
114*a939078aSHiroo HAYASHI _GL_WARN_ON_USE (ffsl, "ffsl is not portable - use the ffsl module");
115*a939078aSHiroo HAYASHI # endif
116*a939078aSHiroo HAYASHI #endif
117*a939078aSHiroo HAYASHI 
118*a939078aSHiroo HAYASHI 
119*a939078aSHiroo HAYASHI /* Find the index of the least-significant set bit.  */
120*a939078aSHiroo HAYASHI #if @GNULIB_FFSLL@
121*a939078aSHiroo HAYASHI # if @REPLACE_FFSLL@
122*a939078aSHiroo HAYASHI #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
123*a939078aSHiroo HAYASHI #   define ffsll rpl_ffsll
124*a939078aSHiroo HAYASHI #  endif
125*a939078aSHiroo HAYASHI _GL_FUNCDECL_RPL (ffsll, int, (long long int i));
126*a939078aSHiroo HAYASHI _GL_CXXALIAS_RPL (ffsll, int, (long long int i));
127*a939078aSHiroo HAYASHI # else
128*a939078aSHiroo HAYASHI #  if !@HAVE_FFSLL@
129*a939078aSHiroo HAYASHI _GL_FUNCDECL_SYS (ffsll, int, (long long int i));
130*a939078aSHiroo HAYASHI #  endif
131*a939078aSHiroo HAYASHI _GL_CXXALIAS_SYS (ffsll, int, (long long int i));
132*a939078aSHiroo HAYASHI # endif
133*a939078aSHiroo HAYASHI _GL_CXXALIASWARN (ffsll);
134*a939078aSHiroo HAYASHI #elif defined GNULIB_POSIXCHECK
135*a939078aSHiroo HAYASHI # undef ffsll
136*a939078aSHiroo HAYASHI # if HAVE_RAW_DECL_FFSLL
137*a939078aSHiroo HAYASHI _GL_WARN_ON_USE (ffsll, "ffsll is not portable - use the ffsll module");
138*a939078aSHiroo HAYASHI # endif
139*a939078aSHiroo HAYASHI #endif
140*a939078aSHiroo HAYASHI 
141*a939078aSHiroo HAYASHI 
142*a939078aSHiroo HAYASHI #if @GNULIB_MDA_MEMCCPY@
143*a939078aSHiroo HAYASHI /* On native Windows, map 'memccpy' to '_memccpy', so that -loldnames is not
144*a939078aSHiroo HAYASHI    required.  In C++ with GNULIB_NAMESPACE, avoid differences between
145*a939078aSHiroo HAYASHI    platforms by defining GNULIB_NAMESPACE::memccpy always.  */
146*a939078aSHiroo HAYASHI # if defined _WIN32 && !defined __CYGWIN__
147*a939078aSHiroo HAYASHI #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
148*a939078aSHiroo HAYASHI #   undef memccpy
149*a939078aSHiroo HAYASHI #   define memccpy _memccpy
150*a939078aSHiroo HAYASHI #  endif
151*a939078aSHiroo HAYASHI _GL_CXXALIAS_MDA (memccpy, void *,
152*a939078aSHiroo HAYASHI                   (void *dest, const void *src, int c, size_t n));
153*a939078aSHiroo HAYASHI # else
154*a939078aSHiroo HAYASHI _GL_CXXALIAS_SYS (memccpy, void *,
155*a939078aSHiroo HAYASHI                   (void *dest, const void *src, int c, size_t n));
156*a939078aSHiroo HAYASHI # endif
157*a939078aSHiroo HAYASHI _GL_CXXALIASWARN (memccpy);
158*a939078aSHiroo HAYASHI #endif
159*a939078aSHiroo HAYASHI 
160*a939078aSHiroo HAYASHI 
161*a939078aSHiroo HAYASHI /* Return the first instance of C within N bytes of S, or NULL.  */
162*a939078aSHiroo HAYASHI #if @GNULIB_MEMCHR@
163*a939078aSHiroo HAYASHI # if @REPLACE_MEMCHR@
164*a939078aSHiroo HAYASHI #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
165*a939078aSHiroo HAYASHI #   undef memchr
166*a939078aSHiroo HAYASHI #   define memchr rpl_memchr
167*a939078aSHiroo HAYASHI #  endif
168*a939078aSHiroo HAYASHI _GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n)
169*a939078aSHiroo HAYASHI                                   _GL_ATTRIBUTE_PURE
170*a939078aSHiroo HAYASHI                                   _GL_ARG_NONNULL ((1)));
171*a939078aSHiroo HAYASHI _GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n));
172*a939078aSHiroo HAYASHI # else
173*a939078aSHiroo HAYASHI   /* On some systems, this function is defined as an overloaded function:
174*a939078aSHiroo HAYASHI        extern "C" { const void * std::memchr (const void *, int, size_t); }
175*a939078aSHiroo HAYASHI        extern "C++" { void * std::memchr (void *, int, size_t); }  */
176*a939078aSHiroo HAYASHI _GL_CXXALIAS_SYS_CAST2 (memchr,
177*a939078aSHiroo HAYASHI                         void *, (void const *__s, int __c, size_t __n),
178*a939078aSHiroo HAYASHI                         void const *, (void const *__s, int __c, size_t __n));
179*a939078aSHiroo HAYASHI # endif
180*a939078aSHiroo HAYASHI # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
181*a939078aSHiroo HAYASHI      && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
182*a939078aSHiroo HAYASHI _GL_CXXALIASWARN1 (memchr, void *, (void *__s, int __c, size_t __n));
183*a939078aSHiroo HAYASHI _GL_CXXALIASWARN1 (memchr, void const *,
184*a939078aSHiroo HAYASHI                    (void const *__s, int __c, size_t __n));
185*a939078aSHiroo HAYASHI # elif __GLIBC__ >= 2
186*a939078aSHiroo HAYASHI _GL_CXXALIASWARN (memchr);
187*a939078aSHiroo HAYASHI # endif
188*a939078aSHiroo HAYASHI #elif defined GNULIB_POSIXCHECK
189*a939078aSHiroo HAYASHI # undef memchr
190*a939078aSHiroo HAYASHI /* Assume memchr is always declared.  */
191*a939078aSHiroo HAYASHI _GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - "
192*a939078aSHiroo HAYASHI                  "use gnulib module memchr for portability" );
193*a939078aSHiroo HAYASHI #endif
194*a939078aSHiroo HAYASHI 
195*a939078aSHiroo HAYASHI /* Return the first occurrence of NEEDLE in HAYSTACK.  */
196*a939078aSHiroo HAYASHI #if @GNULIB_MEMMEM@
197*a939078aSHiroo HAYASHI # if @REPLACE_MEMMEM@
198*a939078aSHiroo HAYASHI #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
199*a939078aSHiroo HAYASHI #   define memmem rpl_memmem
200*a939078aSHiroo HAYASHI #  endif
201*a939078aSHiroo HAYASHI _GL_FUNCDECL_RPL (memmem, void *,
202*a939078aSHiroo HAYASHI                   (void const *__haystack, size_t __haystack_len,
203*a939078aSHiroo HAYASHI                    void const *__needle, size_t __needle_len)
204*a939078aSHiroo HAYASHI                   _GL_ATTRIBUTE_PURE
205*a939078aSHiroo HAYASHI                   _GL_ARG_NONNULL ((1, 3)));
206*a939078aSHiroo HAYASHI _GL_CXXALIAS_RPL (memmem, void *,
207*a939078aSHiroo HAYASHI                   (void const *__haystack, size_t __haystack_len,
208*a939078aSHiroo HAYASHI                    void const *__needle, size_t __needle_len));
209*a939078aSHiroo HAYASHI # else
210*a939078aSHiroo HAYASHI #  if ! @HAVE_DECL_MEMMEM@
211*a939078aSHiroo HAYASHI _GL_FUNCDECL_SYS (memmem, void *,
212*a939078aSHiroo HAYASHI                   (void const *__haystack, size_t __haystack_len,
213*a939078aSHiroo HAYASHI                    void const *__needle, size_t __needle_len)
214*a939078aSHiroo HAYASHI                   _GL_ATTRIBUTE_PURE
215*a939078aSHiroo HAYASHI                   _GL_ARG_NONNULL ((1, 3)));
216*a939078aSHiroo HAYASHI #  endif
217*a939078aSHiroo HAYASHI _GL_CXXALIAS_SYS (memmem, void *,
218*a939078aSHiroo HAYASHI                   (void const *__haystack, size_t __haystack_len,
219*a939078aSHiroo HAYASHI                    void const *__needle, size_t __needle_len));
220*a939078aSHiroo HAYASHI # endif
221*a939078aSHiroo HAYASHI _GL_CXXALIASWARN (memmem);
222*a939078aSHiroo HAYASHI #elif defined GNULIB_POSIXCHECK
223*a939078aSHiroo HAYASHI # undef memmem
224*a939078aSHiroo HAYASHI # if HAVE_RAW_DECL_MEMMEM
225*a939078aSHiroo HAYASHI _GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - "
226*a939078aSHiroo HAYASHI                  "use gnulib module memmem-simple for portability, "
227*a939078aSHiroo HAYASHI                  "and module memmem for speed" );
228*a939078aSHiroo HAYASHI # endif
229*a939078aSHiroo HAYASHI #endif
230*a939078aSHiroo HAYASHI 
231*a939078aSHiroo HAYASHI /* Copy N bytes of SRC to DEST, return pointer to bytes after the
232*a939078aSHiroo HAYASHI    last written byte.  */
233*a939078aSHiroo HAYASHI #if @GNULIB_MEMPCPY@
234*a939078aSHiroo HAYASHI # if ! @HAVE_MEMPCPY@
235*a939078aSHiroo HAYASHI _GL_FUNCDECL_SYS (mempcpy, void *,
236*a939078aSHiroo HAYASHI                   (void *restrict __dest, void const *restrict __src,
237*a939078aSHiroo HAYASHI                    size_t __n)
238*a939078aSHiroo HAYASHI                   _GL_ARG_NONNULL ((1, 2)));
239*a939078aSHiroo HAYASHI # endif
240*a939078aSHiroo HAYASHI _GL_CXXALIAS_SYS (mempcpy, void *,
241*a939078aSHiroo HAYASHI                   (void *restrict __dest, void const *restrict __src,
242*a939078aSHiroo HAYASHI                    size_t __n));
243*a939078aSHiroo HAYASHI _GL_CXXALIASWARN (mempcpy);
244*a939078aSHiroo HAYASHI #elif defined GNULIB_POSIXCHECK
245*a939078aSHiroo HAYASHI # undef mempcpy
246*a939078aSHiroo HAYASHI # if HAVE_RAW_DECL_MEMPCPY
247*a939078aSHiroo HAYASHI _GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - "
248*a939078aSHiroo HAYASHI                  "use gnulib module mempcpy for portability");
249*a939078aSHiroo HAYASHI # endif
250*a939078aSHiroo HAYASHI #endif
251*a939078aSHiroo HAYASHI 
252*a939078aSHiroo HAYASHI /* Search backwards through a block for a byte (specified as an int).  */
253*a939078aSHiroo HAYASHI #if @GNULIB_MEMRCHR@
254*a939078aSHiroo HAYASHI # if ! @HAVE_DECL_MEMRCHR@
255*a939078aSHiroo HAYASHI _GL_FUNCDECL_SYS (memrchr, void *, (void const *, int, size_t)
256*a939078aSHiroo HAYASHI                                    _GL_ATTRIBUTE_PURE
257*a939078aSHiroo HAYASHI                                    _GL_ARG_NONNULL ((1)));
258*a939078aSHiroo HAYASHI # endif
259*a939078aSHiroo HAYASHI   /* On some systems, this function is defined as an overloaded function:
260*a939078aSHiroo HAYASHI        extern "C++" { const void * std::memrchr (const void *, int, size_t); }
261*a939078aSHiroo HAYASHI        extern "C++" { void * std::memrchr (void *, int, size_t); }  */
262*a939078aSHiroo HAYASHI _GL_CXXALIAS_SYS_CAST2 (memrchr,
263*a939078aSHiroo HAYASHI                         void *, (void const *, int, size_t),
264*a939078aSHiroo HAYASHI                         void const *, (void const *, int, size_t));
265*a939078aSHiroo HAYASHI # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
266*a939078aSHiroo HAYASHI      && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
267*a939078aSHiroo HAYASHI _GL_CXXALIASWARN1 (memrchr, void *, (void *, int, size_t));
268*a939078aSHiroo HAYASHI _GL_CXXALIASWARN1 (memrchr, void const *, (void const *, int, size_t));
269*a939078aSHiroo HAYASHI # else
270*a939078aSHiroo HAYASHI _GL_CXXALIASWARN (memrchr);
271*a939078aSHiroo HAYASHI # endif
272*a939078aSHiroo HAYASHI #elif defined GNULIB_POSIXCHECK
273*a939078aSHiroo HAYASHI # undef memrchr
274*a939078aSHiroo HAYASHI # if HAVE_RAW_DECL_MEMRCHR
275*a939078aSHiroo HAYASHI _GL_WARN_ON_USE (memrchr, "memrchr is unportable - "
276*a939078aSHiroo HAYASHI                  "use gnulib module memrchr for portability");
277*a939078aSHiroo HAYASHI # endif
278*a939078aSHiroo HAYASHI #endif
279*a939078aSHiroo HAYASHI 
280*a939078aSHiroo HAYASHI /* Find the first occurrence of C in S.  More efficient than
281*a939078aSHiroo HAYASHI    memchr(S,C,N), at the expense of undefined behavior if C does not
282*a939078aSHiroo HAYASHI    occur within N bytes.  */
283*a939078aSHiroo HAYASHI #if @GNULIB_RAWMEMCHR@
284*a939078aSHiroo HAYASHI # if ! @HAVE_RAWMEMCHR@
285*a939078aSHiroo HAYASHI _GL_FUNCDECL_SYS (rawmemchr, void *, (void const *__s, int __c_in)
286*a939078aSHiroo HAYASHI                                      _GL_ATTRIBUTE_PURE
287*a939078aSHiroo HAYASHI                                      _GL_ARG_NONNULL ((1)));
288*a939078aSHiroo HAYASHI # endif
289*a939078aSHiroo HAYASHI   /* On some systems, this function is defined as an overloaded function:
290*a939078aSHiroo HAYASHI        extern "C++" { const void * std::rawmemchr (const void *, int); }
291*a939078aSHiroo HAYASHI        extern "C++" { void * std::rawmemchr (void *, int); }  */
292*a939078aSHiroo HAYASHI _GL_CXXALIAS_SYS_CAST2 (rawmemchr,
293*a939078aSHiroo HAYASHI                         void *, (void const *__s, int __c_in),
294*a939078aSHiroo HAYASHI                         void const *, (void const *__s, int __c_in));
295*a939078aSHiroo HAYASHI # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
296*a939078aSHiroo HAYASHI      && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
297*a939078aSHiroo HAYASHI _GL_CXXALIASWARN1 (rawmemchr, void *, (void *__s, int __c_in));
298*a939078aSHiroo HAYASHI _GL_CXXALIASWARN1 (rawmemchr, void const *, (void const *__s, int __c_in));
299*a939078aSHiroo HAYASHI # else
300*a939078aSHiroo HAYASHI _GL_CXXALIASWARN (rawmemchr);
301*a939078aSHiroo HAYASHI # endif
302*a939078aSHiroo HAYASHI #elif defined GNULIB_POSIXCHECK
303*a939078aSHiroo HAYASHI # undef rawmemchr
304*a939078aSHiroo HAYASHI # if HAVE_RAW_DECL_RAWMEMCHR
305*a939078aSHiroo HAYASHI _GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - "
306*a939078aSHiroo HAYASHI                  "use gnulib module rawmemchr for portability");
307*a939078aSHiroo HAYASHI # endif
308*a939078aSHiroo HAYASHI #endif
309*a939078aSHiroo HAYASHI 
310*a939078aSHiroo HAYASHI /* Copy SRC to DST, returning the address of the terminating '\0' in DST.  */
311*a939078aSHiroo HAYASHI #if @GNULIB_STPCPY@
312*a939078aSHiroo HAYASHI # if ! @HAVE_STPCPY@
313*a939078aSHiroo HAYASHI _GL_FUNCDECL_SYS (stpcpy, char *,
314*a939078aSHiroo HAYASHI                   (char *restrict __dst, char const *restrict __src)
315*a939078aSHiroo HAYASHI                   _GL_ARG_NONNULL ((1, 2)));
316*a939078aSHiroo HAYASHI # endif
317*a939078aSHiroo HAYASHI _GL_CXXALIAS_SYS (stpcpy, char *,
318*a939078aSHiroo HAYASHI                   (char *restrict __dst, char const *restrict __src));
319*a939078aSHiroo HAYASHI _GL_CXXALIASWARN (stpcpy);
320*a939078aSHiroo HAYASHI #elif defined GNULIB_POSIXCHECK
321*a939078aSHiroo HAYASHI # undef stpcpy
322*a939078aSHiroo HAYASHI # if HAVE_RAW_DECL_STPCPY
323*a939078aSHiroo HAYASHI _GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - "
324*a939078aSHiroo HAYASHI                  "use gnulib module stpcpy for portability");
325*a939078aSHiroo HAYASHI # endif
326*a939078aSHiroo HAYASHI #endif
327*a939078aSHiroo HAYASHI 
328*a939078aSHiroo HAYASHI /* Copy no more than N bytes of SRC to DST, returning a pointer past the
329*a939078aSHiroo HAYASHI    last non-NUL byte written into DST.  */
330*a939078aSHiroo HAYASHI #if @GNULIB_STPNCPY@
331*a939078aSHiroo HAYASHI # if @REPLACE_STPNCPY@
332*a939078aSHiroo HAYASHI #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
333*a939078aSHiroo HAYASHI #   undef stpncpy
334*a939078aSHiroo HAYASHI #   define stpncpy rpl_stpncpy
335*a939078aSHiroo HAYASHI #  endif
336*a939078aSHiroo HAYASHI _GL_FUNCDECL_RPL (stpncpy, char *,
337*a939078aSHiroo HAYASHI                   (char *restrict __dst, char const *restrict __src,
338*a939078aSHiroo HAYASHI                    size_t __n)
339*a939078aSHiroo HAYASHI                   _GL_ARG_NONNULL ((1, 2)));
340*a939078aSHiroo HAYASHI _GL_CXXALIAS_RPL (stpncpy, char *,
341*a939078aSHiroo HAYASHI                   (char *restrict __dst, char const *restrict __src,
342*a939078aSHiroo HAYASHI                    size_t __n));
343*a939078aSHiroo HAYASHI # else
344*a939078aSHiroo HAYASHI #  if ! @HAVE_STPNCPY@
345*a939078aSHiroo HAYASHI _GL_FUNCDECL_SYS (stpncpy, char *,
346*a939078aSHiroo HAYASHI                   (char *restrict __dst, char const *restrict __src,
347*a939078aSHiroo HAYASHI                    size_t __n)
348*a939078aSHiroo HAYASHI                   _GL_ARG_NONNULL ((1, 2)));
349*a939078aSHiroo HAYASHI #  endif
350*a939078aSHiroo HAYASHI _GL_CXXALIAS_SYS (stpncpy, char *,
351*a939078aSHiroo HAYASHI                   (char *restrict __dst, char const *restrict __src,
352*a939078aSHiroo HAYASHI                    size_t __n));
353*a939078aSHiroo HAYASHI # endif
354*a939078aSHiroo HAYASHI _GL_CXXALIASWARN (stpncpy);
355*a939078aSHiroo HAYASHI #elif defined GNULIB_POSIXCHECK
356*a939078aSHiroo HAYASHI # undef stpncpy
357*a939078aSHiroo HAYASHI # if HAVE_RAW_DECL_STPNCPY
358*a939078aSHiroo HAYASHI _GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - "
359*a939078aSHiroo HAYASHI                  "use gnulib module stpncpy for portability");
360*a939078aSHiroo HAYASHI # endif
361*a939078aSHiroo HAYASHI #endif
362*a939078aSHiroo HAYASHI 
363*a939078aSHiroo HAYASHI #if defined GNULIB_POSIXCHECK
364*a939078aSHiroo HAYASHI /* strchr() does not work with multibyte strings if the locale encoding is
365*a939078aSHiroo HAYASHI    GB18030 and the character to be searched is a digit.  */
366*a939078aSHiroo HAYASHI # undef strchr
367*a939078aSHiroo HAYASHI /* Assume strchr is always declared.  */
368*a939078aSHiroo HAYASHI _GL_WARN_ON_USE_CXX (strchr,
369*a939078aSHiroo HAYASHI                      const char *, char *, (const char *, int),
370*a939078aSHiroo HAYASHI                      "strchr cannot work correctly on character strings "
371*a939078aSHiroo HAYASHI                      "in some multibyte locales - "
372*a939078aSHiroo HAYASHI                      "use mbschr if you care about internationalization");
373*a939078aSHiroo HAYASHI #endif
374*a939078aSHiroo HAYASHI 
375*a939078aSHiroo HAYASHI /* Find the first occurrence of C in S or the final NUL byte.  */
376*a939078aSHiroo HAYASHI #if @GNULIB_STRCHRNUL@
377*a939078aSHiroo HAYASHI # if @REPLACE_STRCHRNUL@
378*a939078aSHiroo HAYASHI #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
379*a939078aSHiroo HAYASHI #   define strchrnul rpl_strchrnul
380*a939078aSHiroo HAYASHI #  endif
381*a939078aSHiroo HAYASHI _GL_FUNCDECL_RPL (strchrnul, char *, (const char *__s, int __c_in)
382*a939078aSHiroo HAYASHI                                      _GL_ATTRIBUTE_PURE
383*a939078aSHiroo HAYASHI                                      _GL_ARG_NONNULL ((1)));
384*a939078aSHiroo HAYASHI _GL_CXXALIAS_RPL (strchrnul, char *,
385*a939078aSHiroo HAYASHI                   (const char *str, int ch));
386*a939078aSHiroo HAYASHI # else
387*a939078aSHiroo HAYASHI #  if ! @HAVE_STRCHRNUL@
388*a939078aSHiroo HAYASHI _GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in)
389*a939078aSHiroo HAYASHI                                      _GL_ATTRIBUTE_PURE
390*a939078aSHiroo HAYASHI                                      _GL_ARG_NONNULL ((1)));
391*a939078aSHiroo HAYASHI #  endif
392*a939078aSHiroo HAYASHI   /* On some systems, this function is defined as an overloaded function:
393*a939078aSHiroo HAYASHI        extern "C++" { const char * std::strchrnul (const char *, int); }
394*a939078aSHiroo HAYASHI        extern "C++" { char * std::strchrnul (char *, int); }  */
395*a939078aSHiroo HAYASHI _GL_CXXALIAS_SYS_CAST2 (strchrnul,
396*a939078aSHiroo HAYASHI                         char *, (char const *__s, int __c_in),
397*a939078aSHiroo HAYASHI                         char const *, (char const *__s, int __c_in));
398*a939078aSHiroo HAYASHI # endif
399*a939078aSHiroo HAYASHI # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
400*a939078aSHiroo HAYASHI      && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
401*a939078aSHiroo HAYASHI _GL_CXXALIASWARN1 (strchrnul, char *, (char *__s, int __c_in));
402*a939078aSHiroo HAYASHI _GL_CXXALIASWARN1 (strchrnul, char const *, (char const *__s, int __c_in));
403*a939078aSHiroo HAYASHI # else
404*a939078aSHiroo HAYASHI _GL_CXXALIASWARN (strchrnul);
405*a939078aSHiroo HAYASHI # endif
406*a939078aSHiroo HAYASHI #elif defined GNULIB_POSIXCHECK
407*a939078aSHiroo HAYASHI # undef strchrnul
408*a939078aSHiroo HAYASHI # if HAVE_RAW_DECL_STRCHRNUL
409*a939078aSHiroo HAYASHI _GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - "
410*a939078aSHiroo HAYASHI                  "use gnulib module strchrnul for portability");
411*a939078aSHiroo HAYASHI # endif
412*a939078aSHiroo HAYASHI #endif
413*a939078aSHiroo HAYASHI 
414*a939078aSHiroo HAYASHI /* Duplicate S, returning an identical malloc'd string.  */
415*a939078aSHiroo HAYASHI #if @GNULIB_STRDUP@
416*a939078aSHiroo HAYASHI # if @REPLACE_STRDUP@
417*a939078aSHiroo HAYASHI #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
418*a939078aSHiroo HAYASHI #   undef strdup
419*a939078aSHiroo HAYASHI #   define strdup rpl_strdup
420*a939078aSHiroo HAYASHI #  endif
421*a939078aSHiroo HAYASHI _GL_FUNCDECL_RPL (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1)));
422*a939078aSHiroo HAYASHI _GL_CXXALIAS_RPL (strdup, char *, (char const *__s));
423*a939078aSHiroo HAYASHI # elif defined _WIN32 && !defined __CYGWIN__
424*a939078aSHiroo HAYASHI #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
425*a939078aSHiroo HAYASHI #   undef strdup
426*a939078aSHiroo HAYASHI #   define strdup _strdup
427*a939078aSHiroo HAYASHI #  endif
428*a939078aSHiroo HAYASHI _GL_CXXALIAS_MDA (strdup, char *, (char const *__s));
429*a939078aSHiroo HAYASHI # else
430*a939078aSHiroo HAYASHI #  if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup
431*a939078aSHiroo HAYASHI     /* strdup exists as a function and as a macro.  Get rid of the macro.  */
432*a939078aSHiroo HAYASHI #   undef strdup
433*a939078aSHiroo HAYASHI #  endif
434*a939078aSHiroo HAYASHI #  if !(@HAVE_DECL_STRDUP@ || defined strdup)
435*a939078aSHiroo HAYASHI _GL_FUNCDECL_SYS (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1)));
436*a939078aSHiroo HAYASHI #  endif
437*a939078aSHiroo HAYASHI _GL_CXXALIAS_SYS (strdup, char *, (char const *__s));
438*a939078aSHiroo HAYASHI # endif
439*a939078aSHiroo HAYASHI _GL_CXXALIASWARN (strdup);
440*a939078aSHiroo HAYASHI #elif defined GNULIB_POSIXCHECK
441*a939078aSHiroo HAYASHI # undef strdup
442*a939078aSHiroo HAYASHI # if HAVE_RAW_DECL_STRDUP
443*a939078aSHiroo HAYASHI _GL_WARN_ON_USE (strdup, "strdup is unportable - "
444*a939078aSHiroo HAYASHI                  "use gnulib module strdup for portability");
445*a939078aSHiroo HAYASHI # endif
446*a939078aSHiroo HAYASHI #elif @GNULIB_MDA_STRDUP@
447*a939078aSHiroo HAYASHI /* On native Windows, map 'creat' to '_creat', so that -loldnames is not
448*a939078aSHiroo HAYASHI    required.  In C++ with GNULIB_NAMESPACE, avoid differences between
449*a939078aSHiroo HAYASHI    platforms by defining GNULIB_NAMESPACE::strdup always.  */
450*a939078aSHiroo HAYASHI # if defined _WIN32 && !defined __CYGWIN__
451*a939078aSHiroo HAYASHI #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
452*a939078aSHiroo HAYASHI #   undef strdup
453*a939078aSHiroo HAYASHI #   define strdup _strdup
454*a939078aSHiroo HAYASHI #  endif
455*a939078aSHiroo HAYASHI _GL_CXXALIAS_MDA (strdup, char *, (char const *__s));
456*a939078aSHiroo HAYASHI # else
457*a939078aSHiroo HAYASHI #  if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup
458*a939078aSHiroo HAYASHI #   undef strdup
459*a939078aSHiroo HAYASHI #  endif
460*a939078aSHiroo HAYASHI _GL_CXXALIAS_SYS (strdup, char *, (char const *__s));
461*a939078aSHiroo HAYASHI # endif
462*a939078aSHiroo HAYASHI _GL_CXXALIASWARN (strdup);
463*a939078aSHiroo HAYASHI #endif
464*a939078aSHiroo HAYASHI 
465*a939078aSHiroo HAYASHI /* Append no more than N characters from SRC onto DEST.  */
466*a939078aSHiroo HAYASHI #if @GNULIB_STRNCAT@
467*a939078aSHiroo HAYASHI # if @REPLACE_STRNCAT@
468*a939078aSHiroo HAYASHI #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
469*a939078aSHiroo HAYASHI #   undef strncat
470*a939078aSHiroo HAYASHI #   define strncat rpl_strncat
471*a939078aSHiroo HAYASHI #  endif
472*a939078aSHiroo HAYASHI _GL_FUNCDECL_RPL (strncat, char *,
473*a939078aSHiroo HAYASHI                   (char *restrict dest, const char *restrict src, size_t n)
474*a939078aSHiroo HAYASHI                   _GL_ARG_NONNULL ((1, 2)));
475*a939078aSHiroo HAYASHI _GL_CXXALIAS_RPL (strncat, char *,
476*a939078aSHiroo HAYASHI                   (char *restrict dest, const char *restrict src, size_t n));
477*a939078aSHiroo HAYASHI # else
478*a939078aSHiroo HAYASHI _GL_CXXALIAS_SYS (strncat, char *,
479*a939078aSHiroo HAYASHI                   (char *restrict dest, const char *restrict src, size_t n));
480*a939078aSHiroo HAYASHI # endif
481*a939078aSHiroo HAYASHI # if __GLIBC__ >= 2
482*a939078aSHiroo HAYASHI _GL_CXXALIASWARN (strncat);
483*a939078aSHiroo HAYASHI # endif
484*a939078aSHiroo HAYASHI #elif defined GNULIB_POSIXCHECK
485*a939078aSHiroo HAYASHI # undef strncat
486*a939078aSHiroo HAYASHI # if HAVE_RAW_DECL_STRNCAT
487*a939078aSHiroo HAYASHI _GL_WARN_ON_USE (strncat, "strncat is unportable - "
488*a939078aSHiroo HAYASHI                  "use gnulib module strncat for portability");
489*a939078aSHiroo HAYASHI # endif
490*a939078aSHiroo HAYASHI #endif
491*a939078aSHiroo HAYASHI 
492*a939078aSHiroo HAYASHI /* Return a newly allocated copy of at most N bytes of STRING.  */
493*a939078aSHiroo HAYASHI #if @GNULIB_STRNDUP@
494*a939078aSHiroo HAYASHI # if @REPLACE_STRNDUP@
495*a939078aSHiroo HAYASHI #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
496*a939078aSHiroo HAYASHI #   undef strndup
497*a939078aSHiroo HAYASHI #   define strndup rpl_strndup
498*a939078aSHiroo HAYASHI #  endif
499*a939078aSHiroo HAYASHI _GL_FUNCDECL_RPL (strndup, char *, (char const *__s, size_t __n)
500*a939078aSHiroo HAYASHI                                    _GL_ARG_NONNULL ((1)));
501*a939078aSHiroo HAYASHI _GL_CXXALIAS_RPL (strndup, char *, (char const *__s, size_t __n));
502*a939078aSHiroo HAYASHI # else
503*a939078aSHiroo HAYASHI #  if ! @HAVE_DECL_STRNDUP@
504*a939078aSHiroo HAYASHI _GL_FUNCDECL_SYS (strndup, char *, (char const *__s, size_t __n)
505*a939078aSHiroo HAYASHI                                    _GL_ARG_NONNULL ((1)));
506*a939078aSHiroo HAYASHI #  endif
507*a939078aSHiroo HAYASHI _GL_CXXALIAS_SYS (strndup, char *, (char const *__s, size_t __n));
508*a939078aSHiroo HAYASHI # endif
509*a939078aSHiroo HAYASHI _GL_CXXALIASWARN (strndup);
510*a939078aSHiroo HAYASHI #elif defined GNULIB_POSIXCHECK
511*a939078aSHiroo HAYASHI # undef strndup
512*a939078aSHiroo HAYASHI # if HAVE_RAW_DECL_STRNDUP
513*a939078aSHiroo HAYASHI _GL_WARN_ON_USE (strndup, "strndup is unportable - "
514*a939078aSHiroo HAYASHI                  "use gnulib module strndup for portability");
515*a939078aSHiroo HAYASHI # endif
516*a939078aSHiroo HAYASHI #endif
517*a939078aSHiroo HAYASHI 
518*a939078aSHiroo HAYASHI /* Find the length (number of bytes) of STRING, but scan at most
519*a939078aSHiroo HAYASHI    MAXLEN bytes.  If no '\0' terminator is found in that many bytes,
520*a939078aSHiroo HAYASHI    return MAXLEN.  */
521*a939078aSHiroo HAYASHI #if @GNULIB_STRNLEN@
522*a939078aSHiroo HAYASHI # if @REPLACE_STRNLEN@
523*a939078aSHiroo HAYASHI #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
524*a939078aSHiroo HAYASHI #   undef strnlen
525*a939078aSHiroo HAYASHI #   define strnlen rpl_strnlen
526*a939078aSHiroo HAYASHI #  endif
527*a939078aSHiroo HAYASHI _GL_FUNCDECL_RPL (strnlen, size_t, (char const *__s, size_t __maxlen)
528*a939078aSHiroo HAYASHI                                    _GL_ATTRIBUTE_PURE
529*a939078aSHiroo HAYASHI                                    _GL_ARG_NONNULL ((1)));
530*a939078aSHiroo HAYASHI _GL_CXXALIAS_RPL (strnlen, size_t, (char const *__s, size_t __maxlen));
531*a939078aSHiroo HAYASHI # else
532*a939078aSHiroo HAYASHI #  if ! @HAVE_DECL_STRNLEN@
533*a939078aSHiroo HAYASHI _GL_FUNCDECL_SYS (strnlen, size_t, (char const *__s, size_t __maxlen)
534*a939078aSHiroo HAYASHI                                    _GL_ATTRIBUTE_PURE
535*a939078aSHiroo HAYASHI                                    _GL_ARG_NONNULL ((1)));
536*a939078aSHiroo HAYASHI #  endif
537*a939078aSHiroo HAYASHI _GL_CXXALIAS_SYS (strnlen, size_t, (char const *__s, size_t __maxlen));
538*a939078aSHiroo HAYASHI # endif
539*a939078aSHiroo HAYASHI _GL_CXXALIASWARN (strnlen);
540*a939078aSHiroo HAYASHI #elif defined GNULIB_POSIXCHECK
541*a939078aSHiroo HAYASHI # undef strnlen
542*a939078aSHiroo HAYASHI # if HAVE_RAW_DECL_STRNLEN
543*a939078aSHiroo HAYASHI _GL_WARN_ON_USE (strnlen, "strnlen is unportable - "
544*a939078aSHiroo HAYASHI                  "use gnulib module strnlen for portability");
545*a939078aSHiroo HAYASHI # endif
546*a939078aSHiroo HAYASHI #endif
547*a939078aSHiroo HAYASHI 
548*a939078aSHiroo HAYASHI #if defined GNULIB_POSIXCHECK
549*a939078aSHiroo HAYASHI /* strcspn() assumes the second argument is a list of single-byte characters.
550*a939078aSHiroo HAYASHI    Even in this simple case, it does not work with multibyte strings if the
551*a939078aSHiroo HAYASHI    locale encoding is GB18030 and one of the characters to be searched is a
552*a939078aSHiroo HAYASHI    digit.  */
553*a939078aSHiroo HAYASHI # undef strcspn
554*a939078aSHiroo HAYASHI /* Assume strcspn is always declared.  */
555*a939078aSHiroo HAYASHI _GL_WARN_ON_USE (strcspn, "strcspn cannot work correctly on character strings "
556*a939078aSHiroo HAYASHI                  "in multibyte locales - "
557*a939078aSHiroo HAYASHI                  "use mbscspn if you care about internationalization");
558*a939078aSHiroo HAYASHI #endif
559*a939078aSHiroo HAYASHI 
560*a939078aSHiroo HAYASHI /* Find the first occurrence in S of any character in ACCEPT.  */
561*a939078aSHiroo HAYASHI #if @GNULIB_STRPBRK@
562*a939078aSHiroo HAYASHI # if ! @HAVE_STRPBRK@
563*a939078aSHiroo HAYASHI _GL_FUNCDECL_SYS (strpbrk, char *, (char const *__s, char const *__accept)
564*a939078aSHiroo HAYASHI                                    _GL_ATTRIBUTE_PURE
565*a939078aSHiroo HAYASHI                                    _GL_ARG_NONNULL ((1, 2)));
566*a939078aSHiroo HAYASHI # endif
567*a939078aSHiroo HAYASHI   /* On some systems, this function is defined as an overloaded function:
568*a939078aSHiroo HAYASHI        extern "C" { const char * strpbrk (const char *, const char *); }
569*a939078aSHiroo HAYASHI        extern "C++" { char * strpbrk (char *, const char *); }  */
570*a939078aSHiroo HAYASHI _GL_CXXALIAS_SYS_CAST2 (strpbrk,
571*a939078aSHiroo HAYASHI                         char *, (char const *__s, char const *__accept),
572*a939078aSHiroo HAYASHI                         const char *, (char const *__s, char const *__accept));
573*a939078aSHiroo HAYASHI # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
574*a939078aSHiroo HAYASHI      && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
575*a939078aSHiroo HAYASHI _GL_CXXALIASWARN1 (strpbrk, char *, (char *__s, char const *__accept));
576*a939078aSHiroo HAYASHI _GL_CXXALIASWARN1 (strpbrk, char const *,
577*a939078aSHiroo HAYASHI                    (char const *__s, char const *__accept));
578*a939078aSHiroo HAYASHI # elif __GLIBC__ >= 2
579*a939078aSHiroo HAYASHI _GL_CXXALIASWARN (strpbrk);
580*a939078aSHiroo HAYASHI # endif
581*a939078aSHiroo HAYASHI # if defined GNULIB_POSIXCHECK
582*a939078aSHiroo HAYASHI /* strpbrk() assumes the second argument is a list of single-byte characters.
583*a939078aSHiroo HAYASHI    Even in this simple case, it does not work with multibyte strings if the
584*a939078aSHiroo HAYASHI    locale encoding is GB18030 and one of the characters to be searched is a
585*a939078aSHiroo HAYASHI    digit.  */
586*a939078aSHiroo HAYASHI #  undef strpbrk
587*a939078aSHiroo HAYASHI _GL_WARN_ON_USE_CXX (strpbrk,
588*a939078aSHiroo HAYASHI                      const char *, char *, (const char *, const char *),
589*a939078aSHiroo HAYASHI                      "strpbrk cannot work correctly on character strings "
590*a939078aSHiroo HAYASHI                      "in multibyte locales - "
591*a939078aSHiroo HAYASHI                      "use mbspbrk if you care about internationalization");
592*a939078aSHiroo HAYASHI # endif
593*a939078aSHiroo HAYASHI #elif defined GNULIB_POSIXCHECK
594*a939078aSHiroo HAYASHI # undef strpbrk
595*a939078aSHiroo HAYASHI # if HAVE_RAW_DECL_STRPBRK
596*a939078aSHiroo HAYASHI _GL_WARN_ON_USE_CXX (strpbrk,
597*a939078aSHiroo HAYASHI                      const char *, char *, (const char *, const char *),
598*a939078aSHiroo HAYASHI                      "strpbrk is unportable - "
599*a939078aSHiroo HAYASHI                      "use gnulib module strpbrk for portability");
600*a939078aSHiroo HAYASHI # endif
601*a939078aSHiroo HAYASHI #endif
602*a939078aSHiroo HAYASHI 
603*a939078aSHiroo HAYASHI #if defined GNULIB_POSIXCHECK
604*a939078aSHiroo HAYASHI /* strspn() assumes the second argument is a list of single-byte characters.
605*a939078aSHiroo HAYASHI    Even in this simple case, it cannot work with multibyte strings.  */
606*a939078aSHiroo HAYASHI # undef strspn
607*a939078aSHiroo HAYASHI /* Assume strspn is always declared.  */
608*a939078aSHiroo HAYASHI _GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings "
609*a939078aSHiroo HAYASHI                  "in multibyte locales - "
610*a939078aSHiroo HAYASHI                  "use mbsspn if you care about internationalization");
611*a939078aSHiroo HAYASHI #endif
612*a939078aSHiroo HAYASHI 
613*a939078aSHiroo HAYASHI #if defined GNULIB_POSIXCHECK
614*a939078aSHiroo HAYASHI /* strrchr() does not work with multibyte strings if the locale encoding is
615*a939078aSHiroo HAYASHI    GB18030 and the character to be searched is a digit.  */
616*a939078aSHiroo HAYASHI # undef strrchr
617*a939078aSHiroo HAYASHI /* Assume strrchr is always declared.  */
618*a939078aSHiroo HAYASHI _GL_WARN_ON_USE_CXX (strrchr,
619*a939078aSHiroo HAYASHI                      const char *, char *, (const char *, int),
620*a939078aSHiroo HAYASHI                      "strrchr cannot work correctly on character strings "
621*a939078aSHiroo HAYASHI                      "in some multibyte locales - "
622*a939078aSHiroo HAYASHI                      "use mbsrchr if you care about internationalization");
623*a939078aSHiroo HAYASHI #endif
624*a939078aSHiroo HAYASHI 
625*a939078aSHiroo HAYASHI /* Search the next delimiter (char listed in DELIM) starting at *STRINGP.
626*a939078aSHiroo HAYASHI    If one is found, overwrite it with a NUL, and advance *STRINGP
627*a939078aSHiroo HAYASHI    to point to the next char after it.  Otherwise, set *STRINGP to NULL.
628*a939078aSHiroo HAYASHI    If *STRINGP was already NULL, nothing happens.
629*a939078aSHiroo HAYASHI    Return the old value of *STRINGP.
630*a939078aSHiroo HAYASHI 
631*a939078aSHiroo HAYASHI    This is a variant of strtok() that is multithread-safe and supports
632*a939078aSHiroo HAYASHI    empty fields.
633*a939078aSHiroo HAYASHI 
634*a939078aSHiroo HAYASHI    Caveat: It modifies the original string.
635*a939078aSHiroo HAYASHI    Caveat: These functions cannot be used on constant strings.
636*a939078aSHiroo HAYASHI    Caveat: The identity of the delimiting character is lost.
637*a939078aSHiroo HAYASHI    Caveat: It doesn't work with multibyte strings unless all of the delimiter
638*a939078aSHiroo HAYASHI            characters are ASCII characters < 0x30.
639*a939078aSHiroo HAYASHI 
640*a939078aSHiroo HAYASHI    See also strtok_r().  */
641*a939078aSHiroo HAYASHI #if @GNULIB_STRSEP@
642*a939078aSHiroo HAYASHI # if ! @HAVE_STRSEP@
643*a939078aSHiroo HAYASHI _GL_FUNCDECL_SYS (strsep, char *,
644*a939078aSHiroo HAYASHI                   (char **restrict __stringp, char const *restrict __delim)
645*a939078aSHiroo HAYASHI                   _GL_ARG_NONNULL ((1, 2)));
646*a939078aSHiroo HAYASHI # endif
647*a939078aSHiroo HAYASHI _GL_CXXALIAS_SYS (strsep, char *,
648*a939078aSHiroo HAYASHI                   (char **restrict __stringp, char const *restrict __delim));
649*a939078aSHiroo HAYASHI _GL_CXXALIASWARN (strsep);
650*a939078aSHiroo HAYASHI # if defined GNULIB_POSIXCHECK
651*a939078aSHiroo HAYASHI #  undef strsep
652*a939078aSHiroo HAYASHI _GL_WARN_ON_USE (strsep, "strsep cannot work correctly on character strings "
653*a939078aSHiroo HAYASHI                  "in multibyte locales - "
654*a939078aSHiroo HAYASHI                  "use mbssep if you care about internationalization");
655*a939078aSHiroo HAYASHI # endif
656*a939078aSHiroo HAYASHI #elif defined GNULIB_POSIXCHECK
657*a939078aSHiroo HAYASHI # undef strsep
658*a939078aSHiroo HAYASHI # if HAVE_RAW_DECL_STRSEP
659*a939078aSHiroo HAYASHI _GL_WARN_ON_USE (strsep, "strsep is unportable - "
660*a939078aSHiroo HAYASHI                  "use gnulib module strsep for portability");
661*a939078aSHiroo HAYASHI # endif
662*a939078aSHiroo HAYASHI #endif
663*a939078aSHiroo HAYASHI 
664*a939078aSHiroo HAYASHI #if @GNULIB_STRSTR@
665*a939078aSHiroo HAYASHI # if @REPLACE_STRSTR@
666*a939078aSHiroo HAYASHI #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
667*a939078aSHiroo HAYASHI #   define strstr rpl_strstr
668*a939078aSHiroo HAYASHI #  endif
669*a939078aSHiroo HAYASHI _GL_FUNCDECL_RPL (strstr, char *, (const char *haystack, const char *needle)
670*a939078aSHiroo HAYASHI                                   _GL_ATTRIBUTE_PURE
671*a939078aSHiroo HAYASHI                                   _GL_ARG_NONNULL ((1, 2)));
672*a939078aSHiroo HAYASHI _GL_CXXALIAS_RPL (strstr, char *, (const char *haystack, const char *needle));
673*a939078aSHiroo HAYASHI # else
674*a939078aSHiroo HAYASHI   /* On some systems, this function is defined as an overloaded function:
675*a939078aSHiroo HAYASHI        extern "C++" { const char * strstr (const char *, const char *); }
676*a939078aSHiroo HAYASHI        extern "C++" { char * strstr (char *, const char *); }  */
677*a939078aSHiroo HAYASHI _GL_CXXALIAS_SYS_CAST2 (strstr,
678*a939078aSHiroo HAYASHI                         char *, (const char *haystack, const char *needle),
679*a939078aSHiroo HAYASHI                         const char *, (const char *haystack, const char *needle));
680*a939078aSHiroo HAYASHI # endif
681*a939078aSHiroo HAYASHI # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
682*a939078aSHiroo HAYASHI      && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
683*a939078aSHiroo HAYASHI _GL_CXXALIASWARN1 (strstr, char *, (char *haystack, const char *needle));
684*a939078aSHiroo HAYASHI _GL_CXXALIASWARN1 (strstr, const char *,
685*a939078aSHiroo HAYASHI                    (const char *haystack, const char *needle));
686*a939078aSHiroo HAYASHI # elif __GLIBC__ >= 2
687*a939078aSHiroo HAYASHI _GL_CXXALIASWARN (strstr);
688*a939078aSHiroo HAYASHI # endif
689*a939078aSHiroo HAYASHI #elif defined GNULIB_POSIXCHECK
690*a939078aSHiroo HAYASHI /* strstr() does not work with multibyte strings if the locale encoding is
691*a939078aSHiroo HAYASHI    different from UTF-8:
692*a939078aSHiroo HAYASHI    POSIX says that it operates on "strings", and "string" in POSIX is defined
693*a939078aSHiroo HAYASHI    as a sequence of bytes, not of characters.  */
694*a939078aSHiroo HAYASHI # undef strstr
695*a939078aSHiroo HAYASHI /* Assume strstr is always declared.  */
696*a939078aSHiroo HAYASHI _GL_WARN_ON_USE (strstr, "strstr is quadratic on many systems, and cannot "
697*a939078aSHiroo HAYASHI                  "work correctly on character strings in most "
698*a939078aSHiroo HAYASHI                  "multibyte locales - "
699*a939078aSHiroo HAYASHI                  "use mbsstr if you care about internationalization, "
700*a939078aSHiroo HAYASHI                  "or use strstr if you care about speed");
701*a939078aSHiroo HAYASHI #endif
702*a939078aSHiroo HAYASHI 
703*a939078aSHiroo HAYASHI /* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive
704*a939078aSHiroo HAYASHI    comparison.  */
705*a939078aSHiroo HAYASHI #if @GNULIB_STRCASESTR@
706*a939078aSHiroo HAYASHI # if @REPLACE_STRCASESTR@
707*a939078aSHiroo HAYASHI #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
708*a939078aSHiroo HAYASHI #   define strcasestr rpl_strcasestr
709*a939078aSHiroo HAYASHI #  endif
710*a939078aSHiroo HAYASHI _GL_FUNCDECL_RPL (strcasestr, char *,
711*a939078aSHiroo HAYASHI                   (const char *haystack, const char *needle)
712*a939078aSHiroo HAYASHI                   _GL_ATTRIBUTE_PURE
713*a939078aSHiroo HAYASHI                   _GL_ARG_NONNULL ((1, 2)));
714*a939078aSHiroo HAYASHI _GL_CXXALIAS_RPL (strcasestr, char *,
715*a939078aSHiroo HAYASHI                   (const char *haystack, const char *needle));
716*a939078aSHiroo HAYASHI # else
717*a939078aSHiroo HAYASHI #  if ! @HAVE_STRCASESTR@
718*a939078aSHiroo HAYASHI _GL_FUNCDECL_SYS (strcasestr, char *,
719*a939078aSHiroo HAYASHI                   (const char *haystack, const char *needle)
720*a939078aSHiroo HAYASHI                   _GL_ATTRIBUTE_PURE
721*a939078aSHiroo HAYASHI                   _GL_ARG_NONNULL ((1, 2)));
722*a939078aSHiroo HAYASHI #  endif
723*a939078aSHiroo HAYASHI   /* On some systems, this function is defined as an overloaded function:
724*a939078aSHiroo HAYASHI        extern "C++" { const char * strcasestr (const char *, const char *); }
725*a939078aSHiroo HAYASHI        extern "C++" { char * strcasestr (char *, const char *); }  */
726*a939078aSHiroo HAYASHI _GL_CXXALIAS_SYS_CAST2 (strcasestr,
727*a939078aSHiroo HAYASHI                         char *, (const char *haystack, const char *needle),
728*a939078aSHiroo HAYASHI                         const char *, (const char *haystack, const char *needle));
729*a939078aSHiroo HAYASHI # endif
730*a939078aSHiroo HAYASHI # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
731*a939078aSHiroo HAYASHI      && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
732*a939078aSHiroo HAYASHI _GL_CXXALIASWARN1 (strcasestr, char *, (char *haystack, const char *needle));
733*a939078aSHiroo HAYASHI _GL_CXXALIASWARN1 (strcasestr, const char *,
734*a939078aSHiroo HAYASHI                    (const char *haystack, const char *needle));
735*a939078aSHiroo HAYASHI # else
736*a939078aSHiroo HAYASHI _GL_CXXALIASWARN (strcasestr);
737*a939078aSHiroo HAYASHI # endif
738*a939078aSHiroo HAYASHI #elif defined GNULIB_POSIXCHECK
739*a939078aSHiroo HAYASHI /* strcasestr() does not work with multibyte strings:
740*a939078aSHiroo HAYASHI    It is a glibc extension, and glibc implements it only for unibyte
741*a939078aSHiroo HAYASHI    locales.  */
742*a939078aSHiroo HAYASHI # undef strcasestr
743*a939078aSHiroo HAYASHI # if HAVE_RAW_DECL_STRCASESTR
744*a939078aSHiroo HAYASHI _GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character "
745*a939078aSHiroo HAYASHI                  "strings in multibyte locales - "
746*a939078aSHiroo HAYASHI                  "use mbscasestr if you care about "
747*a939078aSHiroo HAYASHI                  "internationalization, or use c-strcasestr if you want "
748*a939078aSHiroo HAYASHI                  "a locale independent function");
749*a939078aSHiroo HAYASHI # endif
750*a939078aSHiroo HAYASHI #endif
751*a939078aSHiroo HAYASHI 
752*a939078aSHiroo HAYASHI /* Parse S into tokens separated by characters in DELIM.
753*a939078aSHiroo HAYASHI    If S is NULL, the saved pointer in SAVE_PTR is used as
754*a939078aSHiroo HAYASHI    the next starting point.  For example:
755*a939078aSHiroo HAYASHI         char s[] = "-abc-=-def";
756*a939078aSHiroo HAYASHI         char *sp;
757*a939078aSHiroo HAYASHI         x = strtok_r(s, "-", &sp);      // x = "abc", sp = "=-def"
758*a939078aSHiroo HAYASHI         x = strtok_r(NULL, "-=", &sp);  // x = "def", sp = NULL
759*a939078aSHiroo HAYASHI         x = strtok_r(NULL, "=", &sp);   // x = NULL
760*a939078aSHiroo HAYASHI                 // s = "abc\0-def\0"
761*a939078aSHiroo HAYASHI 
762*a939078aSHiroo HAYASHI    This is a variant of strtok() that is multithread-safe.
763*a939078aSHiroo HAYASHI 
764*a939078aSHiroo HAYASHI    For the POSIX documentation for this function, see:
765*a939078aSHiroo HAYASHI    https://pubs.opengroup.org/onlinepubs/9699919799/functions/strtok.html
766*a939078aSHiroo HAYASHI 
767*a939078aSHiroo HAYASHI    Caveat: It modifies the original string.
768*a939078aSHiroo HAYASHI    Caveat: These functions cannot be used on constant strings.
769*a939078aSHiroo HAYASHI    Caveat: The identity of the delimiting character is lost.
770*a939078aSHiroo HAYASHI    Caveat: It doesn't work with multibyte strings unless all of the delimiter
771*a939078aSHiroo HAYASHI            characters are ASCII characters < 0x30.
772*a939078aSHiroo HAYASHI 
773*a939078aSHiroo HAYASHI    See also strsep().  */
774*a939078aSHiroo HAYASHI #if @GNULIB_STRTOK_R@
775*a939078aSHiroo HAYASHI # if @REPLACE_STRTOK_R@
776*a939078aSHiroo HAYASHI #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
777*a939078aSHiroo HAYASHI #   undef strtok_r
778*a939078aSHiroo HAYASHI #   define strtok_r rpl_strtok_r
779*a939078aSHiroo HAYASHI #  endif
780*a939078aSHiroo HAYASHI _GL_FUNCDECL_RPL (strtok_r, char *,
781*a939078aSHiroo HAYASHI                   (char *restrict s, char const *restrict delim,
782*a939078aSHiroo HAYASHI                    char **restrict save_ptr)
783*a939078aSHiroo HAYASHI                   _GL_ARG_NONNULL ((2, 3)));
784*a939078aSHiroo HAYASHI _GL_CXXALIAS_RPL (strtok_r, char *,
785*a939078aSHiroo HAYASHI                   (char *restrict s, char const *restrict delim,
786*a939078aSHiroo HAYASHI                    char **restrict save_ptr));
787*a939078aSHiroo HAYASHI # else
788*a939078aSHiroo HAYASHI #  if @UNDEFINE_STRTOK_R@ || defined GNULIB_POSIXCHECK
789*a939078aSHiroo HAYASHI #   undef strtok_r
790*a939078aSHiroo HAYASHI #  endif
791*a939078aSHiroo HAYASHI #  if ! @HAVE_DECL_STRTOK_R@
792*a939078aSHiroo HAYASHI _GL_FUNCDECL_SYS (strtok_r, char *,
793*a939078aSHiroo HAYASHI                   (char *restrict s, char const *restrict delim,
794*a939078aSHiroo HAYASHI                    char **restrict save_ptr)
795*a939078aSHiroo HAYASHI                   _GL_ARG_NONNULL ((2, 3)));
796*a939078aSHiroo HAYASHI #  endif
797*a939078aSHiroo HAYASHI _GL_CXXALIAS_SYS (strtok_r, char *,
798*a939078aSHiroo HAYASHI                   (char *restrict s, char const *restrict delim,
799*a939078aSHiroo HAYASHI                    char **restrict save_ptr));
800*a939078aSHiroo HAYASHI # endif
801*a939078aSHiroo HAYASHI _GL_CXXALIASWARN (strtok_r);
802*a939078aSHiroo HAYASHI # if defined GNULIB_POSIXCHECK
803*a939078aSHiroo HAYASHI _GL_WARN_ON_USE (strtok_r, "strtok_r cannot work correctly on character "
804*a939078aSHiroo HAYASHI                  "strings in multibyte locales - "
805*a939078aSHiroo HAYASHI                  "use mbstok_r if you care about internationalization");
806*a939078aSHiroo HAYASHI # endif
807*a939078aSHiroo HAYASHI #elif defined GNULIB_POSIXCHECK
808*a939078aSHiroo HAYASHI # undef strtok_r
809*a939078aSHiroo HAYASHI # if HAVE_RAW_DECL_STRTOK_R
810*a939078aSHiroo HAYASHI _GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - "
811*a939078aSHiroo HAYASHI                  "use gnulib module strtok_r for portability");
812*a939078aSHiroo HAYASHI # endif
813*a939078aSHiroo HAYASHI #endif
814*a939078aSHiroo HAYASHI 
815*a939078aSHiroo HAYASHI 
816*a939078aSHiroo HAYASHI /* The following functions are not specified by POSIX.  They are gnulib
817*a939078aSHiroo HAYASHI    extensions.  */
818*a939078aSHiroo HAYASHI 
819*a939078aSHiroo HAYASHI #if @GNULIB_MBSLEN@
820*a939078aSHiroo HAYASHI /* Return the number of multibyte characters in the character string STRING.
821*a939078aSHiroo HAYASHI    This considers multibyte characters, unlike strlen, which counts bytes.  */
822*a939078aSHiroo HAYASHI # ifdef __MirBSD__  /* MirBSD defines mbslen as a macro.  Override it.  */
823*a939078aSHiroo HAYASHI #  undef mbslen
824*a939078aSHiroo HAYASHI # endif
825*a939078aSHiroo HAYASHI # if @HAVE_MBSLEN@  /* AIX, OSF/1, MirBSD define mbslen already in libc.  */
826*a939078aSHiroo HAYASHI #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
827*a939078aSHiroo HAYASHI #   define mbslen rpl_mbslen
828*a939078aSHiroo HAYASHI #  endif
829*a939078aSHiroo HAYASHI _GL_FUNCDECL_RPL (mbslen, size_t, (const char *string)
830*a939078aSHiroo HAYASHI                                   _GL_ATTRIBUTE_PURE
831*a939078aSHiroo HAYASHI                                   _GL_ARG_NONNULL ((1)));
832*a939078aSHiroo HAYASHI _GL_CXXALIAS_RPL (mbslen, size_t, (const char *string));
833*a939078aSHiroo HAYASHI # else
834*a939078aSHiroo HAYASHI _GL_FUNCDECL_SYS (mbslen, size_t, (const char *string)
835*a939078aSHiroo HAYASHI                                   _GL_ATTRIBUTE_PURE
836*a939078aSHiroo HAYASHI                                   _GL_ARG_NONNULL ((1)));
837*a939078aSHiroo HAYASHI _GL_CXXALIAS_SYS (mbslen, size_t, (const char *string));
838*a939078aSHiroo HAYASHI # endif
839*a939078aSHiroo HAYASHI _GL_CXXALIASWARN (mbslen);
840*a939078aSHiroo HAYASHI #endif
841*a939078aSHiroo HAYASHI 
842*a939078aSHiroo HAYASHI #if @GNULIB_MBSNLEN@
843*a939078aSHiroo HAYASHI /* Return the number of multibyte characters in the character string starting
844*a939078aSHiroo HAYASHI    at STRING and ending at STRING + LEN.  */
845*a939078aSHiroo HAYASHI _GL_EXTERN_C size_t mbsnlen (const char *string, size_t len)
846*a939078aSHiroo HAYASHI      _GL_ATTRIBUTE_PURE
847*a939078aSHiroo HAYASHI      _GL_ARG_NONNULL ((1));
848*a939078aSHiroo HAYASHI #endif
849*a939078aSHiroo HAYASHI 
850*a939078aSHiroo HAYASHI #if @GNULIB_MBSCHR@
851*a939078aSHiroo HAYASHI /* Locate the first single-byte character C in the character string STRING,
852*a939078aSHiroo HAYASHI    and return a pointer to it.  Return NULL if C is not found in STRING.
853*a939078aSHiroo HAYASHI    Unlike strchr(), this function works correctly in multibyte locales with
854*a939078aSHiroo HAYASHI    encodings such as GB18030.  */
855*a939078aSHiroo HAYASHI # if defined __hpux
856*a939078aSHiroo HAYASHI #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
857*a939078aSHiroo HAYASHI #   define mbschr rpl_mbschr /* avoid collision with HP-UX function */
858*a939078aSHiroo HAYASHI #  endif
859*a939078aSHiroo HAYASHI _GL_FUNCDECL_RPL (mbschr, char *, (const char *string, int c)
860*a939078aSHiroo HAYASHI                                   _GL_ATTRIBUTE_PURE
861*a939078aSHiroo HAYASHI                                   _GL_ARG_NONNULL ((1)));
862*a939078aSHiroo HAYASHI _GL_CXXALIAS_RPL (mbschr, char *, (const char *string, int c));
863*a939078aSHiroo HAYASHI # else
864*a939078aSHiroo HAYASHI _GL_FUNCDECL_SYS (mbschr, char *, (const char *string, int c)
865*a939078aSHiroo HAYASHI                                   _GL_ATTRIBUTE_PURE
866*a939078aSHiroo HAYASHI                                   _GL_ARG_NONNULL ((1)));
867*a939078aSHiroo HAYASHI _GL_CXXALIAS_SYS (mbschr, char *, (const char *string, int c));
868*a939078aSHiroo HAYASHI # endif
869*a939078aSHiroo HAYASHI _GL_CXXALIASWARN (mbschr);
870*a939078aSHiroo HAYASHI #endif
871*a939078aSHiroo HAYASHI 
872*a939078aSHiroo HAYASHI #if @GNULIB_MBSRCHR@
873*a939078aSHiroo HAYASHI /* Locate the last single-byte character C in the character string STRING,
874*a939078aSHiroo HAYASHI    and return a pointer to it.  Return NULL if C is not found in STRING.
875*a939078aSHiroo HAYASHI    Unlike strrchr(), this function works correctly in multibyte locales with
876*a939078aSHiroo HAYASHI    encodings such as GB18030.  */
877*a939078aSHiroo HAYASHI # if defined __hpux || defined __INTERIX
878*a939078aSHiroo HAYASHI #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
879*a939078aSHiroo HAYASHI #   define mbsrchr rpl_mbsrchr /* avoid collision with system function */
880*a939078aSHiroo HAYASHI #  endif
881*a939078aSHiroo HAYASHI _GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c)
882*a939078aSHiroo HAYASHI                                    _GL_ATTRIBUTE_PURE
883*a939078aSHiroo HAYASHI                                    _GL_ARG_NONNULL ((1)));
884*a939078aSHiroo HAYASHI _GL_CXXALIAS_RPL (mbsrchr, char *, (const char *string, int c));
885*a939078aSHiroo HAYASHI # else
886*a939078aSHiroo HAYASHI _GL_FUNCDECL_SYS (mbsrchr, char *, (const char *string, int c)
887*a939078aSHiroo HAYASHI                                    _GL_ATTRIBUTE_PURE
888*a939078aSHiroo HAYASHI                                    _GL_ARG_NONNULL ((1)));
889*a939078aSHiroo HAYASHI _GL_CXXALIAS_SYS (mbsrchr, char *, (const char *string, int c));
890*a939078aSHiroo HAYASHI # endif
891*a939078aSHiroo HAYASHI _GL_CXXALIASWARN (mbsrchr);
892*a939078aSHiroo HAYASHI #endif
893*a939078aSHiroo HAYASHI 
894*a939078aSHiroo HAYASHI #if @GNULIB_MBSSTR@
895*a939078aSHiroo HAYASHI /* Find the first occurrence of the character string NEEDLE in the character
896*a939078aSHiroo HAYASHI    string HAYSTACK.  Return NULL if NEEDLE is not found in HAYSTACK.
897*a939078aSHiroo HAYASHI    Unlike strstr(), this function works correctly in multibyte locales with
898*a939078aSHiroo HAYASHI    encodings different from UTF-8.  */
899*a939078aSHiroo HAYASHI _GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle)
900*a939078aSHiroo HAYASHI      _GL_ATTRIBUTE_PURE
901*a939078aSHiroo HAYASHI      _GL_ARG_NONNULL ((1, 2));
902*a939078aSHiroo HAYASHI #endif
903*a939078aSHiroo HAYASHI 
904*a939078aSHiroo HAYASHI #if @GNULIB_MBSCASECMP@
905*a939078aSHiroo HAYASHI /* Compare the character strings S1 and S2, ignoring case, returning less than,
906*a939078aSHiroo HAYASHI    equal to or greater than zero if S1 is lexicographically less than, equal to
907*a939078aSHiroo HAYASHI    or greater than S2.
908*a939078aSHiroo HAYASHI    Note: This function may, in multibyte locales, return 0 for strings of
909*a939078aSHiroo HAYASHI    different lengths!
910*a939078aSHiroo HAYASHI    Unlike strcasecmp(), this function works correctly in multibyte locales.  */
911*a939078aSHiroo HAYASHI _GL_EXTERN_C int mbscasecmp (const char *s1, const char *s2)
912*a939078aSHiroo HAYASHI      _GL_ATTRIBUTE_PURE
913*a939078aSHiroo HAYASHI      _GL_ARG_NONNULL ((1, 2));
914*a939078aSHiroo HAYASHI #endif
915*a939078aSHiroo HAYASHI 
916*a939078aSHiroo HAYASHI #if @GNULIB_MBSNCASECMP@
917*a939078aSHiroo HAYASHI /* Compare the initial segment of the character string S1 consisting of at most
918*a939078aSHiroo HAYASHI    N characters with the initial segment of the character string S2 consisting
919*a939078aSHiroo HAYASHI    of at most N characters, ignoring case, returning less than, equal to or
920*a939078aSHiroo HAYASHI    greater than zero if the initial segment of S1 is lexicographically less
921*a939078aSHiroo HAYASHI    than, equal to or greater than the initial segment of S2.
922*a939078aSHiroo HAYASHI    Note: This function may, in multibyte locales, return 0 for initial segments
923*a939078aSHiroo HAYASHI    of different lengths!
924*a939078aSHiroo HAYASHI    Unlike strncasecmp(), this function works correctly in multibyte locales.
925*a939078aSHiroo HAYASHI    But beware that N is not a byte count but a character count!  */
926*a939078aSHiroo HAYASHI _GL_EXTERN_C int mbsncasecmp (const char *s1, const char *s2, size_t n)
927*a939078aSHiroo HAYASHI      _GL_ATTRIBUTE_PURE
928*a939078aSHiroo HAYASHI      _GL_ARG_NONNULL ((1, 2));
929*a939078aSHiroo HAYASHI #endif
930*a939078aSHiroo HAYASHI 
931*a939078aSHiroo HAYASHI #if @GNULIB_MBSPCASECMP@
932*a939078aSHiroo HAYASHI /* Compare the initial segment of the character string STRING consisting of
933*a939078aSHiroo HAYASHI    at most mbslen (PREFIX) characters with the character string PREFIX,
934*a939078aSHiroo HAYASHI    ignoring case.  If the two match, return a pointer to the first byte
935*a939078aSHiroo HAYASHI    after this prefix in STRING.  Otherwise, return NULL.
936*a939078aSHiroo HAYASHI    Note: This function may, in multibyte locales, return non-NULL if STRING
937*a939078aSHiroo HAYASHI    is of smaller length than PREFIX!
938*a939078aSHiroo HAYASHI    Unlike strncasecmp(), this function works correctly in multibyte
939*a939078aSHiroo HAYASHI    locales.  */
940*a939078aSHiroo HAYASHI _GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix)
941*a939078aSHiroo HAYASHI      _GL_ATTRIBUTE_PURE
942*a939078aSHiroo HAYASHI      _GL_ARG_NONNULL ((1, 2));
943*a939078aSHiroo HAYASHI #endif
944*a939078aSHiroo HAYASHI 
945*a939078aSHiroo HAYASHI #if @GNULIB_MBSCASESTR@
946*a939078aSHiroo HAYASHI /* Find the first occurrence of the character string NEEDLE in the character
947*a939078aSHiroo HAYASHI    string HAYSTACK, using case-insensitive comparison.
948*a939078aSHiroo HAYASHI    Note: This function may, in multibyte locales, return success even if
949*a939078aSHiroo HAYASHI    strlen (haystack) < strlen (needle) !
950*a939078aSHiroo HAYASHI    Unlike strcasestr(), this function works correctly in multibyte locales.  */
951*a939078aSHiroo HAYASHI _GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle)
952*a939078aSHiroo HAYASHI      _GL_ATTRIBUTE_PURE
953*a939078aSHiroo HAYASHI      _GL_ARG_NONNULL ((1, 2));
954*a939078aSHiroo HAYASHI #endif
955*a939078aSHiroo HAYASHI 
956*a939078aSHiroo HAYASHI #if @GNULIB_MBSCSPN@
957*a939078aSHiroo HAYASHI /* Find the first occurrence in the character string STRING of any character
958*a939078aSHiroo HAYASHI    in the character string ACCEPT.  Return the number of bytes from the
959*a939078aSHiroo HAYASHI    beginning of the string to this occurrence, or to the end of the string
960*a939078aSHiroo HAYASHI    if none exists.
961*a939078aSHiroo HAYASHI    Unlike strcspn(), this function works correctly in multibyte locales.  */
962*a939078aSHiroo HAYASHI _GL_EXTERN_C size_t mbscspn (const char *string, const char *accept)
963*a939078aSHiroo HAYASHI      _GL_ATTRIBUTE_PURE
964*a939078aSHiroo HAYASHI      _GL_ARG_NONNULL ((1, 2));
965*a939078aSHiroo HAYASHI #endif
966*a939078aSHiroo HAYASHI 
967*a939078aSHiroo HAYASHI #if @GNULIB_MBSPBRK@
968*a939078aSHiroo HAYASHI /* Find the first occurrence in the character string STRING of any character
969*a939078aSHiroo HAYASHI    in the character string ACCEPT.  Return the pointer to it, or NULL if none
970*a939078aSHiroo HAYASHI    exists.
971*a939078aSHiroo HAYASHI    Unlike strpbrk(), this function works correctly in multibyte locales.  */
972*a939078aSHiroo HAYASHI # if defined __hpux
973*a939078aSHiroo HAYASHI #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
974*a939078aSHiroo HAYASHI #   define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */
975*a939078aSHiroo HAYASHI #  endif
976*a939078aSHiroo HAYASHI _GL_FUNCDECL_RPL (mbspbrk, char *, (const char *string, const char *accept)
977*a939078aSHiroo HAYASHI                                    _GL_ATTRIBUTE_PURE
978*a939078aSHiroo HAYASHI                                    _GL_ARG_NONNULL ((1, 2)));
979*a939078aSHiroo HAYASHI _GL_CXXALIAS_RPL (mbspbrk, char *, (const char *string, const char *accept));
980*a939078aSHiroo HAYASHI # else
981*a939078aSHiroo HAYASHI _GL_FUNCDECL_SYS (mbspbrk, char *, (const char *string, const char *accept)
982*a939078aSHiroo HAYASHI                                    _GL_ATTRIBUTE_PURE
983*a939078aSHiroo HAYASHI                                    _GL_ARG_NONNULL ((1, 2)));
984*a939078aSHiroo HAYASHI _GL_CXXALIAS_SYS (mbspbrk, char *, (const char *string, const char *accept));
985*a939078aSHiroo HAYASHI # endif
986*a939078aSHiroo HAYASHI _GL_CXXALIASWARN (mbspbrk);
987*a939078aSHiroo HAYASHI #endif
988*a939078aSHiroo HAYASHI 
989*a939078aSHiroo HAYASHI #if @GNULIB_MBSSPN@
990*a939078aSHiroo HAYASHI /* Find the first occurrence in the character string STRING of any character
991*a939078aSHiroo HAYASHI    not in the character string REJECT.  Return the number of bytes from the
992*a939078aSHiroo HAYASHI    beginning of the string to this occurrence, or to the end of the string
993*a939078aSHiroo HAYASHI    if none exists.
994*a939078aSHiroo HAYASHI    Unlike strspn(), this function works correctly in multibyte locales.  */
995*a939078aSHiroo HAYASHI _GL_EXTERN_C size_t mbsspn (const char *string, const char *reject)
996*a939078aSHiroo HAYASHI      _GL_ATTRIBUTE_PURE
997*a939078aSHiroo HAYASHI      _GL_ARG_NONNULL ((1, 2));
998*a939078aSHiroo HAYASHI #endif
999*a939078aSHiroo HAYASHI 
1000*a939078aSHiroo HAYASHI #if @GNULIB_MBSSEP@
1001*a939078aSHiroo HAYASHI /* Search the next delimiter (multibyte character listed in the character
1002*a939078aSHiroo HAYASHI    string DELIM) starting at the character string *STRINGP.
1003*a939078aSHiroo HAYASHI    If one is found, overwrite it with a NUL, and advance *STRINGP to point
1004*a939078aSHiroo HAYASHI    to the next multibyte character after it.  Otherwise, set *STRINGP to NULL.
1005*a939078aSHiroo HAYASHI    If *STRINGP was already NULL, nothing happens.
1006*a939078aSHiroo HAYASHI    Return the old value of *STRINGP.
1007*a939078aSHiroo HAYASHI 
1008*a939078aSHiroo HAYASHI    This is a variant of mbstok_r() that supports empty fields.
1009*a939078aSHiroo HAYASHI 
1010*a939078aSHiroo HAYASHI    Caveat: It modifies the original string.
1011*a939078aSHiroo HAYASHI    Caveat: These functions cannot be used on constant strings.
1012*a939078aSHiroo HAYASHI    Caveat: The identity of the delimiting character is lost.
1013*a939078aSHiroo HAYASHI 
1014*a939078aSHiroo HAYASHI    See also mbstok_r().  */
1015*a939078aSHiroo HAYASHI _GL_EXTERN_C char * mbssep (char **stringp, const char *delim)
1016*a939078aSHiroo HAYASHI      _GL_ARG_NONNULL ((1, 2));
1017*a939078aSHiroo HAYASHI #endif
1018*a939078aSHiroo HAYASHI 
1019*a939078aSHiroo HAYASHI #if @GNULIB_MBSTOK_R@
1020*a939078aSHiroo HAYASHI /* Parse the character string STRING into tokens separated by characters in
1021*a939078aSHiroo HAYASHI    the character string DELIM.
1022*a939078aSHiroo HAYASHI    If STRING is NULL, the saved pointer in SAVE_PTR is used as
1023*a939078aSHiroo HAYASHI    the next starting point.  For example:
1024*a939078aSHiroo HAYASHI         char s[] = "-abc-=-def";
1025*a939078aSHiroo HAYASHI         char *sp;
1026*a939078aSHiroo HAYASHI         x = mbstok_r(s, "-", &sp);      // x = "abc", sp = "=-def"
1027*a939078aSHiroo HAYASHI         x = mbstok_r(NULL, "-=", &sp);  // x = "def", sp = NULL
1028*a939078aSHiroo HAYASHI         x = mbstok_r(NULL, "=", &sp);   // x = NULL
1029*a939078aSHiroo HAYASHI                 // s = "abc\0-def\0"
1030*a939078aSHiroo HAYASHI 
1031*a939078aSHiroo HAYASHI    Caveat: It modifies the original string.
1032*a939078aSHiroo HAYASHI    Caveat: These functions cannot be used on constant strings.
1033*a939078aSHiroo HAYASHI    Caveat: The identity of the delimiting character is lost.
1034*a939078aSHiroo HAYASHI 
1035*a939078aSHiroo HAYASHI    See also mbssep().  */
1036*a939078aSHiroo HAYASHI _GL_EXTERN_C char * mbstok_r (char *restrict string, const char *delim,
1037*a939078aSHiroo HAYASHI                               char **save_ptr)
1038*a939078aSHiroo HAYASHI      _GL_ARG_NONNULL ((2, 3));
1039*a939078aSHiroo HAYASHI #endif
1040*a939078aSHiroo HAYASHI 
1041*a939078aSHiroo HAYASHI /* Map any int, typically from errno, into an error message.  */
1042*a939078aSHiroo HAYASHI #if @GNULIB_STRERROR@
1043*a939078aSHiroo HAYASHI # if @REPLACE_STRERROR@
1044*a939078aSHiroo HAYASHI #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1045*a939078aSHiroo HAYASHI #   undef strerror
1046*a939078aSHiroo HAYASHI #   define strerror rpl_strerror
1047*a939078aSHiroo HAYASHI #  endif
1048*a939078aSHiroo HAYASHI _GL_FUNCDECL_RPL (strerror, char *, (int));
1049*a939078aSHiroo HAYASHI _GL_CXXALIAS_RPL (strerror, char *, (int));
1050*a939078aSHiroo HAYASHI # else
1051*a939078aSHiroo HAYASHI _GL_CXXALIAS_SYS (strerror, char *, (int));
1052*a939078aSHiroo HAYASHI # endif
1053*a939078aSHiroo HAYASHI # if __GLIBC__ >= 2
1054*a939078aSHiroo HAYASHI _GL_CXXALIASWARN (strerror);
1055*a939078aSHiroo HAYASHI # endif
1056*a939078aSHiroo HAYASHI #elif defined GNULIB_POSIXCHECK
1057*a939078aSHiroo HAYASHI # undef strerror
1058*a939078aSHiroo HAYASHI /* Assume strerror is always declared.  */
1059*a939078aSHiroo HAYASHI _GL_WARN_ON_USE (strerror, "strerror is unportable - "
1060*a939078aSHiroo HAYASHI                  "use gnulib module strerror to guarantee non-NULL result");
1061*a939078aSHiroo HAYASHI #endif
1062*a939078aSHiroo HAYASHI 
1063*a939078aSHiroo HAYASHI /* Map any int, typically from errno, into an error message.  Multithread-safe.
1064*a939078aSHiroo HAYASHI    Uses the POSIX declaration, not the glibc declaration.  */
1065*a939078aSHiroo HAYASHI #if @GNULIB_STRERROR_R@
1066*a939078aSHiroo HAYASHI # if @REPLACE_STRERROR_R@
1067*a939078aSHiroo HAYASHI #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1068*a939078aSHiroo HAYASHI #   undef strerror_r
1069*a939078aSHiroo HAYASHI #   define strerror_r rpl_strerror_r
1070*a939078aSHiroo HAYASHI #  endif
1071*a939078aSHiroo HAYASHI _GL_FUNCDECL_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen)
1072*a939078aSHiroo HAYASHI                                    _GL_ARG_NONNULL ((2)));
1073*a939078aSHiroo HAYASHI _GL_CXXALIAS_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen));
1074*a939078aSHiroo HAYASHI # else
1075*a939078aSHiroo HAYASHI #  if !@HAVE_DECL_STRERROR_R@
1076*a939078aSHiroo HAYASHI _GL_FUNCDECL_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen)
1077*a939078aSHiroo HAYASHI                                    _GL_ARG_NONNULL ((2)));
1078*a939078aSHiroo HAYASHI #  endif
1079*a939078aSHiroo HAYASHI _GL_CXXALIAS_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen));
1080*a939078aSHiroo HAYASHI # endif
1081*a939078aSHiroo HAYASHI # if @HAVE_DECL_STRERROR_R@
1082*a939078aSHiroo HAYASHI _GL_CXXALIASWARN (strerror_r);
1083*a939078aSHiroo HAYASHI # endif
1084*a939078aSHiroo HAYASHI #elif defined GNULIB_POSIXCHECK
1085*a939078aSHiroo HAYASHI # undef strerror_r
1086*a939078aSHiroo HAYASHI # if HAVE_RAW_DECL_STRERROR_R
1087*a939078aSHiroo HAYASHI _GL_WARN_ON_USE (strerror_r, "strerror_r is unportable - "
1088*a939078aSHiroo HAYASHI                  "use gnulib module strerror_r-posix for portability");
1089*a939078aSHiroo HAYASHI # endif
1090*a939078aSHiroo HAYASHI #endif
1091*a939078aSHiroo HAYASHI 
1092*a939078aSHiroo HAYASHI /* Return the name of the system error code ERRNUM.  */
1093*a939078aSHiroo HAYASHI #if @GNULIB_STRERRORNAME_NP@
1094*a939078aSHiroo HAYASHI # if @REPLACE_STRERRORNAME_NP@
1095*a939078aSHiroo HAYASHI #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1096*a939078aSHiroo HAYASHI #   undef strerrorname_np
1097*a939078aSHiroo HAYASHI #   define strerrorname_np rpl_strerrorname_np
1098*a939078aSHiroo HAYASHI #  endif
1099*a939078aSHiroo HAYASHI _GL_FUNCDECL_RPL (strerrorname_np, const char *, (int errnum));
1100*a939078aSHiroo HAYASHI _GL_CXXALIAS_RPL (strerrorname_np, const char *, (int errnum));
1101*a939078aSHiroo HAYASHI # else
1102*a939078aSHiroo HAYASHI #  if !@HAVE_STRERRORNAME_NP@
1103*a939078aSHiroo HAYASHI _GL_FUNCDECL_SYS (strerrorname_np, const char *, (int errnum));
1104*a939078aSHiroo HAYASHI #  endif
1105*a939078aSHiroo HAYASHI _GL_CXXALIAS_SYS (strerrorname_np, const char *, (int errnum));
1106*a939078aSHiroo HAYASHI # endif
1107*a939078aSHiroo HAYASHI _GL_CXXALIASWARN (strerrorname_np);
1108*a939078aSHiroo HAYASHI #elif defined GNULIB_POSIXCHECK
1109*a939078aSHiroo HAYASHI # undef strerrorname_np
1110*a939078aSHiroo HAYASHI # if HAVE_RAW_DECL_STRERRORNAME_NP
1111*a939078aSHiroo HAYASHI _GL_WARN_ON_USE (strerrorname_np, "strerrorname_np is unportable - "
1112*a939078aSHiroo HAYASHI                  "use gnulib module strerrorname_np for portability");
1113*a939078aSHiroo HAYASHI # endif
1114*a939078aSHiroo HAYASHI #endif
1115*a939078aSHiroo HAYASHI 
1116*a939078aSHiroo HAYASHI /* Return an abbreviation string for the signal number SIG.  */
1117*a939078aSHiroo HAYASHI #if @GNULIB_SIGABBREV_NP@
1118*a939078aSHiroo HAYASHI # if ! @HAVE_SIGABBREV_NP@
1119*a939078aSHiroo HAYASHI _GL_FUNCDECL_SYS (sigabbrev_np, const char *, (int sig));
1120*a939078aSHiroo HAYASHI # endif
1121*a939078aSHiroo HAYASHI _GL_CXXALIAS_SYS (sigabbrev_np, const char *, (int sig));
1122*a939078aSHiroo HAYASHI _GL_CXXALIASWARN (sigabbrev_np);
1123*a939078aSHiroo HAYASHI #elif defined GNULIB_POSIXCHECK
1124*a939078aSHiroo HAYASHI # undef sigabbrev_np
1125*a939078aSHiroo HAYASHI # if HAVE_RAW_DECL_SIGABBREV_NP
1126*a939078aSHiroo HAYASHI _GL_WARN_ON_USE (sigabbrev_np, "sigabbrev_np is unportable - "
1127*a939078aSHiroo HAYASHI                  "use gnulib module sigabbrev_np for portability");
1128*a939078aSHiroo HAYASHI # endif
1129*a939078aSHiroo HAYASHI #endif
1130*a939078aSHiroo HAYASHI 
1131*a939078aSHiroo HAYASHI /* Return an English description string for the signal number SIG.  */
1132*a939078aSHiroo HAYASHI #if @GNULIB_SIGDESCR_NP@
1133*a939078aSHiroo HAYASHI # if ! @HAVE_SIGDESCR_NP@
1134*a939078aSHiroo HAYASHI _GL_FUNCDECL_SYS (sigdescr_np, const char *, (int sig));
1135*a939078aSHiroo HAYASHI # endif
1136*a939078aSHiroo HAYASHI _GL_CXXALIAS_SYS (sigdescr_np, const char *, (int sig));
1137*a939078aSHiroo HAYASHI _GL_CXXALIASWARN (sigdescr_np);
1138*a939078aSHiroo HAYASHI #elif defined GNULIB_POSIXCHECK
1139*a939078aSHiroo HAYASHI # undef sigdescr_np
1140*a939078aSHiroo HAYASHI # if HAVE_RAW_DECL_SIGDESCR_NP
1141*a939078aSHiroo HAYASHI _GL_WARN_ON_USE (sigdescr_np, "sigdescr_np is unportable - "
1142*a939078aSHiroo HAYASHI                  "use gnulib module sigdescr_np for portability");
1143*a939078aSHiroo HAYASHI # endif
1144*a939078aSHiroo HAYASHI #endif
1145*a939078aSHiroo HAYASHI 
1146*a939078aSHiroo HAYASHI #if @GNULIB_STRSIGNAL@
1147*a939078aSHiroo HAYASHI # if @REPLACE_STRSIGNAL@
1148*a939078aSHiroo HAYASHI #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1149*a939078aSHiroo HAYASHI #   define strsignal rpl_strsignal
1150*a939078aSHiroo HAYASHI #  endif
1151*a939078aSHiroo HAYASHI _GL_FUNCDECL_RPL (strsignal, char *, (int __sig));
1152*a939078aSHiroo HAYASHI _GL_CXXALIAS_RPL (strsignal, char *, (int __sig));
1153*a939078aSHiroo HAYASHI # else
1154*a939078aSHiroo HAYASHI #  if ! @HAVE_DECL_STRSIGNAL@
1155*a939078aSHiroo HAYASHI _GL_FUNCDECL_SYS (strsignal, char *, (int __sig));
1156*a939078aSHiroo HAYASHI #  endif
1157*a939078aSHiroo HAYASHI /* Need to cast, because on Cygwin 1.5.x systems, the return type is
1158*a939078aSHiroo HAYASHI    'const char *'.  */
1159*a939078aSHiroo HAYASHI _GL_CXXALIAS_SYS_CAST (strsignal, char *, (int __sig));
1160*a939078aSHiroo HAYASHI # endif
1161*a939078aSHiroo HAYASHI _GL_CXXALIASWARN (strsignal);
1162*a939078aSHiroo HAYASHI #elif defined GNULIB_POSIXCHECK
1163*a939078aSHiroo HAYASHI # undef strsignal
1164*a939078aSHiroo HAYASHI # if HAVE_RAW_DECL_STRSIGNAL
1165*a939078aSHiroo HAYASHI _GL_WARN_ON_USE (strsignal, "strsignal is unportable - "
1166*a939078aSHiroo HAYASHI                  "use gnulib module strsignal for portability");
1167*a939078aSHiroo HAYASHI # endif
1168*a939078aSHiroo HAYASHI #endif
1169*a939078aSHiroo HAYASHI 
1170*a939078aSHiroo HAYASHI #if @GNULIB_STRVERSCMP@
1171*a939078aSHiroo HAYASHI # if !@HAVE_STRVERSCMP@
1172*a939078aSHiroo HAYASHI _GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *)
1173*a939078aSHiroo HAYASHI                                    _GL_ATTRIBUTE_PURE
1174*a939078aSHiroo HAYASHI                                    _GL_ARG_NONNULL ((1, 2)));
1175*a939078aSHiroo HAYASHI # endif
1176*a939078aSHiroo HAYASHI _GL_CXXALIAS_SYS (strverscmp, int, (const char *, const char *));
1177*a939078aSHiroo HAYASHI _GL_CXXALIASWARN (strverscmp);
1178*a939078aSHiroo HAYASHI #elif defined GNULIB_POSIXCHECK
1179*a939078aSHiroo HAYASHI # undef strverscmp
1180*a939078aSHiroo HAYASHI # if HAVE_RAW_DECL_STRVERSCMP
1181*a939078aSHiroo HAYASHI _GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - "
1182*a939078aSHiroo HAYASHI                  "use gnulib module strverscmp for portability");
1183*a939078aSHiroo HAYASHI # endif
1184*a939078aSHiroo HAYASHI #endif
1185*a939078aSHiroo HAYASHI 
1186*a939078aSHiroo HAYASHI 
1187*a939078aSHiroo HAYASHI #endif /* _@GUARD_PREFIX@_STRING_H */
1188*a939078aSHiroo HAYASHI #endif /* _@GUARD_PREFIX@_STRING_H */
1189*a939078aSHiroo HAYASHI #endif
1190