xref: /dflybsd-src/gnu/usr.bin/gdb/libgnu/string.h (revision c33252afc5aa9790d4820b568316e03d695f6a65)
1*c33252afSJohn Marino /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2*c33252afSJohn Marino /* A GNU-like <string.h>.
3*c33252afSJohn Marino 
4*c33252afSJohn Marino    Copyright (C) 1995-1996, 2001-2012 Free Software Foundation, Inc.
5*c33252afSJohn Marino 
6*c33252afSJohn Marino    This program is free software; you can redistribute it and/or modify
7*c33252afSJohn Marino    it under the terms of the GNU General Public License as published by
8*c33252afSJohn Marino    the Free Software Foundation; either version 3, or (at your option)
9*c33252afSJohn Marino    any later version.
10*c33252afSJohn Marino 
11*c33252afSJohn Marino    This program is distributed in the hope that it will be useful,
12*c33252afSJohn Marino    but WITHOUT ANY WARRANTY; without even the implied warranty of
13*c33252afSJohn Marino    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14*c33252afSJohn Marino    GNU General Public License for more details.
15*c33252afSJohn Marino 
16*c33252afSJohn Marino    You should have received a copy of the GNU General Public License
17*c33252afSJohn Marino    along with this program; if not, see <http://www.gnu.org/licenses/>.  */
18*c33252afSJohn Marino 
19*c33252afSJohn Marino #ifndef _GL_STRING_H
20*c33252afSJohn Marino 
21*c33252afSJohn Marino #if __GNUC__ >= 3
22*c33252afSJohn Marino #pragma GCC system_header
23*c33252afSJohn Marino #endif
24*c33252afSJohn Marino 
25*c33252afSJohn Marino 
26*c33252afSJohn Marino /* The include_next requires a split double-inclusion guard.  */
27*c33252afSJohn Marino #include_next <string.h>
28*c33252afSJohn Marino 
29*c33252afSJohn Marino #ifndef _GL_STRING_H
30*c33252afSJohn Marino #define _GL_STRING_H
31*c33252afSJohn Marino 
32*c33252afSJohn Marino /* NetBSD 5.0 mis-defines NULL.  */
33*c33252afSJohn Marino #include <stddef.h>
34*c33252afSJohn Marino 
35*c33252afSJohn Marino /* MirBSD defines mbslen as a macro.  */
36*c33252afSJohn Marino #if 0 && defined __MirBSD__
37*c33252afSJohn Marino # include <wchar.h>
38*c33252afSJohn Marino #endif
39*c33252afSJohn Marino 
40*c33252afSJohn Marino /* The __attribute__ feature is available in gcc versions 2.5 and later.
41*c33252afSJohn Marino    The attribute __pure__ was added in gcc 2.96.  */
42*c33252afSJohn Marino #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
43*c33252afSJohn Marino # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
44*c33252afSJohn Marino #else
45*c33252afSJohn Marino # define _GL_ATTRIBUTE_PURE /* empty */
46*c33252afSJohn Marino #endif
47*c33252afSJohn Marino 
48*c33252afSJohn Marino /* NetBSD 5.0 declares strsignal in <unistd.h>, not in <string.h>.  */
49*c33252afSJohn Marino /* But in any case avoid namespace pollution on glibc systems.  */
50*c33252afSJohn Marino #if (0 || defined GNULIB_POSIXCHECK) && defined __NetBSD__ \
51*c33252afSJohn Marino     && ! defined __GLIBC__
52*c33252afSJohn Marino # include <unistd.h>
53*c33252afSJohn Marino #endif
54*c33252afSJohn Marino 
55*c33252afSJohn Marino /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
56*c33252afSJohn Marino #ifndef _GL_CXXDEFS_H
57*c33252afSJohn Marino #define _GL_CXXDEFS_H
58*c33252afSJohn Marino 
59*c33252afSJohn Marino /* The three most frequent use cases of these macros are:
60*c33252afSJohn Marino 
61*c33252afSJohn Marino    * For providing a substitute for a function that is missing on some
62*c33252afSJohn Marino      platforms, but is declared and works fine on the platforms on which
63*c33252afSJohn Marino      it exists:
64*c33252afSJohn Marino 
65*c33252afSJohn Marino        #if @GNULIB_FOO@
66*c33252afSJohn Marino        # if !@HAVE_FOO@
67*c33252afSJohn Marino        _GL_FUNCDECL_SYS (foo, ...);
68*c33252afSJohn Marino        # endif
69*c33252afSJohn Marino        _GL_CXXALIAS_SYS (foo, ...);
70*c33252afSJohn Marino        _GL_CXXALIASWARN (foo);
71*c33252afSJohn Marino        #elif defined GNULIB_POSIXCHECK
72*c33252afSJohn Marino        ...
73*c33252afSJohn Marino        #endif
74*c33252afSJohn Marino 
75*c33252afSJohn Marino    * For providing a replacement for a function that exists on all platforms,
76*c33252afSJohn Marino      but is broken/insufficient and needs to be replaced on some platforms:
77*c33252afSJohn Marino 
78*c33252afSJohn Marino        #if @GNULIB_FOO@
79*c33252afSJohn Marino        # if @REPLACE_FOO@
80*c33252afSJohn Marino        #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
81*c33252afSJohn Marino        #   undef foo
82*c33252afSJohn Marino        #   define foo rpl_foo
83*c33252afSJohn Marino        #  endif
84*c33252afSJohn Marino        _GL_FUNCDECL_RPL (foo, ...);
85*c33252afSJohn Marino        _GL_CXXALIAS_RPL (foo, ...);
86*c33252afSJohn Marino        # else
87*c33252afSJohn Marino        _GL_CXXALIAS_SYS (foo, ...);
88*c33252afSJohn Marino        # endif
89*c33252afSJohn Marino        _GL_CXXALIASWARN (foo);
90*c33252afSJohn Marino        #elif defined GNULIB_POSIXCHECK
91*c33252afSJohn Marino        ...
92*c33252afSJohn Marino        #endif
93*c33252afSJohn Marino 
94*c33252afSJohn Marino    * For providing a replacement for a function that exists on some platforms
95*c33252afSJohn Marino      but is broken/insufficient and needs to be replaced on some of them and
96*c33252afSJohn Marino      is additionally either missing or undeclared on some other platforms:
97*c33252afSJohn Marino 
98*c33252afSJohn Marino        #if @GNULIB_FOO@
99*c33252afSJohn Marino        # if @REPLACE_FOO@
100*c33252afSJohn Marino        #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
101*c33252afSJohn Marino        #   undef foo
102*c33252afSJohn Marino        #   define foo rpl_foo
103*c33252afSJohn Marino        #  endif
104*c33252afSJohn Marino        _GL_FUNCDECL_RPL (foo, ...);
105*c33252afSJohn Marino        _GL_CXXALIAS_RPL (foo, ...);
106*c33252afSJohn Marino        # else
107*c33252afSJohn Marino        #  if !@HAVE_FOO@   or   if !@HAVE_DECL_FOO@
108*c33252afSJohn Marino        _GL_FUNCDECL_SYS (foo, ...);
109*c33252afSJohn Marino        #  endif
110*c33252afSJohn Marino        _GL_CXXALIAS_SYS (foo, ...);
111*c33252afSJohn Marino        # endif
112*c33252afSJohn Marino        _GL_CXXALIASWARN (foo);
113*c33252afSJohn Marino        #elif defined GNULIB_POSIXCHECK
114*c33252afSJohn Marino        ...
115*c33252afSJohn Marino        #endif
116*c33252afSJohn Marino */
117*c33252afSJohn Marino 
118*c33252afSJohn Marino /* _GL_EXTERN_C declaration;
119*c33252afSJohn Marino    performs the declaration with C linkage.  */
120*c33252afSJohn Marino #if defined __cplusplus
121*c33252afSJohn Marino # define _GL_EXTERN_C extern "C"
122*c33252afSJohn Marino #else
123*c33252afSJohn Marino # define _GL_EXTERN_C extern
124*c33252afSJohn Marino #endif
125*c33252afSJohn Marino 
126*c33252afSJohn Marino /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
127*c33252afSJohn Marino    declares a replacement function, named rpl_func, with the given prototype,
128*c33252afSJohn Marino    consisting of return type, parameters, and attributes.
129*c33252afSJohn Marino    Example:
130*c33252afSJohn Marino      _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
131*c33252afSJohn Marino                                   _GL_ARG_NONNULL ((1)));
132*c33252afSJohn Marino  */
133*c33252afSJohn Marino #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
134*c33252afSJohn Marino   _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
135*c33252afSJohn Marino #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
136*c33252afSJohn Marino   _GL_EXTERN_C rettype rpl_func parameters_and_attributes
137*c33252afSJohn Marino 
138*c33252afSJohn Marino /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
139*c33252afSJohn Marino    declares the system function, named func, with the given prototype,
140*c33252afSJohn Marino    consisting of return type, parameters, and attributes.
141*c33252afSJohn Marino    Example:
142*c33252afSJohn Marino      _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
143*c33252afSJohn Marino                                   _GL_ARG_NONNULL ((1)));
144*c33252afSJohn Marino  */
145*c33252afSJohn Marino #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
146*c33252afSJohn Marino   _GL_EXTERN_C rettype func parameters_and_attributes
147*c33252afSJohn Marino 
148*c33252afSJohn Marino /* _GL_CXXALIAS_RPL (func, rettype, parameters);
149*c33252afSJohn Marino    declares a C++ alias called GNULIB_NAMESPACE::func
150*c33252afSJohn Marino    that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
151*c33252afSJohn Marino    Example:
152*c33252afSJohn Marino      _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
153*c33252afSJohn Marino  */
154*c33252afSJohn Marino #define _GL_CXXALIAS_RPL(func,rettype,parameters) \
155*c33252afSJohn Marino   _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
156*c33252afSJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE
157*c33252afSJohn Marino # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
158*c33252afSJohn Marino     namespace GNULIB_NAMESPACE                                \
159*c33252afSJohn Marino     {                                                         \
160*c33252afSJohn Marino       rettype (*const func) parameters = ::rpl_func;          \
161*c33252afSJohn Marino     }                                                         \
162*c33252afSJohn Marino     _GL_EXTERN_C int _gl_cxxalias_dummy
163*c33252afSJohn Marino #else
164*c33252afSJohn Marino # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
165*c33252afSJohn Marino     _GL_EXTERN_C int _gl_cxxalias_dummy
166*c33252afSJohn Marino #endif
167*c33252afSJohn Marino 
168*c33252afSJohn Marino /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
169*c33252afSJohn Marino    is like  _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
170*c33252afSJohn Marino    except that the C function rpl_func may have a slightly different
171*c33252afSJohn Marino    declaration.  A cast is used to silence the "invalid conversion" error
172*c33252afSJohn Marino    that would otherwise occur.  */
173*c33252afSJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE
174*c33252afSJohn Marino # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
175*c33252afSJohn Marino     namespace GNULIB_NAMESPACE                                     \
176*c33252afSJohn Marino     {                                                              \
177*c33252afSJohn Marino       rettype (*const func) parameters =                           \
178*c33252afSJohn Marino         reinterpret_cast<rettype(*)parameters>(::rpl_func);        \
179*c33252afSJohn Marino     }                                                              \
180*c33252afSJohn Marino     _GL_EXTERN_C int _gl_cxxalias_dummy
181*c33252afSJohn Marino #else
182*c33252afSJohn Marino # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
183*c33252afSJohn Marino     _GL_EXTERN_C int _gl_cxxalias_dummy
184*c33252afSJohn Marino #endif
185*c33252afSJohn Marino 
186*c33252afSJohn Marino /* _GL_CXXALIAS_SYS (func, rettype, parameters);
187*c33252afSJohn Marino    declares a C++ alias called GNULIB_NAMESPACE::func
188*c33252afSJohn Marino    that redirects to the system provided function func, if GNULIB_NAMESPACE
189*c33252afSJohn Marino    is defined.
190*c33252afSJohn Marino    Example:
191*c33252afSJohn Marino      _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
192*c33252afSJohn Marino  */
193*c33252afSJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE
194*c33252afSJohn Marino   /* If we were to write
195*c33252afSJohn Marino        rettype (*const func) parameters = ::func;
196*c33252afSJohn Marino      like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls
197*c33252afSJohn Marino      better (remove an indirection through a 'static' pointer variable),
198*c33252afSJohn Marino      but then the _GL_CXXALIASWARN macro below would cause a warning not only
199*c33252afSJohn Marino      for uses of ::func but also for uses of GNULIB_NAMESPACE::func.  */
200*c33252afSJohn Marino # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
201*c33252afSJohn Marino     namespace GNULIB_NAMESPACE                     \
202*c33252afSJohn Marino     {                                              \
203*c33252afSJohn Marino       static rettype (*func) parameters = ::func;  \
204*c33252afSJohn Marino     }                                              \
205*c33252afSJohn Marino     _GL_EXTERN_C int _gl_cxxalias_dummy
206*c33252afSJohn Marino #else
207*c33252afSJohn Marino # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
208*c33252afSJohn Marino     _GL_EXTERN_C int _gl_cxxalias_dummy
209*c33252afSJohn Marino #endif
210*c33252afSJohn Marino 
211*c33252afSJohn Marino /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
212*c33252afSJohn Marino    is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
213*c33252afSJohn Marino    except that the C function func may have a slightly different declaration.
214*c33252afSJohn Marino    A cast is used to silence the "invalid conversion" error that would
215*c33252afSJohn Marino    otherwise occur.  */
216*c33252afSJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE
217*c33252afSJohn Marino # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
218*c33252afSJohn Marino     namespace GNULIB_NAMESPACE                          \
219*c33252afSJohn Marino     {                                                   \
220*c33252afSJohn Marino       static rettype (*func) parameters =               \
221*c33252afSJohn Marino         reinterpret_cast<rettype(*)parameters>(::func); \
222*c33252afSJohn Marino     }                                                   \
223*c33252afSJohn Marino     _GL_EXTERN_C int _gl_cxxalias_dummy
224*c33252afSJohn Marino #else
225*c33252afSJohn Marino # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
226*c33252afSJohn Marino     _GL_EXTERN_C int _gl_cxxalias_dummy
227*c33252afSJohn Marino #endif
228*c33252afSJohn Marino 
229*c33252afSJohn Marino /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
230*c33252afSJohn Marino    is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
231*c33252afSJohn Marino    except that the C function is picked among a set of overloaded functions,
232*c33252afSJohn Marino    namely the one with rettype2 and parameters2.  Two consecutive casts
233*c33252afSJohn Marino    are used to silence the "cannot find a match" and "invalid conversion"
234*c33252afSJohn Marino    errors that would otherwise occur.  */
235*c33252afSJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE
236*c33252afSJohn Marino   /* The outer cast must be a reinterpret_cast.
237*c33252afSJohn Marino      The inner cast: When the function is defined as a set of overloaded
238*c33252afSJohn Marino      functions, it works as a static_cast<>, choosing the designated variant.
239*c33252afSJohn Marino      When the function is defined as a single variant, it works as a
240*c33252afSJohn Marino      reinterpret_cast<>. The parenthesized cast syntax works both ways.  */
241*c33252afSJohn Marino # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
242*c33252afSJohn Marino     namespace GNULIB_NAMESPACE                                                \
243*c33252afSJohn Marino     {                                                                         \
244*c33252afSJohn Marino       static rettype (*func) parameters =                                     \
245*c33252afSJohn Marino         reinterpret_cast<rettype(*)parameters>(                               \
246*c33252afSJohn Marino           (rettype2(*)parameters2)(::func));                                  \
247*c33252afSJohn Marino     }                                                                         \
248*c33252afSJohn Marino     _GL_EXTERN_C int _gl_cxxalias_dummy
249*c33252afSJohn Marino #else
250*c33252afSJohn Marino # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
251*c33252afSJohn Marino     _GL_EXTERN_C int _gl_cxxalias_dummy
252*c33252afSJohn Marino #endif
253*c33252afSJohn Marino 
254*c33252afSJohn Marino /* _GL_CXXALIASWARN (func);
255*c33252afSJohn Marino    causes a warning to be emitted when ::func is used but not when
256*c33252afSJohn Marino    GNULIB_NAMESPACE::func is used.  func must be defined without overloaded
257*c33252afSJohn Marino    variants.  */
258*c33252afSJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE
259*c33252afSJohn Marino # define _GL_CXXALIASWARN(func) \
260*c33252afSJohn Marino    _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
261*c33252afSJohn Marino # define _GL_CXXALIASWARN_1(func,namespace) \
262*c33252afSJohn Marino    _GL_CXXALIASWARN_2 (func, namespace)
263*c33252afSJohn Marino /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
264*c33252afSJohn Marino    we enable the warning only when not optimizing.  */
265*c33252afSJohn Marino # if !__OPTIMIZE__
266*c33252afSJohn Marino #  define _GL_CXXALIASWARN_2(func,namespace) \
267*c33252afSJohn Marino     _GL_WARN_ON_USE (func, \
268*c33252afSJohn Marino                      "The symbol ::" #func " refers to the system function. " \
269*c33252afSJohn Marino                      "Use " #namespace "::" #func " instead.")
270*c33252afSJohn Marino # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
271*c33252afSJohn Marino #  define _GL_CXXALIASWARN_2(func,namespace) \
272*c33252afSJohn Marino      extern __typeof__ (func) func
273*c33252afSJohn Marino # else
274*c33252afSJohn Marino #  define _GL_CXXALIASWARN_2(func,namespace) \
275*c33252afSJohn Marino      _GL_EXTERN_C int _gl_cxxalias_dummy
276*c33252afSJohn Marino # endif
277*c33252afSJohn Marino #else
278*c33252afSJohn Marino # define _GL_CXXALIASWARN(func) \
279*c33252afSJohn Marino     _GL_EXTERN_C int _gl_cxxalias_dummy
280*c33252afSJohn Marino #endif
281*c33252afSJohn Marino 
282*c33252afSJohn Marino /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
283*c33252afSJohn Marino    causes a warning to be emitted when the given overloaded variant of ::func
284*c33252afSJohn Marino    is used but not when GNULIB_NAMESPACE::func is used.  */
285*c33252afSJohn Marino #if defined __cplusplus && defined GNULIB_NAMESPACE
286*c33252afSJohn Marino # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
287*c33252afSJohn Marino    _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
288*c33252afSJohn Marino                         GNULIB_NAMESPACE)
289*c33252afSJohn Marino # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
290*c33252afSJohn Marino    _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
291*c33252afSJohn Marino /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
292*c33252afSJohn Marino    we enable the warning only when not optimizing.  */
293*c33252afSJohn Marino # if !__OPTIMIZE__
294*c33252afSJohn Marino #  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
295*c33252afSJohn Marino     _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
296*c33252afSJohn Marino                          "The symbol ::" #func " refers to the system function. " \
297*c33252afSJohn Marino                          "Use " #namespace "::" #func " instead.")
298*c33252afSJohn Marino # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
299*c33252afSJohn Marino #  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
300*c33252afSJohn Marino      extern __typeof__ (func) func
301*c33252afSJohn Marino # else
302*c33252afSJohn Marino #  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
303*c33252afSJohn Marino      _GL_EXTERN_C int _gl_cxxalias_dummy
304*c33252afSJohn Marino # endif
305*c33252afSJohn Marino #else
306*c33252afSJohn Marino # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
307*c33252afSJohn Marino     _GL_EXTERN_C int _gl_cxxalias_dummy
308*c33252afSJohn Marino #endif
309*c33252afSJohn Marino 
310*c33252afSJohn Marino #endif /* _GL_CXXDEFS_H */
311*c33252afSJohn Marino 
312*c33252afSJohn Marino /* The definition of _GL_ARG_NONNULL is copied here.  */
313*c33252afSJohn Marino /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
314*c33252afSJohn Marino    that the values passed as arguments n, ..., m must be non-NULL pointers.
315*c33252afSJohn Marino    n = 1 stands for the first argument, n = 2 for the second argument etc.  */
316*c33252afSJohn Marino #ifndef _GL_ARG_NONNULL
317*c33252afSJohn Marino # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
318*c33252afSJohn Marino #  define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
319*c33252afSJohn Marino # else
320*c33252afSJohn Marino #  define _GL_ARG_NONNULL(params)
321*c33252afSJohn Marino # endif
322*c33252afSJohn Marino #endif
323*c33252afSJohn Marino 
324*c33252afSJohn Marino /* The definition of _GL_WARN_ON_USE is copied here.  */
325*c33252afSJohn Marino #ifndef _GL_WARN_ON_USE
326*c33252afSJohn Marino 
327*c33252afSJohn Marino # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
328*c33252afSJohn Marino /* A compiler attribute is available in gcc versions 4.3.0 and later.  */
329*c33252afSJohn Marino #  define _GL_WARN_ON_USE(function, message) \
330*c33252afSJohn Marino extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
331*c33252afSJohn Marino # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
332*c33252afSJohn Marino /* Verify the existence of the function.  */
333*c33252afSJohn Marino #  define _GL_WARN_ON_USE(function, message) \
334*c33252afSJohn Marino extern __typeof__ (function) function
335*c33252afSJohn Marino # else /* Unsupported.  */
336*c33252afSJohn Marino #  define _GL_WARN_ON_USE(function, message) \
337*c33252afSJohn Marino _GL_WARN_EXTERN_C int _gl_warn_on_use
338*c33252afSJohn Marino # endif
339*c33252afSJohn Marino #endif
340*c33252afSJohn Marino 
341*c33252afSJohn Marino /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
342*c33252afSJohn Marino    is like _GL_WARN_ON_USE (function, "string"), except that the function is
343*c33252afSJohn Marino    declared with the given prototype, consisting of return type, parameters,
344*c33252afSJohn Marino    and attributes.
345*c33252afSJohn Marino    This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
346*c33252afSJohn Marino    not work in this case.  */
347*c33252afSJohn Marino #ifndef _GL_WARN_ON_USE_CXX
348*c33252afSJohn Marino # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
349*c33252afSJohn Marino #  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
350*c33252afSJohn Marino extern rettype function parameters_and_attributes \
351*c33252afSJohn Marino      __attribute__ ((__warning__ (msg)))
352*c33252afSJohn Marino # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
353*c33252afSJohn Marino /* Verify the existence of the function.  */
354*c33252afSJohn Marino #  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
355*c33252afSJohn Marino extern rettype function parameters_and_attributes
356*c33252afSJohn Marino # else /* Unsupported.  */
357*c33252afSJohn Marino #  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
358*c33252afSJohn Marino _GL_WARN_EXTERN_C int _gl_warn_on_use
359*c33252afSJohn Marino # endif
360*c33252afSJohn Marino #endif
361*c33252afSJohn Marino 
362*c33252afSJohn Marino /* _GL_WARN_EXTERN_C declaration;
363*c33252afSJohn Marino    performs the declaration with C linkage.  */
364*c33252afSJohn Marino #ifndef _GL_WARN_EXTERN_C
365*c33252afSJohn Marino # if defined __cplusplus
366*c33252afSJohn Marino #  define _GL_WARN_EXTERN_C extern "C"
367*c33252afSJohn Marino # else
368*c33252afSJohn Marino #  define _GL_WARN_EXTERN_C extern
369*c33252afSJohn Marino # endif
370*c33252afSJohn Marino #endif
371*c33252afSJohn Marino 
372*c33252afSJohn Marino 
373*c33252afSJohn Marino /* Find the index of the least-significant set bit.  */
374*c33252afSJohn Marino #if 0
375*c33252afSJohn Marino # if !1
376*c33252afSJohn Marino _GL_FUNCDECL_SYS (ffsl, int, (long int i));
377*c33252afSJohn Marino # endif
378*c33252afSJohn Marino _GL_CXXALIAS_SYS (ffsl, int, (long int i));
379*c33252afSJohn Marino _GL_CXXALIASWARN (ffsl);
380*c33252afSJohn Marino #elif defined GNULIB_POSIXCHECK
381*c33252afSJohn Marino # undef ffsl
382*c33252afSJohn Marino # if HAVE_RAW_DECL_FFSL
383*c33252afSJohn Marino _GL_WARN_ON_USE (ffsl, "ffsl is not portable - use the ffsl module");
384*c33252afSJohn Marino # endif
385*c33252afSJohn Marino #endif
386*c33252afSJohn Marino 
387*c33252afSJohn Marino 
388*c33252afSJohn Marino /* Find the index of the least-significant set bit.  */
389*c33252afSJohn Marino #if 0
390*c33252afSJohn Marino # if !1
391*c33252afSJohn Marino _GL_FUNCDECL_SYS (ffsll, int, (long long int i));
392*c33252afSJohn Marino # endif
393*c33252afSJohn Marino _GL_CXXALIAS_SYS (ffsll, int, (long long int i));
394*c33252afSJohn Marino _GL_CXXALIASWARN (ffsll);
395*c33252afSJohn Marino #elif defined GNULIB_POSIXCHECK
396*c33252afSJohn Marino # undef ffsll
397*c33252afSJohn Marino # if HAVE_RAW_DECL_FFSLL
398*c33252afSJohn Marino _GL_WARN_ON_USE (ffsll, "ffsll is not portable - use the ffsll module");
399*c33252afSJohn Marino # endif
400*c33252afSJohn Marino #endif
401*c33252afSJohn Marino 
402*c33252afSJohn Marino 
403*c33252afSJohn Marino /* Return the first instance of C within N bytes of S, or NULL.  */
404*c33252afSJohn Marino #if 1
405*c33252afSJohn Marino # if 0
406*c33252afSJohn Marino #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
407*c33252afSJohn Marino #   define memchr rpl_memchr
408*c33252afSJohn Marino #  endif
409*c33252afSJohn Marino _GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n)
410*c33252afSJohn Marino                                   _GL_ATTRIBUTE_PURE
411*c33252afSJohn Marino                                   _GL_ARG_NONNULL ((1)));
412*c33252afSJohn Marino _GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n));
413*c33252afSJohn Marino # else
414*c33252afSJohn Marino #  if ! 1
415*c33252afSJohn Marino _GL_FUNCDECL_SYS (memchr, void *, (void const *__s, int __c, size_t __n)
416*c33252afSJohn Marino                                   _GL_ATTRIBUTE_PURE
417*c33252afSJohn Marino                                   _GL_ARG_NONNULL ((1)));
418*c33252afSJohn Marino #  endif
419*c33252afSJohn Marino   /* On some systems, this function is defined as an overloaded function:
420*c33252afSJohn Marino        extern "C" { const void * std::memchr (const void *, int, size_t); }
421*c33252afSJohn Marino        extern "C++" { void * std::memchr (void *, int, size_t); }  */
422*c33252afSJohn Marino _GL_CXXALIAS_SYS_CAST2 (memchr,
423*c33252afSJohn Marino                         void *, (void const *__s, int __c, size_t __n),
424*c33252afSJohn Marino                         void const *, (void const *__s, int __c, size_t __n));
425*c33252afSJohn Marino # endif
426*c33252afSJohn Marino # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
427*c33252afSJohn Marino      && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
428*c33252afSJohn Marino _GL_CXXALIASWARN1 (memchr, void *, (void *__s, int __c, size_t __n));
429*c33252afSJohn Marino _GL_CXXALIASWARN1 (memchr, void const *,
430*c33252afSJohn Marino                    (void const *__s, int __c, size_t __n));
431*c33252afSJohn Marino # else
432*c33252afSJohn Marino _GL_CXXALIASWARN (memchr);
433*c33252afSJohn Marino # endif
434*c33252afSJohn Marino #elif defined GNULIB_POSIXCHECK
435*c33252afSJohn Marino # undef memchr
436*c33252afSJohn Marino /* Assume memchr is always declared.  */
437*c33252afSJohn Marino _GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - "
438*c33252afSJohn Marino                  "use gnulib module memchr for portability" );
439*c33252afSJohn Marino #endif
440*c33252afSJohn Marino 
441*c33252afSJohn Marino /* Return the first occurrence of NEEDLE in HAYSTACK.  */
442*c33252afSJohn Marino #if 1
443*c33252afSJohn Marino # if 1
444*c33252afSJohn Marino #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
445*c33252afSJohn Marino #   define memmem rpl_memmem
446*c33252afSJohn Marino #  endif
447*c33252afSJohn Marino _GL_FUNCDECL_RPL (memmem, void *,
448*c33252afSJohn Marino                   (void const *__haystack, size_t __haystack_len,
449*c33252afSJohn Marino                    void const *__needle, size_t __needle_len)
450*c33252afSJohn Marino                   _GL_ATTRIBUTE_PURE
451*c33252afSJohn Marino                   _GL_ARG_NONNULL ((1, 3)));
452*c33252afSJohn Marino _GL_CXXALIAS_RPL (memmem, void *,
453*c33252afSJohn Marino                   (void const *__haystack, size_t __haystack_len,
454*c33252afSJohn Marino                    void const *__needle, size_t __needle_len));
455*c33252afSJohn Marino # else
456*c33252afSJohn Marino #  if ! 1
457*c33252afSJohn Marino _GL_FUNCDECL_SYS (memmem, void *,
458*c33252afSJohn Marino                   (void const *__haystack, size_t __haystack_len,
459*c33252afSJohn Marino                    void const *__needle, size_t __needle_len)
460*c33252afSJohn Marino                   _GL_ATTRIBUTE_PURE
461*c33252afSJohn Marino                   _GL_ARG_NONNULL ((1, 3)));
462*c33252afSJohn Marino #  endif
463*c33252afSJohn Marino _GL_CXXALIAS_SYS (memmem, void *,
464*c33252afSJohn Marino                   (void const *__haystack, size_t __haystack_len,
465*c33252afSJohn Marino                    void const *__needle, size_t __needle_len));
466*c33252afSJohn Marino # endif
467*c33252afSJohn Marino _GL_CXXALIASWARN (memmem);
468*c33252afSJohn Marino #elif defined GNULIB_POSIXCHECK
469*c33252afSJohn Marino # undef memmem
470*c33252afSJohn Marino # if HAVE_RAW_DECL_MEMMEM
471*c33252afSJohn Marino _GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - "
472*c33252afSJohn Marino                  "use gnulib module memmem-simple for portability, "
473*c33252afSJohn Marino                  "and module memmem for speed" );
474*c33252afSJohn Marino # endif
475*c33252afSJohn Marino #endif
476*c33252afSJohn Marino 
477*c33252afSJohn Marino /* Copy N bytes of SRC to DEST, return pointer to bytes after the
478*c33252afSJohn Marino    last written byte.  */
479*c33252afSJohn Marino #if 0
480*c33252afSJohn Marino # if ! 1
481*c33252afSJohn Marino _GL_FUNCDECL_SYS (mempcpy, void *,
482*c33252afSJohn Marino                   (void *restrict __dest, void const *restrict __src,
483*c33252afSJohn Marino                    size_t __n)
484*c33252afSJohn Marino                   _GL_ARG_NONNULL ((1, 2)));
485*c33252afSJohn Marino # endif
486*c33252afSJohn Marino _GL_CXXALIAS_SYS (mempcpy, void *,
487*c33252afSJohn Marino                   (void *restrict __dest, void const *restrict __src,
488*c33252afSJohn Marino                    size_t __n));
489*c33252afSJohn Marino _GL_CXXALIASWARN (mempcpy);
490*c33252afSJohn Marino #elif defined GNULIB_POSIXCHECK
491*c33252afSJohn Marino # undef mempcpy
492*c33252afSJohn Marino # if HAVE_RAW_DECL_MEMPCPY
493*c33252afSJohn Marino _GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - "
494*c33252afSJohn Marino                  "use gnulib module mempcpy for portability");
495*c33252afSJohn Marino # endif
496*c33252afSJohn Marino #endif
497*c33252afSJohn Marino 
498*c33252afSJohn Marino /* Search backwards through a block for a byte (specified as an int).  */
499*c33252afSJohn Marino #if 0
500*c33252afSJohn Marino # if ! 1
501*c33252afSJohn Marino _GL_FUNCDECL_SYS (memrchr, void *, (void const *, int, size_t)
502*c33252afSJohn Marino                                    _GL_ATTRIBUTE_PURE
503*c33252afSJohn Marino                                    _GL_ARG_NONNULL ((1)));
504*c33252afSJohn Marino # endif
505*c33252afSJohn Marino   /* On some systems, this function is defined as an overloaded function:
506*c33252afSJohn Marino        extern "C++" { const void * std::memrchr (const void *, int, size_t); }
507*c33252afSJohn Marino        extern "C++" { void * std::memrchr (void *, int, size_t); }  */
508*c33252afSJohn Marino _GL_CXXALIAS_SYS_CAST2 (memrchr,
509*c33252afSJohn Marino                         void *, (void const *, int, size_t),
510*c33252afSJohn Marino                         void const *, (void const *, int, size_t));
511*c33252afSJohn Marino # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
512*c33252afSJohn Marino      && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
513*c33252afSJohn Marino _GL_CXXALIASWARN1 (memrchr, void *, (void *, int, size_t));
514*c33252afSJohn Marino _GL_CXXALIASWARN1 (memrchr, void const *, (void const *, int, size_t));
515*c33252afSJohn Marino # else
516*c33252afSJohn Marino _GL_CXXALIASWARN (memrchr);
517*c33252afSJohn Marino # endif
518*c33252afSJohn Marino #elif defined GNULIB_POSIXCHECK
519*c33252afSJohn Marino # undef memrchr
520*c33252afSJohn Marino # if HAVE_RAW_DECL_MEMRCHR
521*c33252afSJohn Marino _GL_WARN_ON_USE (memrchr, "memrchr is unportable - "
522*c33252afSJohn Marino                  "use gnulib module memrchr for portability");
523*c33252afSJohn Marino # endif
524*c33252afSJohn Marino #endif
525*c33252afSJohn Marino 
526*c33252afSJohn Marino /* Find the first occurrence of C in S.  More efficient than
527*c33252afSJohn Marino    memchr(S,C,N), at the expense of undefined behavior if C does not
528*c33252afSJohn Marino    occur within N bytes.  */
529*c33252afSJohn Marino #if 0
530*c33252afSJohn Marino # if ! 1
531*c33252afSJohn Marino _GL_FUNCDECL_SYS (rawmemchr, void *, (void const *__s, int __c_in)
532*c33252afSJohn Marino                                      _GL_ATTRIBUTE_PURE
533*c33252afSJohn Marino                                      _GL_ARG_NONNULL ((1)));
534*c33252afSJohn Marino # endif
535*c33252afSJohn Marino   /* On some systems, this function is defined as an overloaded function:
536*c33252afSJohn Marino        extern "C++" { const void * std::rawmemchr (const void *, int); }
537*c33252afSJohn Marino        extern "C++" { void * std::rawmemchr (void *, int); }  */
538*c33252afSJohn Marino _GL_CXXALIAS_SYS_CAST2 (rawmemchr,
539*c33252afSJohn Marino                         void *, (void const *__s, int __c_in),
540*c33252afSJohn Marino                         void const *, (void const *__s, int __c_in));
541*c33252afSJohn Marino # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
542*c33252afSJohn Marino      && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
543*c33252afSJohn Marino _GL_CXXALIASWARN1 (rawmemchr, void *, (void *__s, int __c_in));
544*c33252afSJohn Marino _GL_CXXALIASWARN1 (rawmemchr, void const *, (void const *__s, int __c_in));
545*c33252afSJohn Marino # else
546*c33252afSJohn Marino _GL_CXXALIASWARN (rawmemchr);
547*c33252afSJohn Marino # endif
548*c33252afSJohn Marino #elif defined GNULIB_POSIXCHECK
549*c33252afSJohn Marino # undef rawmemchr
550*c33252afSJohn Marino # if HAVE_RAW_DECL_RAWMEMCHR
551*c33252afSJohn Marino _GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - "
552*c33252afSJohn Marino                  "use gnulib module rawmemchr for portability");
553*c33252afSJohn Marino # endif
554*c33252afSJohn Marino #endif
555*c33252afSJohn Marino 
556*c33252afSJohn Marino /* Copy SRC to DST, returning the address of the terminating '\0' in DST.  */
557*c33252afSJohn Marino #if 0
558*c33252afSJohn Marino # if ! 1
559*c33252afSJohn Marino _GL_FUNCDECL_SYS (stpcpy, char *,
560*c33252afSJohn Marino                   (char *restrict __dst, char const *restrict __src)
561*c33252afSJohn Marino                   _GL_ARG_NONNULL ((1, 2)));
562*c33252afSJohn Marino # endif
563*c33252afSJohn Marino _GL_CXXALIAS_SYS (stpcpy, char *,
564*c33252afSJohn Marino                   (char *restrict __dst, char const *restrict __src));
565*c33252afSJohn Marino _GL_CXXALIASWARN (stpcpy);
566*c33252afSJohn Marino #elif defined GNULIB_POSIXCHECK
567*c33252afSJohn Marino # undef stpcpy
568*c33252afSJohn Marino # if HAVE_RAW_DECL_STPCPY
569*c33252afSJohn Marino _GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - "
570*c33252afSJohn Marino                  "use gnulib module stpcpy for portability");
571*c33252afSJohn Marino # endif
572*c33252afSJohn Marino #endif
573*c33252afSJohn Marino 
574*c33252afSJohn Marino /* Copy no more than N bytes of SRC to DST, returning a pointer past the
575*c33252afSJohn Marino    last non-NUL byte written into DST.  */
576*c33252afSJohn Marino #if 0
577*c33252afSJohn Marino # if 0
578*c33252afSJohn Marino #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
579*c33252afSJohn Marino #   undef stpncpy
580*c33252afSJohn Marino #   define stpncpy rpl_stpncpy
581*c33252afSJohn Marino #  endif
582*c33252afSJohn Marino _GL_FUNCDECL_RPL (stpncpy, char *,
583*c33252afSJohn Marino                   (char *restrict __dst, char const *restrict __src,
584*c33252afSJohn Marino                    size_t __n)
585*c33252afSJohn Marino                   _GL_ARG_NONNULL ((1, 2)));
586*c33252afSJohn Marino _GL_CXXALIAS_RPL (stpncpy, char *,
587*c33252afSJohn Marino                   (char *restrict __dst, char const *restrict __src,
588*c33252afSJohn Marino                    size_t __n));
589*c33252afSJohn Marino # else
590*c33252afSJohn Marino #  if ! 1
591*c33252afSJohn Marino _GL_FUNCDECL_SYS (stpncpy, char *,
592*c33252afSJohn Marino                   (char *restrict __dst, char const *restrict __src,
593*c33252afSJohn Marino                    size_t __n)
594*c33252afSJohn Marino                   _GL_ARG_NONNULL ((1, 2)));
595*c33252afSJohn Marino #  endif
596*c33252afSJohn Marino _GL_CXXALIAS_SYS (stpncpy, char *,
597*c33252afSJohn Marino                   (char *restrict __dst, char const *restrict __src,
598*c33252afSJohn Marino                    size_t __n));
599*c33252afSJohn Marino # endif
600*c33252afSJohn Marino _GL_CXXALIASWARN (stpncpy);
601*c33252afSJohn Marino #elif defined GNULIB_POSIXCHECK
602*c33252afSJohn Marino # undef stpncpy
603*c33252afSJohn Marino # if HAVE_RAW_DECL_STPNCPY
604*c33252afSJohn Marino _GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - "
605*c33252afSJohn Marino                  "use gnulib module stpncpy for portability");
606*c33252afSJohn Marino # endif
607*c33252afSJohn Marino #endif
608*c33252afSJohn Marino 
609*c33252afSJohn Marino #if defined GNULIB_POSIXCHECK
610*c33252afSJohn Marino /* strchr() does not work with multibyte strings if the locale encoding is
611*c33252afSJohn Marino    GB18030 and the character to be searched is a digit.  */
612*c33252afSJohn Marino # undef strchr
613*c33252afSJohn Marino /* Assume strchr is always declared.  */
614*c33252afSJohn Marino _GL_WARN_ON_USE (strchr, "strchr cannot work correctly on character strings "
615*c33252afSJohn Marino                  "in some multibyte locales - "
616*c33252afSJohn Marino                  "use mbschr if you care about internationalization");
617*c33252afSJohn Marino #endif
618*c33252afSJohn Marino 
619*c33252afSJohn Marino /* Find the first occurrence of C in S or the final NUL byte.  */
620*c33252afSJohn Marino #if 0
621*c33252afSJohn Marino # if 0
622*c33252afSJohn Marino #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
623*c33252afSJohn Marino #   define strchrnul rpl_strchrnul
624*c33252afSJohn Marino #  endif
625*c33252afSJohn Marino _GL_FUNCDECL_RPL (strchrnul, char *, (const char *__s, int __c_in)
626*c33252afSJohn Marino                                      _GL_ATTRIBUTE_PURE
627*c33252afSJohn Marino                                      _GL_ARG_NONNULL ((1)));
628*c33252afSJohn Marino _GL_CXXALIAS_RPL (strchrnul, char *,
629*c33252afSJohn Marino                   (const char *str, int ch));
630*c33252afSJohn Marino # else
631*c33252afSJohn Marino #  if ! 1
632*c33252afSJohn Marino _GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in)
633*c33252afSJohn Marino                                      _GL_ATTRIBUTE_PURE
634*c33252afSJohn Marino                                      _GL_ARG_NONNULL ((1)));
635*c33252afSJohn Marino #  endif
636*c33252afSJohn Marino   /* On some systems, this function is defined as an overloaded function:
637*c33252afSJohn Marino        extern "C++" { const char * std::strchrnul (const char *, int); }
638*c33252afSJohn Marino        extern "C++" { char * std::strchrnul (char *, int); }  */
639*c33252afSJohn Marino _GL_CXXALIAS_SYS_CAST2 (strchrnul,
640*c33252afSJohn Marino                         char *, (char const *__s, int __c_in),
641*c33252afSJohn Marino                         char const *, (char const *__s, int __c_in));
642*c33252afSJohn Marino # endif
643*c33252afSJohn Marino # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
644*c33252afSJohn Marino      && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
645*c33252afSJohn Marino _GL_CXXALIASWARN1 (strchrnul, char *, (char *__s, int __c_in));
646*c33252afSJohn Marino _GL_CXXALIASWARN1 (strchrnul, char const *, (char const *__s, int __c_in));
647*c33252afSJohn Marino # else
648*c33252afSJohn Marino _GL_CXXALIASWARN (strchrnul);
649*c33252afSJohn Marino # endif
650*c33252afSJohn Marino #elif defined GNULIB_POSIXCHECK
651*c33252afSJohn Marino # undef strchrnul
652*c33252afSJohn Marino # if HAVE_RAW_DECL_STRCHRNUL
653*c33252afSJohn Marino _GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - "
654*c33252afSJohn Marino                  "use gnulib module strchrnul for portability");
655*c33252afSJohn Marino # endif
656*c33252afSJohn Marino #endif
657*c33252afSJohn Marino 
658*c33252afSJohn Marino /* Duplicate S, returning an identical malloc'd string.  */
659*c33252afSJohn Marino #if 0
660*c33252afSJohn Marino # if 0
661*c33252afSJohn Marino #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
662*c33252afSJohn Marino #   undef strdup
663*c33252afSJohn Marino #   define strdup rpl_strdup
664*c33252afSJohn Marino #  endif
665*c33252afSJohn Marino _GL_FUNCDECL_RPL (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1)));
666*c33252afSJohn Marino _GL_CXXALIAS_RPL (strdup, char *, (char const *__s));
667*c33252afSJohn Marino # else
668*c33252afSJohn Marino #  if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup
669*c33252afSJohn Marino     /* strdup exists as a function and as a macro.  Get rid of the macro.  */
670*c33252afSJohn Marino #   undef strdup
671*c33252afSJohn Marino #  endif
672*c33252afSJohn Marino #  if !(1 || defined strdup)
673*c33252afSJohn Marino _GL_FUNCDECL_SYS (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1)));
674*c33252afSJohn Marino #  endif
675*c33252afSJohn Marino _GL_CXXALIAS_SYS (strdup, char *, (char const *__s));
676*c33252afSJohn Marino # endif
677*c33252afSJohn Marino _GL_CXXALIASWARN (strdup);
678*c33252afSJohn Marino #elif defined GNULIB_POSIXCHECK
679*c33252afSJohn Marino # undef strdup
680*c33252afSJohn Marino # if HAVE_RAW_DECL_STRDUP
681*c33252afSJohn Marino _GL_WARN_ON_USE (strdup, "strdup is unportable - "
682*c33252afSJohn Marino                  "use gnulib module strdup for portability");
683*c33252afSJohn Marino # endif
684*c33252afSJohn Marino #endif
685*c33252afSJohn Marino 
686*c33252afSJohn Marino /* Append no more than N characters from SRC onto DEST.  */
687*c33252afSJohn Marino #if 0
688*c33252afSJohn Marino # if 0
689*c33252afSJohn Marino #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
690*c33252afSJohn Marino #   undef strncat
691*c33252afSJohn Marino #   define strncat rpl_strncat
692*c33252afSJohn Marino #  endif
693*c33252afSJohn Marino _GL_FUNCDECL_RPL (strncat, char *, (char *dest, const char *src, size_t n)
694*c33252afSJohn Marino                                    _GL_ARG_NONNULL ((1, 2)));
695*c33252afSJohn Marino _GL_CXXALIAS_RPL (strncat, char *, (char *dest, const char *src, size_t n));
696*c33252afSJohn Marino # else
697*c33252afSJohn Marino _GL_CXXALIAS_SYS (strncat, char *, (char *dest, const char *src, size_t n));
698*c33252afSJohn Marino # endif
699*c33252afSJohn Marino _GL_CXXALIASWARN (strncat);
700*c33252afSJohn Marino #elif defined GNULIB_POSIXCHECK
701*c33252afSJohn Marino # undef strncat
702*c33252afSJohn Marino # if HAVE_RAW_DECL_STRNCAT
703*c33252afSJohn Marino _GL_WARN_ON_USE (strncat, "strncat is unportable - "
704*c33252afSJohn Marino                  "use gnulib module strncat for portability");
705*c33252afSJohn Marino # endif
706*c33252afSJohn Marino #endif
707*c33252afSJohn Marino 
708*c33252afSJohn Marino /* Return a newly allocated copy of at most N bytes of STRING.  */
709*c33252afSJohn Marino #if 0
710*c33252afSJohn Marino # if 0
711*c33252afSJohn Marino #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
712*c33252afSJohn Marino #   undef strndup
713*c33252afSJohn Marino #   define strndup rpl_strndup
714*c33252afSJohn Marino #  endif
715*c33252afSJohn Marino _GL_FUNCDECL_RPL (strndup, char *, (char const *__string, size_t __n)
716*c33252afSJohn Marino                                    _GL_ARG_NONNULL ((1)));
717*c33252afSJohn Marino _GL_CXXALIAS_RPL (strndup, char *, (char const *__string, size_t __n));
718*c33252afSJohn Marino # else
719*c33252afSJohn Marino #  if ! 1
720*c33252afSJohn Marino _GL_FUNCDECL_SYS (strndup, char *, (char const *__string, size_t __n)
721*c33252afSJohn Marino                                    _GL_ARG_NONNULL ((1)));
722*c33252afSJohn Marino #  endif
723*c33252afSJohn Marino _GL_CXXALIAS_SYS (strndup, char *, (char const *__string, size_t __n));
724*c33252afSJohn Marino # endif
725*c33252afSJohn Marino _GL_CXXALIASWARN (strndup);
726*c33252afSJohn Marino #elif defined GNULIB_POSIXCHECK
727*c33252afSJohn Marino # undef strndup
728*c33252afSJohn Marino # if HAVE_RAW_DECL_STRNDUP
729*c33252afSJohn Marino _GL_WARN_ON_USE (strndup, "strndup is unportable - "
730*c33252afSJohn Marino                  "use gnulib module strndup for portability");
731*c33252afSJohn Marino # endif
732*c33252afSJohn Marino #endif
733*c33252afSJohn Marino 
734*c33252afSJohn Marino /* Find the length (number of bytes) of STRING, but scan at most
735*c33252afSJohn Marino    MAXLEN bytes.  If no '\0' terminator is found in that many bytes,
736*c33252afSJohn Marino    return MAXLEN.  */
737*c33252afSJohn Marino #if 0
738*c33252afSJohn Marino # if 0
739*c33252afSJohn Marino #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
740*c33252afSJohn Marino #   undef strnlen
741*c33252afSJohn Marino #   define strnlen rpl_strnlen
742*c33252afSJohn Marino #  endif
743*c33252afSJohn Marino _GL_FUNCDECL_RPL (strnlen, size_t, (char const *__string, size_t __maxlen)
744*c33252afSJohn Marino                                    _GL_ATTRIBUTE_PURE
745*c33252afSJohn Marino                                    _GL_ARG_NONNULL ((1)));
746*c33252afSJohn Marino _GL_CXXALIAS_RPL (strnlen, size_t, (char const *__string, size_t __maxlen));
747*c33252afSJohn Marino # else
748*c33252afSJohn Marino #  if ! 1
749*c33252afSJohn Marino _GL_FUNCDECL_SYS (strnlen, size_t, (char const *__string, size_t __maxlen)
750*c33252afSJohn Marino                                    _GL_ATTRIBUTE_PURE
751*c33252afSJohn Marino                                    _GL_ARG_NONNULL ((1)));
752*c33252afSJohn Marino #  endif
753*c33252afSJohn Marino _GL_CXXALIAS_SYS (strnlen, size_t, (char const *__string, size_t __maxlen));
754*c33252afSJohn Marino # endif
755*c33252afSJohn Marino _GL_CXXALIASWARN (strnlen);
756*c33252afSJohn Marino #elif defined GNULIB_POSIXCHECK
757*c33252afSJohn Marino # undef strnlen
758*c33252afSJohn Marino # if HAVE_RAW_DECL_STRNLEN
759*c33252afSJohn Marino _GL_WARN_ON_USE (strnlen, "strnlen is unportable - "
760*c33252afSJohn Marino                  "use gnulib module strnlen for portability");
761*c33252afSJohn Marino # endif
762*c33252afSJohn Marino #endif
763*c33252afSJohn Marino 
764*c33252afSJohn Marino #if defined GNULIB_POSIXCHECK
765*c33252afSJohn Marino /* strcspn() assumes the second argument is a list of single-byte characters.
766*c33252afSJohn Marino    Even in this simple case, it does not work with multibyte strings if the
767*c33252afSJohn Marino    locale encoding is GB18030 and one of the characters to be searched is a
768*c33252afSJohn Marino    digit.  */
769*c33252afSJohn Marino # undef strcspn
770*c33252afSJohn Marino /* Assume strcspn is always declared.  */
771*c33252afSJohn Marino _GL_WARN_ON_USE (strcspn, "strcspn cannot work correctly on character strings "
772*c33252afSJohn Marino                  "in multibyte locales - "
773*c33252afSJohn Marino                  "use mbscspn if you care about internationalization");
774*c33252afSJohn Marino #endif
775*c33252afSJohn Marino 
776*c33252afSJohn Marino /* Find the first occurrence in S of any character in ACCEPT.  */
777*c33252afSJohn Marino #if 0
778*c33252afSJohn Marino # if ! 1
779*c33252afSJohn Marino _GL_FUNCDECL_SYS (strpbrk, char *, (char const *__s, char const *__accept)
780*c33252afSJohn Marino                                    _GL_ATTRIBUTE_PURE
781*c33252afSJohn Marino                                    _GL_ARG_NONNULL ((1, 2)));
782*c33252afSJohn Marino # endif
783*c33252afSJohn Marino   /* On some systems, this function is defined as an overloaded function:
784*c33252afSJohn Marino        extern "C" { const char * strpbrk (const char *, const char *); }
785*c33252afSJohn Marino        extern "C++" { char * strpbrk (char *, const char *); }  */
786*c33252afSJohn Marino _GL_CXXALIAS_SYS_CAST2 (strpbrk,
787*c33252afSJohn Marino                         char *, (char const *__s, char const *__accept),
788*c33252afSJohn Marino                         const char *, (char const *__s, char const *__accept));
789*c33252afSJohn Marino # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
790*c33252afSJohn Marino      && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
791*c33252afSJohn Marino _GL_CXXALIASWARN1 (strpbrk, char *, (char *__s, char const *__accept));
792*c33252afSJohn Marino _GL_CXXALIASWARN1 (strpbrk, char const *,
793*c33252afSJohn Marino                    (char const *__s, char const *__accept));
794*c33252afSJohn Marino # else
795*c33252afSJohn Marino _GL_CXXALIASWARN (strpbrk);
796*c33252afSJohn Marino # endif
797*c33252afSJohn Marino # if defined GNULIB_POSIXCHECK
798*c33252afSJohn Marino /* strpbrk() assumes the second argument is a list of single-byte characters.
799*c33252afSJohn Marino    Even in this simple case, it does not work with multibyte strings if the
800*c33252afSJohn Marino    locale encoding is GB18030 and one of the characters to be searched is a
801*c33252afSJohn Marino    digit.  */
802*c33252afSJohn Marino #  undef strpbrk
803*c33252afSJohn Marino _GL_WARN_ON_USE (strpbrk, "strpbrk cannot work correctly on character strings "
804*c33252afSJohn Marino                  "in multibyte locales - "
805*c33252afSJohn Marino                  "use mbspbrk if you care about internationalization");
806*c33252afSJohn Marino # endif
807*c33252afSJohn Marino #elif defined GNULIB_POSIXCHECK
808*c33252afSJohn Marino # undef strpbrk
809*c33252afSJohn Marino # if HAVE_RAW_DECL_STRPBRK
810*c33252afSJohn Marino _GL_WARN_ON_USE (strpbrk, "strpbrk is unportable - "
811*c33252afSJohn Marino                  "use gnulib module strpbrk for portability");
812*c33252afSJohn Marino # endif
813*c33252afSJohn Marino #endif
814*c33252afSJohn Marino 
815*c33252afSJohn Marino #if defined GNULIB_POSIXCHECK
816*c33252afSJohn Marino /* strspn() assumes the second argument is a list of single-byte characters.
817*c33252afSJohn Marino    Even in this simple case, it cannot work with multibyte strings.  */
818*c33252afSJohn Marino # undef strspn
819*c33252afSJohn Marino /* Assume strspn is always declared.  */
820*c33252afSJohn Marino _GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings "
821*c33252afSJohn Marino                  "in multibyte locales - "
822*c33252afSJohn Marino                  "use mbsspn if you care about internationalization");
823*c33252afSJohn Marino #endif
824*c33252afSJohn Marino 
825*c33252afSJohn Marino #if defined GNULIB_POSIXCHECK
826*c33252afSJohn Marino /* strrchr() does not work with multibyte strings if the locale encoding is
827*c33252afSJohn Marino    GB18030 and the character to be searched is a digit.  */
828*c33252afSJohn Marino # undef strrchr
829*c33252afSJohn Marino /* Assume strrchr is always declared.  */
830*c33252afSJohn Marino _GL_WARN_ON_USE (strrchr, "strrchr cannot work correctly on character strings "
831*c33252afSJohn Marino                  "in some multibyte locales - "
832*c33252afSJohn Marino                  "use mbsrchr if you care about internationalization");
833*c33252afSJohn Marino #endif
834*c33252afSJohn Marino 
835*c33252afSJohn Marino /* Search the next delimiter (char listed in DELIM) starting at *STRINGP.
836*c33252afSJohn Marino    If one is found, overwrite it with a NUL, and advance *STRINGP
837*c33252afSJohn Marino    to point to the next char after it.  Otherwise, set *STRINGP to NULL.
838*c33252afSJohn Marino    If *STRINGP was already NULL, nothing happens.
839*c33252afSJohn Marino    Return the old value of *STRINGP.
840*c33252afSJohn Marino 
841*c33252afSJohn Marino    This is a variant of strtok() that is multithread-safe and supports
842*c33252afSJohn Marino    empty fields.
843*c33252afSJohn Marino 
844*c33252afSJohn Marino    Caveat: It modifies the original string.
845*c33252afSJohn Marino    Caveat: These functions cannot be used on constant strings.
846*c33252afSJohn Marino    Caveat: The identity of the delimiting character is lost.
847*c33252afSJohn Marino    Caveat: It doesn't work with multibyte strings unless all of the delimiter
848*c33252afSJohn Marino            characters are ASCII characters < 0x30.
849*c33252afSJohn Marino 
850*c33252afSJohn Marino    See also strtok_r().  */
851*c33252afSJohn Marino #if 0
852*c33252afSJohn Marino # if ! 1
853*c33252afSJohn Marino _GL_FUNCDECL_SYS (strsep, char *,
854*c33252afSJohn Marino                   (char **restrict __stringp, char const *restrict __delim)
855*c33252afSJohn Marino                   _GL_ARG_NONNULL ((1, 2)));
856*c33252afSJohn Marino # endif
857*c33252afSJohn Marino _GL_CXXALIAS_SYS (strsep, char *,
858*c33252afSJohn Marino                   (char **restrict __stringp, char const *restrict __delim));
859*c33252afSJohn Marino _GL_CXXALIASWARN (strsep);
860*c33252afSJohn Marino # if defined GNULIB_POSIXCHECK
861*c33252afSJohn Marino #  undef strsep
862*c33252afSJohn Marino _GL_WARN_ON_USE (strsep, "strsep cannot work correctly on character strings "
863*c33252afSJohn Marino                  "in multibyte locales - "
864*c33252afSJohn Marino                  "use mbssep if you care about internationalization");
865*c33252afSJohn Marino # endif
866*c33252afSJohn Marino #elif defined GNULIB_POSIXCHECK
867*c33252afSJohn Marino # undef strsep
868*c33252afSJohn Marino # if HAVE_RAW_DECL_STRSEP
869*c33252afSJohn Marino _GL_WARN_ON_USE (strsep, "strsep is unportable - "
870*c33252afSJohn Marino                  "use gnulib module strsep for portability");
871*c33252afSJohn Marino # endif
872*c33252afSJohn Marino #endif
873*c33252afSJohn Marino 
874*c33252afSJohn Marino #if 0
875*c33252afSJohn Marino # if 0
876*c33252afSJohn Marino #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
877*c33252afSJohn Marino #   define strstr rpl_strstr
878*c33252afSJohn Marino #  endif
879*c33252afSJohn Marino _GL_FUNCDECL_RPL (strstr, char *, (const char *haystack, const char *needle)
880*c33252afSJohn Marino                                   _GL_ATTRIBUTE_PURE
881*c33252afSJohn Marino                                   _GL_ARG_NONNULL ((1, 2)));
882*c33252afSJohn Marino _GL_CXXALIAS_RPL (strstr, char *, (const char *haystack, const char *needle));
883*c33252afSJohn Marino # else
884*c33252afSJohn Marino   /* On some systems, this function is defined as an overloaded function:
885*c33252afSJohn Marino        extern "C++" { const char * strstr (const char *, const char *); }
886*c33252afSJohn Marino        extern "C++" { char * strstr (char *, const char *); }  */
887*c33252afSJohn Marino _GL_CXXALIAS_SYS_CAST2 (strstr,
888*c33252afSJohn Marino                         char *, (const char *haystack, const char *needle),
889*c33252afSJohn Marino                         const char *, (const char *haystack, const char *needle));
890*c33252afSJohn Marino # endif
891*c33252afSJohn Marino # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
892*c33252afSJohn Marino      && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
893*c33252afSJohn Marino _GL_CXXALIASWARN1 (strstr, char *, (char *haystack, const char *needle));
894*c33252afSJohn Marino _GL_CXXALIASWARN1 (strstr, const char *,
895*c33252afSJohn Marino                    (const char *haystack, const char *needle));
896*c33252afSJohn Marino # else
897*c33252afSJohn Marino _GL_CXXALIASWARN (strstr);
898*c33252afSJohn Marino # endif
899*c33252afSJohn Marino #elif defined GNULIB_POSIXCHECK
900*c33252afSJohn Marino /* strstr() does not work with multibyte strings if the locale encoding is
901*c33252afSJohn Marino    different from UTF-8:
902*c33252afSJohn Marino    POSIX says that it operates on "strings", and "string" in POSIX is defined
903*c33252afSJohn Marino    as a sequence of bytes, not of characters.  */
904*c33252afSJohn Marino # undef strstr
905*c33252afSJohn Marino /* Assume strstr is always declared.  */
906*c33252afSJohn Marino _GL_WARN_ON_USE (strstr, "strstr is quadratic on many systems, and cannot "
907*c33252afSJohn Marino                  "work correctly on character strings in most "
908*c33252afSJohn Marino                  "multibyte locales - "
909*c33252afSJohn Marino                  "use mbsstr if you care about internationalization, "
910*c33252afSJohn Marino                  "or use strstr if you care about speed");
911*c33252afSJohn Marino #endif
912*c33252afSJohn Marino 
913*c33252afSJohn Marino /* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive
914*c33252afSJohn Marino    comparison.  */
915*c33252afSJohn Marino #if 0
916*c33252afSJohn Marino # if 0
917*c33252afSJohn Marino #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
918*c33252afSJohn Marino #   define strcasestr rpl_strcasestr
919*c33252afSJohn Marino #  endif
920*c33252afSJohn Marino _GL_FUNCDECL_RPL (strcasestr, char *,
921*c33252afSJohn Marino                   (const char *haystack, const char *needle)
922*c33252afSJohn Marino                   _GL_ATTRIBUTE_PURE
923*c33252afSJohn Marino                   _GL_ARG_NONNULL ((1, 2)));
924*c33252afSJohn Marino _GL_CXXALIAS_RPL (strcasestr, char *,
925*c33252afSJohn Marino                   (const char *haystack, const char *needle));
926*c33252afSJohn Marino # else
927*c33252afSJohn Marino #  if ! 1
928*c33252afSJohn Marino _GL_FUNCDECL_SYS (strcasestr, char *,
929*c33252afSJohn Marino                   (const char *haystack, const char *needle)
930*c33252afSJohn Marino                   _GL_ATTRIBUTE_PURE
931*c33252afSJohn Marino                   _GL_ARG_NONNULL ((1, 2)));
932*c33252afSJohn Marino #  endif
933*c33252afSJohn Marino   /* On some systems, this function is defined as an overloaded function:
934*c33252afSJohn Marino        extern "C++" { const char * strcasestr (const char *, const char *); }
935*c33252afSJohn Marino        extern "C++" { char * strcasestr (char *, const char *); }  */
936*c33252afSJohn Marino _GL_CXXALIAS_SYS_CAST2 (strcasestr,
937*c33252afSJohn Marino                         char *, (const char *haystack, const char *needle),
938*c33252afSJohn Marino                         const char *, (const char *haystack, const char *needle));
939*c33252afSJohn Marino # endif
940*c33252afSJohn Marino # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
941*c33252afSJohn Marino      && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
942*c33252afSJohn Marino _GL_CXXALIASWARN1 (strcasestr, char *, (char *haystack, const char *needle));
943*c33252afSJohn Marino _GL_CXXALIASWARN1 (strcasestr, const char *,
944*c33252afSJohn Marino                    (const char *haystack, const char *needle));
945*c33252afSJohn Marino # else
946*c33252afSJohn Marino _GL_CXXALIASWARN (strcasestr);
947*c33252afSJohn Marino # endif
948*c33252afSJohn Marino #elif defined GNULIB_POSIXCHECK
949*c33252afSJohn Marino /* strcasestr() does not work with multibyte strings:
950*c33252afSJohn Marino    It is a glibc extension, and glibc implements it only for unibyte
951*c33252afSJohn Marino    locales.  */
952*c33252afSJohn Marino # undef strcasestr
953*c33252afSJohn Marino # if HAVE_RAW_DECL_STRCASESTR
954*c33252afSJohn Marino _GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character "
955*c33252afSJohn Marino                  "strings in multibyte locales - "
956*c33252afSJohn Marino                  "use mbscasestr if you care about "
957*c33252afSJohn Marino                  "internationalization, or use c-strcasestr if you want "
958*c33252afSJohn Marino                  "a locale independent function");
959*c33252afSJohn Marino # endif
960*c33252afSJohn Marino #endif
961*c33252afSJohn Marino 
962*c33252afSJohn Marino /* Parse S into tokens separated by characters in DELIM.
963*c33252afSJohn Marino    If S is NULL, the saved pointer in SAVE_PTR is used as
964*c33252afSJohn Marino    the next starting point.  For example:
965*c33252afSJohn Marino         char s[] = "-abc-=-def";
966*c33252afSJohn Marino         char *sp;
967*c33252afSJohn Marino         x = strtok_r(s, "-", &sp);      // x = "abc", sp = "=-def"
968*c33252afSJohn Marino         x = strtok_r(NULL, "-=", &sp);  // x = "def", sp = NULL
969*c33252afSJohn Marino         x = strtok_r(NULL, "=", &sp);   // x = NULL
970*c33252afSJohn Marino                 // s = "abc\0-def\0"
971*c33252afSJohn Marino 
972*c33252afSJohn Marino    This is a variant of strtok() that is multithread-safe.
973*c33252afSJohn Marino 
974*c33252afSJohn Marino    For the POSIX documentation for this function, see:
975*c33252afSJohn Marino    http://www.opengroup.org/susv3xsh/strtok.html
976*c33252afSJohn Marino 
977*c33252afSJohn Marino    Caveat: It modifies the original string.
978*c33252afSJohn Marino    Caveat: These functions cannot be used on constant strings.
979*c33252afSJohn Marino    Caveat: The identity of the delimiting character is lost.
980*c33252afSJohn Marino    Caveat: It doesn't work with multibyte strings unless all of the delimiter
981*c33252afSJohn Marino            characters are ASCII characters < 0x30.
982*c33252afSJohn Marino 
983*c33252afSJohn Marino    See also strsep().  */
984*c33252afSJohn Marino #if 0
985*c33252afSJohn Marino # if 0
986*c33252afSJohn Marino #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
987*c33252afSJohn Marino #   undef strtok_r
988*c33252afSJohn Marino #   define strtok_r rpl_strtok_r
989*c33252afSJohn Marino #  endif
990*c33252afSJohn Marino _GL_FUNCDECL_RPL (strtok_r, char *,
991*c33252afSJohn Marino                   (char *restrict s, char const *restrict delim,
992*c33252afSJohn Marino                    char **restrict save_ptr)
993*c33252afSJohn Marino                   _GL_ARG_NONNULL ((2, 3)));
994*c33252afSJohn Marino _GL_CXXALIAS_RPL (strtok_r, char *,
995*c33252afSJohn Marino                   (char *restrict s, char const *restrict delim,
996*c33252afSJohn Marino                    char **restrict save_ptr));
997*c33252afSJohn Marino # else
998*c33252afSJohn Marino #  if 0 || defined GNULIB_POSIXCHECK
999*c33252afSJohn Marino #   undef strtok_r
1000*c33252afSJohn Marino #  endif
1001*c33252afSJohn Marino #  if ! 1
1002*c33252afSJohn Marino _GL_FUNCDECL_SYS (strtok_r, char *,
1003*c33252afSJohn Marino                   (char *restrict s, char const *restrict delim,
1004*c33252afSJohn Marino                    char **restrict save_ptr)
1005*c33252afSJohn Marino                   _GL_ARG_NONNULL ((2, 3)));
1006*c33252afSJohn Marino #  endif
1007*c33252afSJohn Marino _GL_CXXALIAS_SYS (strtok_r, char *,
1008*c33252afSJohn Marino                   (char *restrict s, char const *restrict delim,
1009*c33252afSJohn Marino                    char **restrict save_ptr));
1010*c33252afSJohn Marino # endif
1011*c33252afSJohn Marino _GL_CXXALIASWARN (strtok_r);
1012*c33252afSJohn Marino # if defined GNULIB_POSIXCHECK
1013*c33252afSJohn Marino _GL_WARN_ON_USE (strtok_r, "strtok_r cannot work correctly on character "
1014*c33252afSJohn Marino                  "strings in multibyte locales - "
1015*c33252afSJohn Marino                  "use mbstok_r if you care about internationalization");
1016*c33252afSJohn Marino # endif
1017*c33252afSJohn Marino #elif defined GNULIB_POSIXCHECK
1018*c33252afSJohn Marino # undef strtok_r
1019*c33252afSJohn Marino # if HAVE_RAW_DECL_STRTOK_R
1020*c33252afSJohn Marino _GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - "
1021*c33252afSJohn Marino                  "use gnulib module strtok_r for portability");
1022*c33252afSJohn Marino # endif
1023*c33252afSJohn Marino #endif
1024*c33252afSJohn Marino 
1025*c33252afSJohn Marino 
1026*c33252afSJohn Marino /* The following functions are not specified by POSIX.  They are gnulib
1027*c33252afSJohn Marino    extensions.  */
1028*c33252afSJohn Marino 
1029*c33252afSJohn Marino #if 0
1030*c33252afSJohn Marino /* Return the number of multibyte characters in the character string STRING.
1031*c33252afSJohn Marino    This considers multibyte characters, unlike strlen, which counts bytes.  */
1032*c33252afSJohn Marino # ifdef __MirBSD__  /* MirBSD defines mbslen as a macro.  Override it.  */
1033*c33252afSJohn Marino #  undef mbslen
1034*c33252afSJohn Marino # endif
1035*c33252afSJohn Marino # if 0  /* AIX, OSF/1, MirBSD define mbslen already in libc.  */
1036*c33252afSJohn Marino #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1037*c33252afSJohn Marino #   define mbslen rpl_mbslen
1038*c33252afSJohn Marino #  endif
1039*c33252afSJohn Marino _GL_FUNCDECL_RPL (mbslen, size_t, (const char *string)
1040*c33252afSJohn Marino                                   _GL_ATTRIBUTE_PURE
1041*c33252afSJohn Marino                                   _GL_ARG_NONNULL ((1)));
1042*c33252afSJohn Marino _GL_CXXALIAS_RPL (mbslen, size_t, (const char *string));
1043*c33252afSJohn Marino # else
1044*c33252afSJohn Marino _GL_FUNCDECL_SYS (mbslen, size_t, (const char *string)
1045*c33252afSJohn Marino                                   _GL_ATTRIBUTE_PURE
1046*c33252afSJohn Marino                                   _GL_ARG_NONNULL ((1)));
1047*c33252afSJohn Marino _GL_CXXALIAS_SYS (mbslen, size_t, (const char *string));
1048*c33252afSJohn Marino # endif
1049*c33252afSJohn Marino _GL_CXXALIASWARN (mbslen);
1050*c33252afSJohn Marino #endif
1051*c33252afSJohn Marino 
1052*c33252afSJohn Marino #if 0
1053*c33252afSJohn Marino /* Return the number of multibyte characters in the character string starting
1054*c33252afSJohn Marino    at STRING and ending at STRING + LEN.  */
1055*c33252afSJohn Marino _GL_EXTERN_C size_t mbsnlen (const char *string, size_t len)
1056*c33252afSJohn Marino      _GL_ATTRIBUTE_PURE
1057*c33252afSJohn Marino      _GL_ARG_NONNULL ((1));
1058*c33252afSJohn Marino #endif
1059*c33252afSJohn Marino 
1060*c33252afSJohn Marino #if 0
1061*c33252afSJohn Marino /* Locate the first single-byte character C in the character string STRING,
1062*c33252afSJohn Marino    and return a pointer to it.  Return NULL if C is not found in STRING.
1063*c33252afSJohn Marino    Unlike strchr(), this function works correctly in multibyte locales with
1064*c33252afSJohn Marino    encodings such as GB18030.  */
1065*c33252afSJohn Marino # if defined __hpux
1066*c33252afSJohn Marino #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1067*c33252afSJohn Marino #   define mbschr rpl_mbschr /* avoid collision with HP-UX function */
1068*c33252afSJohn Marino #  endif
1069*c33252afSJohn Marino _GL_FUNCDECL_RPL (mbschr, char *, (const char *string, int c)
1070*c33252afSJohn Marino                                   _GL_ATTRIBUTE_PURE
1071*c33252afSJohn Marino                                   _GL_ARG_NONNULL ((1)));
1072*c33252afSJohn Marino _GL_CXXALIAS_RPL (mbschr, char *, (const char *string, int c));
1073*c33252afSJohn Marino # else
1074*c33252afSJohn Marino _GL_FUNCDECL_SYS (mbschr, char *, (const char *string, int c)
1075*c33252afSJohn Marino                                   _GL_ATTRIBUTE_PURE
1076*c33252afSJohn Marino                                   _GL_ARG_NONNULL ((1)));
1077*c33252afSJohn Marino _GL_CXXALIAS_SYS (mbschr, char *, (const char *string, int c));
1078*c33252afSJohn Marino # endif
1079*c33252afSJohn Marino _GL_CXXALIASWARN (mbschr);
1080*c33252afSJohn Marino #endif
1081*c33252afSJohn Marino 
1082*c33252afSJohn Marino #if 0
1083*c33252afSJohn Marino /* Locate the last single-byte character C in the character string STRING,
1084*c33252afSJohn Marino    and return a pointer to it.  Return NULL if C is not found in STRING.
1085*c33252afSJohn Marino    Unlike strrchr(), this function works correctly in multibyte locales with
1086*c33252afSJohn Marino    encodings such as GB18030.  */
1087*c33252afSJohn Marino # if defined __hpux || defined __INTERIX
1088*c33252afSJohn Marino #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1089*c33252afSJohn Marino #   define mbsrchr rpl_mbsrchr /* avoid collision with system function */
1090*c33252afSJohn Marino #  endif
1091*c33252afSJohn Marino _GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c)
1092*c33252afSJohn Marino                                    _GL_ATTRIBUTE_PURE
1093*c33252afSJohn Marino                                    _GL_ARG_NONNULL ((1)));
1094*c33252afSJohn Marino _GL_CXXALIAS_RPL (mbsrchr, char *, (const char *string, int c));
1095*c33252afSJohn Marino # else
1096*c33252afSJohn Marino _GL_FUNCDECL_SYS (mbsrchr, char *, (const char *string, int c)
1097*c33252afSJohn Marino                                    _GL_ATTRIBUTE_PURE
1098*c33252afSJohn Marino                                    _GL_ARG_NONNULL ((1)));
1099*c33252afSJohn Marino _GL_CXXALIAS_SYS (mbsrchr, char *, (const char *string, int c));
1100*c33252afSJohn Marino # endif
1101*c33252afSJohn Marino _GL_CXXALIASWARN (mbsrchr);
1102*c33252afSJohn Marino #endif
1103*c33252afSJohn Marino 
1104*c33252afSJohn Marino #if 0
1105*c33252afSJohn Marino /* Find the first occurrence of the character string NEEDLE in the character
1106*c33252afSJohn Marino    string HAYSTACK.  Return NULL if NEEDLE is not found in HAYSTACK.
1107*c33252afSJohn Marino    Unlike strstr(), this function works correctly in multibyte locales with
1108*c33252afSJohn Marino    encodings different from UTF-8.  */
1109*c33252afSJohn Marino _GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle)
1110*c33252afSJohn Marino      _GL_ATTRIBUTE_PURE
1111*c33252afSJohn Marino      _GL_ARG_NONNULL ((1, 2));
1112*c33252afSJohn Marino #endif
1113*c33252afSJohn Marino 
1114*c33252afSJohn Marino #if 0
1115*c33252afSJohn Marino /* Compare the character strings S1 and S2, ignoring case, returning less than,
1116*c33252afSJohn Marino    equal to or greater than zero if S1 is lexicographically less than, equal to
1117*c33252afSJohn Marino    or greater than S2.
1118*c33252afSJohn Marino    Note: This function may, in multibyte locales, return 0 for strings of
1119*c33252afSJohn Marino    different lengths!
1120*c33252afSJohn Marino    Unlike strcasecmp(), this function works correctly in multibyte locales.  */
1121*c33252afSJohn Marino _GL_EXTERN_C int mbscasecmp (const char *s1, const char *s2)
1122*c33252afSJohn Marino      _GL_ATTRIBUTE_PURE
1123*c33252afSJohn Marino      _GL_ARG_NONNULL ((1, 2));
1124*c33252afSJohn Marino #endif
1125*c33252afSJohn Marino 
1126*c33252afSJohn Marino #if 0
1127*c33252afSJohn Marino /* Compare the initial segment of the character string S1 consisting of at most
1128*c33252afSJohn Marino    N characters with the initial segment of the character string S2 consisting
1129*c33252afSJohn Marino    of at most N characters, ignoring case, returning less than, equal to or
1130*c33252afSJohn Marino    greater than zero if the initial segment of S1 is lexicographically less
1131*c33252afSJohn Marino    than, equal to or greater than the initial segment of S2.
1132*c33252afSJohn Marino    Note: This function may, in multibyte locales, return 0 for initial segments
1133*c33252afSJohn Marino    of different lengths!
1134*c33252afSJohn Marino    Unlike strncasecmp(), this function works correctly in multibyte locales.
1135*c33252afSJohn Marino    But beware that N is not a byte count but a character count!  */
1136*c33252afSJohn Marino _GL_EXTERN_C int mbsncasecmp (const char *s1, const char *s2, size_t n)
1137*c33252afSJohn Marino      _GL_ATTRIBUTE_PURE
1138*c33252afSJohn Marino      _GL_ARG_NONNULL ((1, 2));
1139*c33252afSJohn Marino #endif
1140*c33252afSJohn Marino 
1141*c33252afSJohn Marino #if 0
1142*c33252afSJohn Marino /* Compare the initial segment of the character string STRING consisting of
1143*c33252afSJohn Marino    at most mbslen (PREFIX) characters with the character string PREFIX,
1144*c33252afSJohn Marino    ignoring case.  If the two match, return a pointer to the first byte
1145*c33252afSJohn Marino    after this prefix in STRING.  Otherwise, return NULL.
1146*c33252afSJohn Marino    Note: This function may, in multibyte locales, return non-NULL if STRING
1147*c33252afSJohn Marino    is of smaller length than PREFIX!
1148*c33252afSJohn Marino    Unlike strncasecmp(), this function works correctly in multibyte
1149*c33252afSJohn Marino    locales.  */
1150*c33252afSJohn Marino _GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix)
1151*c33252afSJohn Marino      _GL_ATTRIBUTE_PURE
1152*c33252afSJohn Marino      _GL_ARG_NONNULL ((1, 2));
1153*c33252afSJohn Marino #endif
1154*c33252afSJohn Marino 
1155*c33252afSJohn Marino #if 0
1156*c33252afSJohn Marino /* Find the first occurrence of the character string NEEDLE in the character
1157*c33252afSJohn Marino    string HAYSTACK, using case-insensitive comparison.
1158*c33252afSJohn Marino    Note: This function may, in multibyte locales, return success even if
1159*c33252afSJohn Marino    strlen (haystack) < strlen (needle) !
1160*c33252afSJohn Marino    Unlike strcasestr(), this function works correctly in multibyte locales.  */
1161*c33252afSJohn Marino _GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle)
1162*c33252afSJohn Marino      _GL_ATTRIBUTE_PURE
1163*c33252afSJohn Marino      _GL_ARG_NONNULL ((1, 2));
1164*c33252afSJohn Marino #endif
1165*c33252afSJohn Marino 
1166*c33252afSJohn Marino #if 0
1167*c33252afSJohn Marino /* Find the first occurrence in the character string STRING of any character
1168*c33252afSJohn Marino    in the character string ACCEPT.  Return the number of bytes from the
1169*c33252afSJohn Marino    beginning of the string to this occurrence, or to the end of the string
1170*c33252afSJohn Marino    if none exists.
1171*c33252afSJohn Marino    Unlike strcspn(), this function works correctly in multibyte locales.  */
1172*c33252afSJohn Marino _GL_EXTERN_C size_t mbscspn (const char *string, const char *accept)
1173*c33252afSJohn Marino      _GL_ATTRIBUTE_PURE
1174*c33252afSJohn Marino      _GL_ARG_NONNULL ((1, 2));
1175*c33252afSJohn Marino #endif
1176*c33252afSJohn Marino 
1177*c33252afSJohn Marino #if 0
1178*c33252afSJohn Marino /* Find the first occurrence in the character string STRING of any character
1179*c33252afSJohn Marino    in the character string ACCEPT.  Return the pointer to it, or NULL if none
1180*c33252afSJohn Marino    exists.
1181*c33252afSJohn Marino    Unlike strpbrk(), this function works correctly in multibyte locales.  */
1182*c33252afSJohn Marino # if defined __hpux
1183*c33252afSJohn Marino #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1184*c33252afSJohn Marino #   define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */
1185*c33252afSJohn Marino #  endif
1186*c33252afSJohn Marino _GL_FUNCDECL_RPL (mbspbrk, char *, (const char *string, const char *accept)
1187*c33252afSJohn Marino                                    _GL_ATTRIBUTE_PURE
1188*c33252afSJohn Marino                                    _GL_ARG_NONNULL ((1, 2)));
1189*c33252afSJohn Marino _GL_CXXALIAS_RPL (mbspbrk, char *, (const char *string, const char *accept));
1190*c33252afSJohn Marino # else
1191*c33252afSJohn Marino _GL_FUNCDECL_SYS (mbspbrk, char *, (const char *string, const char *accept)
1192*c33252afSJohn Marino                                    _GL_ATTRIBUTE_PURE
1193*c33252afSJohn Marino                                    _GL_ARG_NONNULL ((1, 2)));
1194*c33252afSJohn Marino _GL_CXXALIAS_SYS (mbspbrk, char *, (const char *string, const char *accept));
1195*c33252afSJohn Marino # endif
1196*c33252afSJohn Marino _GL_CXXALIASWARN (mbspbrk);
1197*c33252afSJohn Marino #endif
1198*c33252afSJohn Marino 
1199*c33252afSJohn Marino #if 0
1200*c33252afSJohn Marino /* Find the first occurrence in the character string STRING of any character
1201*c33252afSJohn Marino    not in the character string REJECT.  Return the number of bytes from the
1202*c33252afSJohn Marino    beginning of the string to this occurrence, or to the end of the string
1203*c33252afSJohn Marino    if none exists.
1204*c33252afSJohn Marino    Unlike strspn(), this function works correctly in multibyte locales.  */
1205*c33252afSJohn Marino _GL_EXTERN_C size_t mbsspn (const char *string, const char *reject)
1206*c33252afSJohn Marino      _GL_ATTRIBUTE_PURE
1207*c33252afSJohn Marino      _GL_ARG_NONNULL ((1, 2));
1208*c33252afSJohn Marino #endif
1209*c33252afSJohn Marino 
1210*c33252afSJohn Marino #if 0
1211*c33252afSJohn Marino /* Search the next delimiter (multibyte character listed in the character
1212*c33252afSJohn Marino    string DELIM) starting at the character string *STRINGP.
1213*c33252afSJohn Marino    If one is found, overwrite it with a NUL, and advance *STRINGP to point
1214*c33252afSJohn Marino    to the next multibyte character after it.  Otherwise, set *STRINGP to NULL.
1215*c33252afSJohn Marino    If *STRINGP was already NULL, nothing happens.
1216*c33252afSJohn Marino    Return the old value of *STRINGP.
1217*c33252afSJohn Marino 
1218*c33252afSJohn Marino    This is a variant of mbstok_r() that supports empty fields.
1219*c33252afSJohn Marino 
1220*c33252afSJohn Marino    Caveat: It modifies the original string.
1221*c33252afSJohn Marino    Caveat: These functions cannot be used on constant strings.
1222*c33252afSJohn Marino    Caveat: The identity of the delimiting character is lost.
1223*c33252afSJohn Marino 
1224*c33252afSJohn Marino    See also mbstok_r().  */
1225*c33252afSJohn Marino _GL_EXTERN_C char * mbssep (char **stringp, const char *delim)
1226*c33252afSJohn Marino      _GL_ARG_NONNULL ((1, 2));
1227*c33252afSJohn Marino #endif
1228*c33252afSJohn Marino 
1229*c33252afSJohn Marino #if 0
1230*c33252afSJohn Marino /* Parse the character string STRING into tokens separated by characters in
1231*c33252afSJohn Marino    the character string DELIM.
1232*c33252afSJohn Marino    If STRING is NULL, the saved pointer in SAVE_PTR is used as
1233*c33252afSJohn Marino    the next starting point.  For example:
1234*c33252afSJohn Marino         char s[] = "-abc-=-def";
1235*c33252afSJohn Marino         char *sp;
1236*c33252afSJohn Marino         x = mbstok_r(s, "-", &sp);      // x = "abc", sp = "=-def"
1237*c33252afSJohn Marino         x = mbstok_r(NULL, "-=", &sp);  // x = "def", sp = NULL
1238*c33252afSJohn Marino         x = mbstok_r(NULL, "=", &sp);   // x = NULL
1239*c33252afSJohn Marino                 // s = "abc\0-def\0"
1240*c33252afSJohn Marino 
1241*c33252afSJohn Marino    Caveat: It modifies the original string.
1242*c33252afSJohn Marino    Caveat: These functions cannot be used on constant strings.
1243*c33252afSJohn Marino    Caveat: The identity of the delimiting character is lost.
1244*c33252afSJohn Marino 
1245*c33252afSJohn Marino    See also mbssep().  */
1246*c33252afSJohn Marino _GL_EXTERN_C char * mbstok_r (char *string, const char *delim, char **save_ptr)
1247*c33252afSJohn Marino      _GL_ARG_NONNULL ((2, 3));
1248*c33252afSJohn Marino #endif
1249*c33252afSJohn Marino 
1250*c33252afSJohn Marino /* Map any int, typically from errno, into an error message.  */
1251*c33252afSJohn Marino #if 0
1252*c33252afSJohn Marino # if 0
1253*c33252afSJohn Marino #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1254*c33252afSJohn Marino #   undef strerror
1255*c33252afSJohn Marino #   define strerror rpl_strerror
1256*c33252afSJohn Marino #  endif
1257*c33252afSJohn Marino _GL_FUNCDECL_RPL (strerror, char *, (int));
1258*c33252afSJohn Marino _GL_CXXALIAS_RPL (strerror, char *, (int));
1259*c33252afSJohn Marino # else
1260*c33252afSJohn Marino _GL_CXXALIAS_SYS (strerror, char *, (int));
1261*c33252afSJohn Marino # endif
1262*c33252afSJohn Marino _GL_CXXALIASWARN (strerror);
1263*c33252afSJohn Marino #elif defined GNULIB_POSIXCHECK
1264*c33252afSJohn Marino # undef strerror
1265*c33252afSJohn Marino /* Assume strerror is always declared.  */
1266*c33252afSJohn Marino _GL_WARN_ON_USE (strerror, "strerror is unportable - "
1267*c33252afSJohn Marino                  "use gnulib module strerror to guarantee non-NULL result");
1268*c33252afSJohn Marino #endif
1269*c33252afSJohn Marino 
1270*c33252afSJohn Marino /* Map any int, typically from errno, into an error message.  Multithread-safe.
1271*c33252afSJohn Marino    Uses the POSIX declaration, not the glibc declaration.  */
1272*c33252afSJohn Marino #if 0
1273*c33252afSJohn Marino # if 0
1274*c33252afSJohn Marino #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1275*c33252afSJohn Marino #   undef strerror_r
1276*c33252afSJohn Marino #   define strerror_r rpl_strerror_r
1277*c33252afSJohn Marino #  endif
1278*c33252afSJohn Marino _GL_FUNCDECL_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen)
1279*c33252afSJohn Marino                                    _GL_ARG_NONNULL ((2)));
1280*c33252afSJohn Marino _GL_CXXALIAS_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen));
1281*c33252afSJohn Marino # else
1282*c33252afSJohn Marino #  if !1
1283*c33252afSJohn Marino _GL_FUNCDECL_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen)
1284*c33252afSJohn Marino                                    _GL_ARG_NONNULL ((2)));
1285*c33252afSJohn Marino #  endif
1286*c33252afSJohn Marino _GL_CXXALIAS_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen));
1287*c33252afSJohn Marino # endif
1288*c33252afSJohn Marino # if 1
1289*c33252afSJohn Marino _GL_CXXALIASWARN (strerror_r);
1290*c33252afSJohn Marino # endif
1291*c33252afSJohn Marino #elif defined GNULIB_POSIXCHECK
1292*c33252afSJohn Marino # undef strerror_r
1293*c33252afSJohn Marino # if HAVE_RAW_DECL_STRERROR_R
1294*c33252afSJohn Marino _GL_WARN_ON_USE (strerror_r, "strerror_r is unportable - "
1295*c33252afSJohn Marino                  "use gnulib module strerror_r-posix for portability");
1296*c33252afSJohn Marino # endif
1297*c33252afSJohn Marino #endif
1298*c33252afSJohn Marino 
1299*c33252afSJohn Marino #if 0
1300*c33252afSJohn Marino # if 0
1301*c33252afSJohn Marino #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1302*c33252afSJohn Marino #   define strsignal rpl_strsignal
1303*c33252afSJohn Marino #  endif
1304*c33252afSJohn Marino _GL_FUNCDECL_RPL (strsignal, char *, (int __sig));
1305*c33252afSJohn Marino _GL_CXXALIAS_RPL (strsignal, char *, (int __sig));
1306*c33252afSJohn Marino # else
1307*c33252afSJohn Marino #  if ! 1
1308*c33252afSJohn Marino _GL_FUNCDECL_SYS (strsignal, char *, (int __sig));
1309*c33252afSJohn Marino #  endif
1310*c33252afSJohn Marino /* Need to cast, because on Cygwin 1.5.x systems, the return type is
1311*c33252afSJohn Marino    'const char *'.  */
1312*c33252afSJohn Marino _GL_CXXALIAS_SYS_CAST (strsignal, char *, (int __sig));
1313*c33252afSJohn Marino # endif
1314*c33252afSJohn Marino _GL_CXXALIASWARN (strsignal);
1315*c33252afSJohn Marino #elif defined GNULIB_POSIXCHECK
1316*c33252afSJohn Marino # undef strsignal
1317*c33252afSJohn Marino # if HAVE_RAW_DECL_STRSIGNAL
1318*c33252afSJohn Marino _GL_WARN_ON_USE (strsignal, "strsignal is unportable - "
1319*c33252afSJohn Marino                  "use gnulib module strsignal for portability");
1320*c33252afSJohn Marino # endif
1321*c33252afSJohn Marino #endif
1322*c33252afSJohn Marino 
1323*c33252afSJohn Marino #if 0
1324*c33252afSJohn Marino # if !1
1325*c33252afSJohn Marino _GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *)
1326*c33252afSJohn Marino                                    _GL_ATTRIBUTE_PURE
1327*c33252afSJohn Marino                                    _GL_ARG_NONNULL ((1, 2)));
1328*c33252afSJohn Marino # endif
1329*c33252afSJohn Marino _GL_CXXALIAS_SYS (strverscmp, int, (const char *, const char *));
1330*c33252afSJohn Marino _GL_CXXALIASWARN (strverscmp);
1331*c33252afSJohn Marino #elif defined GNULIB_POSIXCHECK
1332*c33252afSJohn Marino # undef strverscmp
1333*c33252afSJohn Marino # if HAVE_RAW_DECL_STRVERSCMP
1334*c33252afSJohn Marino _GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - "
1335*c33252afSJohn Marino                  "use gnulib module strverscmp for portability");
1336*c33252afSJohn Marino # endif
1337*c33252afSJohn Marino #endif
1338*c33252afSJohn Marino 
1339*c33252afSJohn Marino 
1340*c33252afSJohn Marino #endif /* _GL_STRING_H */
1341*c33252afSJohn Marino #endif /* _GL_STRING_H */
1342