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