Debian Codegraph @

lib/string.in.h

raw
1 /* A GNU-like <string.h>.
2
3 Copyright (C) 1995-1996, 2001-2025 Free Software Foundation, Inc.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18 #if __GNUC__ >= 3
19 @PRAGMA_SYSTEM_HEADER@
20 #endif
21 @PRAGMA_COLUMNS@
22
23 #if defined _@GUARD_PREFIX@_ALREADY_INCLUDING_STRING_H
24 /* Special invocation convention:
25 - On OS X/NetBSD we have a sequence of nested includes
26 <string.h> -> <strings.h> -> "string.h"
27 In this situation system _chk variants due to -D_FORTIFY_SOURCE
28 might be used after any replacements defined here. */
29
30 #@INCLUDE_NEXT@ @NEXT_STRING_H@
31
32 #else
33 /* Normal invocation convention. */
34
35 #ifndef _@GUARD_PREFIX@_STRING_H
36
37 #define _@GUARD_PREFIX@_ALREADY_INCLUDING_STRING_H
38
39 /* The include_next requires a split double-inclusion guard. */
40 #@INCLUDE_NEXT@ @NEXT_STRING_H@
41
42 #undef _@GUARD_PREFIX@_ALREADY_INCLUDING_STRING_H
43
44 #ifndef _@GUARD_PREFIX@_STRING_H
45 #define _@GUARD_PREFIX@_STRING_H
46
47 /* This file uses _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_MALLOC,
48 _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PURE, GNULIB_POSIXCHECK,
49 HAVE_RAW_DECL_*. */
50 #if !_GL_CONFIG_H_INCLUDED
51 #error "Please include config.h first."
52 #endif
53
54 /* NetBSD 5.0 mis-defines NULL. */
55 #include <stddef.h>
56
57 #if @GNULIB_STRERROR_L@
58 /* Get locale_t. */
59 # include <locale.h>
60 #endif
61
62 /* MirBSD defines mbslen as a macro. */
63 #if @GNULIB_MBSLEN@ && defined __MirBSD__
64 # include <wchar.h>
65 #endif
66
67 /* NetBSD 5.0 declares strsignal in <unistd.h>, not in <string.h>. */
68 /* But in any case avoid namespace pollution on glibc systems. */
69 #if (@GNULIB_STRSIGNAL@ || defined GNULIB_POSIXCHECK) && defined __NetBSD__ \
70 && ! defined __GLIBC__
71 # include <unistd.h>
72 #endif
73
74 /* AIX 7.2 and Android 13 declare ffsl and ffsll in <strings.h>, not in
75 <string.h>. */
76 /* But in any case avoid namespace pollution on glibc systems. */
77 #if ((@GNULIB_FFSL@ || @GNULIB_FFSLL@ || defined GNULIB_POSIXCHECK) \
78 && (defined _AIX || defined __ANDROID__)) \
79 && ! defined __GLIBC__
80 # include <strings.h>
81 #endif
82
83 /* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
84 that can be freed by passing them as the Ith argument to the
85 function F. */
86 #ifndef _GL_ATTRIBUTE_DEALLOC
87 # if __GNUC__ >= 11 && !defined __clang__
88 # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
89 # else
90 # define _GL_ATTRIBUTE_DEALLOC(f, i)
91 # endif
92 #endif
93
94 /* _GL_ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that
95 can be freed via 'free'; it can be used only after declaring 'free'. */
96 /* Applies to: functions. Cannot be used on inline functions. */
97 #ifndef _GL_ATTRIBUTE_DEALLOC_FREE
98 # if defined __cplusplus && defined __GNUC__ && !defined __clang__
99 /* Work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108231> */
100 # define _GL_ATTRIBUTE_DEALLOC_FREE \
101 _GL_ATTRIBUTE_DEALLOC ((void (*) (void *)) free, 1)
102 # else
103 # define _GL_ATTRIBUTE_DEALLOC_FREE \
104 _GL_ATTRIBUTE_DEALLOC (free, 1)
105 # endif
106 #endif
107
108 /* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly
109 allocated memory. */
110 /* Applies to: functions. */
111 #ifndef _GL_ATTRIBUTE_MALLOC
112 # if __GNUC__ >= 3 || defined __clang__
113 # define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
114 # else
115 # define _GL_ATTRIBUTE_MALLOC
116 # endif
117 #endif
118
119 /* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions.
120 */
121 #ifndef _GL_ATTRIBUTE_NOTHROW
122 # if defined __cplusplus
123 # if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4
124 # if __cplusplus >= 201103L
125 # define _GL_ATTRIBUTE_NOTHROW noexcept (true)
126 # else
127 # define _GL_ATTRIBUTE_NOTHROW throw ()
128 # endif
129 # else
130 # define _GL_ATTRIBUTE_NOTHROW
131 # endif
132 # else
133 # if (__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__
134 # define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__))
135 # else
136 # define _GL_ATTRIBUTE_NOTHROW
137 # endif
138 # endif
139 #endif
140
141 /* The __attribute__ feature is available in gcc versions 2.5 and later.
142 The attribute __pure__ was added in gcc 2.96. */
143 #ifndef _GL_ATTRIBUTE_PURE
144 # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
145 # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
146 # else
147 # define _GL_ATTRIBUTE_PURE /* empty */
148 # endif
149 #endif
150
151 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
152
153 /* The definition of _GL_ARG_NONNULL is copied here. */
154
155 /* The definition of _GL_WARN_ON_USE is copied here. */
156
157 /* Make _GL_ATTRIBUTE_DEALLOC_FREE work, even though <stdlib.h> may not have
158 been included yet. */
159 #if @GNULIB_FREE_POSIX@
160 # if (@REPLACE_FREE@ && !defined free \
161 && !(defined __cplusplus && defined GNULIB_NAMESPACE))
162 /* We can't do '#define free rpl_free' here. */
163 # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
164 _GL_EXTERN_C void rpl_free (void *) _GL_ATTRIBUTE_NOTHROW;
165 # else
166 _GL_EXTERN_C void rpl_free (void *);
167 # endif
168 # undef _GL_ATTRIBUTE_DEALLOC_FREE
169 # define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1)
170 # else
171 # if defined _MSC_VER && !defined free
172 _GL_EXTERN_C
173 # if defined _DLL
174 __declspec (dllimport)
175 # endif
176 void __cdecl free (void *);
177 # else
178 # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
179 _GL_EXTERN_C void free (void *) _GL_ATTRIBUTE_NOTHROW;
180 # else
181 _GL_EXTERN_C void free (void *);
182 # endif
183 # endif
184 # endif
185 #else
186 # if defined _MSC_VER && !defined free
187 _GL_EXTERN_C
188 # if defined _DLL
189 __declspec (dllimport)
190 # endif
191 void __cdecl free (void *);
192 # else
193 # if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
194 _GL_EXTERN_C void free (void *) _GL_ATTRIBUTE_NOTHROW;
195 # else
196 _GL_EXTERN_C void free (void *);
197 # endif
198 # endif
199 #endif
200
201 /* Clear a block of memory. The compiler will not delete a call to
202 this function, even if the block is dead after the call. */
203 #if @GNULIB_EXPLICIT_BZERO@
204 # if ! @HAVE_EXPLICIT_BZERO@
205 _GL_FUNCDECL_SYS (explicit_bzero, void,
206 (void *__dest, size_t __n), _GL_ARG_NONNULL ((1)));
207 # endif
208 _GL_CXXALIAS_SYS (explicit_bzero, void, (void *__dest, size_t __n));
209 _GL_CXXALIASWARN (explicit_bzero);
210 #elif defined GNULIB_POSIXCHECK
211 # undef explicit_bzero
212 # if HAVE_RAW_DECL_EXPLICIT_BZERO
213 _GL_WARN_ON_USE (explicit_bzero, "explicit_bzero is unportable - "
214 "use gnulib module explicit_bzero for portability");
215 # endif
216 #endif
217
218 /* Find the index of the least-significant set bit. */
219 #if @GNULIB_FFSL@
220 # if !@HAVE_FFSL@
221 _GL_FUNCDECL_SYS (ffsl, int, (long int i), );
222 # endif
223 _GL_CXXALIAS_SYS (ffsl, int, (long int i));
224 _GL_CXXALIASWARN (ffsl);
225 #elif defined GNULIB_POSIXCHECK
226 # undef ffsl
227 # if HAVE_RAW_DECL_FFSL
228 _GL_WARN_ON_USE (ffsl, "ffsl is not portable - use the ffsl module");
229 # endif
230 #endif
231
232
233 /* Find the index of the least-significant set bit. */
234 #if @GNULIB_FFSLL@
235 # if @REPLACE_FFSLL@
236 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
237 # define ffsll rpl_ffsll
238 # endif
239 _GL_FUNCDECL_RPL (ffsll, int, (long long int i), );
240 _GL_CXXALIAS_RPL (ffsll, int, (long long int i));
241 # else
242 # if !@HAVE_FFSLL@
243 _GL_FUNCDECL_SYS (ffsll, int, (long long int i), );
244 # endif
245 _GL_CXXALIAS_SYS (ffsll, int, (long long int i));
246 # endif
247 _GL_CXXALIASWARN (ffsll);
248 #elif defined GNULIB_POSIXCHECK
249 # undef ffsll
250 # if HAVE_RAW_DECL_FFSLL
251 _GL_WARN_ON_USE (ffsll, "ffsll is not portable - use the ffsll module");
252 # endif
253 #endif
254
255
256 #if @GNULIB_MDA_MEMCCPY@
257 /* On native Windows, map 'memccpy' to '_memccpy', so that -loldnames is not
258 required. In C++ with GNULIB_NAMESPACE, avoid differences between
259 platforms by defining GNULIB_NAMESPACE::memccpy always. */
260 # if defined _WIN32 && !defined __CYGWIN__
261 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
262 # undef memccpy
263 # define memccpy _memccpy
264 # endif
265 _GL_CXXALIAS_MDA (memccpy, void *,
266 (void *dest, const void *src, int c, size_t n));
267 # else
268 _GL_CXXALIAS_SYS (memccpy, void *,
269 (void *dest, const void *src, int c, size_t n));
270 # endif
271 _GL_CXXALIASWARN (memccpy);
272 #endif
273
274
275 /* Return the first instance of C within N bytes of S, or NULL. */
276 #if @GNULIB_MEMCHR@
277 # if @REPLACE_MEMCHR@
278 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
279 # undef memchr
280 # define memchr rpl_memchr
281 # endif
282 _GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n),
283 _GL_ATTRIBUTE_PURE
284 _GL_ARG_NONNULL ((1)));
285 _GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n));
286 # else
287 /* On some systems, this function is defined as an overloaded function:
288 extern "C" { const void * std::memchr (const void *, int, size_t); }
289 extern "C++" { void * std::memchr (void *, int, size_t); } */
290 _GL_CXXALIAS_SYS_CAST2 (memchr,
291 void *, (void const *__s, int __c, size_t __n),
292 void const *, (void const *__s, int __c, size_t __n));
293 # endif
294 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
295 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \
296 || defined __clang__)
297 _GL_CXXALIASWARN1 (memchr, void *,
298 (void *__s, int __c, size_t __n)
299 _GL_ATTRIBUTE_NOTHROW);
300 _GL_CXXALIASWARN1 (memchr, void const *,
301 (void const *__s, int __c, size_t __n)
302 _GL_ATTRIBUTE_NOTHROW);
303 # elif __GLIBC__ >= 2
304 _GL_CXXALIASWARN (memchr);
305 # endif
306 #elif defined GNULIB_POSIXCHECK
307 # undef memchr
308 /* Assume memchr is always declared. */
309 _GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - "
310 "use gnulib module memchr for portability" );
311 #endif
312
313 /* Return the first occurrence of NEEDLE in HAYSTACK. */
314 #if @GNULIB_MEMMEM@
315 # if @REPLACE_MEMMEM@
316 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
317 # define memmem rpl_memmem
318 # endif
319 _GL_FUNCDECL_RPL (memmem, void *,
320 (void const *__haystack, size_t __haystack_len,
321 void const *__needle, size_t __needle_len),
322 _GL_ATTRIBUTE_PURE
323 _GL_ARG_NONNULL ((1, 3)));
324 _GL_CXXALIAS_RPL (memmem, void *,
325 (void const *__haystack, size_t __haystack_len,
326 void const *__needle, size_t __needle_len));
327 # else
328 # if ! @HAVE_DECL_MEMMEM@
329 _GL_FUNCDECL_SYS (memmem, void *,
330 (void const *__haystack, size_t __haystack_len,
331 void const *__needle, size_t __needle_len),
332 _GL_ATTRIBUTE_PURE
333 _GL_ARG_NONNULL ((1, 3)));
334 # endif
335 _GL_CXXALIAS_SYS (memmem, void *,
336 (void const *__haystack, size_t __haystack_len,
337 void const *__needle, size_t __needle_len));
338 # endif
339 _GL_CXXALIASWARN (memmem);
340 #elif defined GNULIB_POSIXCHECK
341 # undef memmem
342 # if HAVE_RAW_DECL_MEMMEM
343 _GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - "
344 "use gnulib module memmem-simple for portability, "
345 "and module memmem for speed" );
346 # endif
347 #endif
348
349 /* Copy N bytes of SRC to DEST, return pointer to bytes after the
350 last written byte. */
351 #if @GNULIB_MEMPCPY@
352 # if @REPLACE_MEMPCPY@
353 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
354 # undef mempcpy
355 # define mempcpy rpl_mempcpy
356 # endif
357 _GL_FUNCDECL_RPL (mempcpy, void *,
358 (void *restrict __dest, void const *restrict __src,
359 size_t __n),
360 _GL_ARG_NONNULL ((1, 2)));
361 _GL_CXXALIAS_RPL (mempcpy, void *,
362 (void *restrict __dest, void const *restrict __src,
363 size_t __n));
364 # else
365 # if !@HAVE_MEMPCPY@
366 _GL_FUNCDECL_SYS (mempcpy, void *,
367 (void *restrict __dest, void const *restrict __src,
368 size_t __n),
369 _GL_ARG_NONNULL ((1, 2)));
370 # endif
371 _GL_CXXALIAS_SYS (mempcpy, void *,
372 (void *restrict __dest, void const *restrict __src,
373 size_t __n));
374 # endif
375 # if __GLIBC__ >= 2
376 _GL_CXXALIASWARN (mempcpy);
377 # endif
378 #elif defined GNULIB_POSIXCHECK
379 # undef mempcpy
380 # if HAVE_RAW_DECL_MEMPCPY
381 _GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - "
382 "use gnulib module mempcpy for portability");
383 # endif
384 #endif
385
386 /* Search backwards through a block for a byte (specified as an int). */
387 #if @GNULIB_MEMRCHR@
388 # if ! @HAVE_DECL_MEMRCHR@
389 _GL_FUNCDECL_SYS (memrchr, void *, (void const *, int, size_t),
390 _GL_ATTRIBUTE_PURE
391 _GL_ARG_NONNULL ((1)));
392 # endif
393 /* On some systems, this function is defined as an overloaded function:
394 extern "C++" { const void * std::memrchr (const void *, int, size_t); }
395 extern "C++" { void * std::memrchr (void *, int, size_t); } */
396 _GL_CXXALIAS_SYS_CAST2 (memrchr,
397 void *, (void const *, int, size_t),
398 void const *, (void const *, int, size_t));
399 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
400 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \
401 || defined __clang__)
402 _GL_CXXALIASWARN1 (memrchr, void *,
403 (void *, int, size_t)
404 _GL_ATTRIBUTE_NOTHROW);
405 _GL_CXXALIASWARN1 (memrchr, void const *,
406 (void const *, int, size_t)
407 _GL_ATTRIBUTE_NOTHROW);
408 # elif __GLIBC__ >= 2
409 _GL_CXXALIASWARN (memrchr);
410 # endif
411 #elif defined GNULIB_POSIXCHECK
412 # undef memrchr
413 # if HAVE_RAW_DECL_MEMRCHR
414 _GL_WARN_ON_USE (memrchr, "memrchr is unportable - "
415 "use gnulib module memrchr for portability");
416 # endif
417 #endif
418
419 /* Overwrite a block of memory. The compiler will not optimize
420 effects away, even if the block is dead after the call. */
421 #if @GNULIB_MEMSET_EXPLICIT@
422 # if @REPLACE_MEMSET_EXPLICIT@
423 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
424 # undef memset_explicit
425 # define memset_explicit rpl_memset_explicit
426 # endif
427 _GL_FUNCDECL_RPL (memset_explicit, void *,
428 (void *__dest, int __c, size_t __n), _GL_ARG_NONNULL ((1)));
429 _GL_CXXALIAS_RPL (memset_explicit, void *, (void *__dest, int __c, size_t __n));
430 # else
431 # if !@HAVE_MEMSET_EXPLICIT@
432 _GL_FUNCDECL_SYS (memset_explicit, void *,
433 (void *__dest, int __c, size_t __n), _GL_ARG_NONNULL ((1)));
434 # endif
435 _GL_CXXALIAS_SYS (memset_explicit, void *, (void *__dest, int __c, size_t __n));
436 # endif
437 # if __GLIBC__ >= 2
438 _GL_CXXALIASWARN (memset_explicit);
439 # endif
440 #elif defined GNULIB_POSIXCHECK
441 # undef memset_explicit
442 # if HAVE_RAW_DECL_MEMSET_EXPLICIT
443 _GL_WARN_ON_USE (memset_explicit, "memset_explicit is unportable - "
444 "use gnulib module memset_explicit for portability");
445 # endif
446 #endif
447
448 /* Find the first occurrence of C in S. More efficient than
449 memchr(S,C,N), at the expense of undefined behavior if C does not
450 occur within N bytes. */
451 #if @GNULIB_RAWMEMCHR@
452 # if ! @HAVE_RAWMEMCHR@
453 _GL_FUNCDECL_SYS (rawmemchr, void *, (void const *__s, int __c_in),
454 _GL_ATTRIBUTE_PURE
455 _GL_ARG_NONNULL ((1)));
456 # endif
457 /* On some systems, this function is defined as an overloaded function:
458 extern "C++" { const void * std::rawmemchr (const void *, int); }
459 extern "C++" { void * std::rawmemchr (void *, int); } */
460 _GL_CXXALIAS_SYS_CAST2 (rawmemchr,
461 void *, (void const *__s, int __c_in),
462 void const *, (void const *__s, int __c_in));
463 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
464 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \
465 || defined __clang__)
466 _GL_CXXALIASWARN1 (rawmemchr, void *,
467 (void *__s, int __c_in)
468 _GL_ATTRIBUTE_NOTHROW);
469 _GL_CXXALIASWARN1 (rawmemchr, void const *,
470 (void const *__s, int __c_in)
471 _GL_ATTRIBUTE_NOTHROW);
472 # else
473 _GL_CXXALIASWARN (rawmemchr);
474 # endif
475 #elif defined GNULIB_POSIXCHECK
476 # undef rawmemchr
477 # if HAVE_RAW_DECL_RAWMEMCHR
478 _GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - "
479 "use gnulib module rawmemchr for portability");
480 # endif
481 #endif
482
483 /* Copy SRC to DST, returning the address of the terminating '\0' in DST. */
484 #if @GNULIB_STPCPY@
485 # if @REPLACE_STPCPY@
486 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
487 # undef stpcpy
488 # define stpcpy rpl_stpcpy
489 # endif
490 _GL_FUNCDECL_RPL (stpcpy, char *,
491 (char *restrict __dst, char const *restrict __src),
492 _GL_ARG_NONNULL ((1, 2)));
493 _GL_CXXALIAS_RPL (stpcpy, char *,
494 (char *restrict __dst, char const *restrict __src));
495 # else
496 # if !@HAVE_STPCPY@
497 _GL_FUNCDECL_SYS (stpcpy, char *,
498 (char *restrict __dst, char const *restrict __src),
499 _GL_ARG_NONNULL ((1, 2)));
500 # endif
501 _GL_CXXALIAS_SYS (stpcpy, char *,
502 (char *restrict __dst, char const *restrict __src));
503 # endif
504 # if __GLIBC__ >= 2
505 _GL_CXXALIASWARN (stpcpy);
506 # endif
507 #elif defined GNULIB_POSIXCHECK
508 # undef stpcpy
509 # if HAVE_RAW_DECL_STPCPY
510 _GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - "
511 "use gnulib module stpcpy for portability");
512 # endif
513 #endif
514
515 /* Copy no more than N bytes of SRC to DST, returning a pointer past the
516 last non-NUL byte written into DST. */
517 #if @GNULIB_STPNCPY@
518 # if @REPLACE_STPNCPY@
519 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
520 # undef stpncpy
521 # define stpncpy rpl_stpncpy
522 # endif
523 _GL_FUNCDECL_RPL (stpncpy, char *,
524 (char *restrict __dst, char const *restrict __src,
525 size_t __n),
526 _GL_ARG_NONNULL ((1, 2)));
527 _GL_CXXALIAS_RPL (stpncpy, char *,
528 (char *restrict __dst, char const *restrict __src,
529 size_t __n));
530 # else
531 # if ! @HAVE_STPNCPY@
532 _GL_FUNCDECL_SYS (stpncpy, char *,
533 (char *restrict __dst, char const *restrict __src,
534 size_t __n),
535 _GL_ARG_NONNULL ((1, 2)));
536 # endif
537 _GL_CXXALIAS_SYS (stpncpy, char *,
538 (char *restrict __dst, char const *restrict __src,
539 size_t __n));
540 # endif
541 # if __GLIBC__ >= 2
542 _GL_CXXALIASWARN (stpncpy);
543 # endif
544 #elif defined GNULIB_POSIXCHECK
545 # undef stpncpy
546 # if HAVE_RAW_DECL_STPNCPY
547 _GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - "
548 "use gnulib module stpncpy for portability");
549 # endif
550 #endif
551
552 #if defined GNULIB_POSIXCHECK
553 /* strchr() does not work with multibyte strings if the locale encoding is
554 GB18030 and the character to be searched is a digit. */
555 # undef strchr
556 /* Assume strchr is always declared. */
557 _GL_WARN_ON_USE_CXX (strchr,
558 const char *, char *, (const char *, int),
559 "strchr cannot work correctly on character strings "
560 "in some multibyte locales - "
561 "use mbschr if you care about internationalization");
562 #endif
563
564 /* Find the first occurrence of C in S or the final NUL byte. */
565 #if @GNULIB_STRCHRNUL@
566 # if @REPLACE_STRCHRNUL@
567 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
568 # define strchrnul rpl_strchrnul
569 # endif
570 _GL_FUNCDECL_RPL (strchrnul, char *, (const char *__s, int __c_in),
571 _GL_ATTRIBUTE_PURE
572 _GL_ARG_NONNULL ((1)));
573 _GL_CXXALIAS_RPL (strchrnul, char *,
574 (const char *str, int ch));
575 # else
576 # if ! @HAVE_STRCHRNUL@
577 _GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in),
578 _GL_ATTRIBUTE_PURE
579 _GL_ARG_NONNULL ((1)));
580 # endif
581 /* On some systems, this function is defined as an overloaded function:
582 extern "C++" { const char * std::strchrnul (const char *, int); }
583 extern "C++" { char * std::strchrnul (char *, int); } */
584 _GL_CXXALIAS_SYS_CAST2 (strchrnul,
585 char *, (char const *__s, int __c_in),
586 char const *, (char const *__s, int __c_in));
587 # endif
588 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
589 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \
590 || defined __clang__)
591 _GL_CXXALIASWARN1 (strchrnul, char *,
592 (char *__s, int __c_in)
593 _GL_ATTRIBUTE_NOTHROW);
594 _GL_CXXALIASWARN1 (strchrnul, char const *,
595 (char const *__s, int __c_in)
596 _GL_ATTRIBUTE_NOTHROW);
597 # elif __GLIBC__ >= 2
598 _GL_CXXALIASWARN (strchrnul);
599 # endif
600 #elif defined GNULIB_POSIXCHECK
601 # undef strchrnul
602 # if HAVE_RAW_DECL_STRCHRNUL
603 _GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - "
604 "use gnulib module strchrnul for portability");
605 # endif
606 #endif
607
608 /* Duplicate S, returning an identical malloc'd string. */
609 #if @GNULIB_STRDUP@
610 # if @REPLACE_STRDUP@
611 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
612 # undef strdup
613 # define strdup rpl_strdup
614 # endif
615 _GL_FUNCDECL_RPL (strdup, char *,
616 (char const *__s),
617 _GL_ARG_NONNULL ((1))
618 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
619 _GL_CXXALIAS_RPL (strdup, char *, (char const *__s));
620 # elif defined _WIN32 && !defined __CYGWIN__
621 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
622 # undef strdup
623 # define strdup _strdup
624 # endif
625 _GL_CXXALIAS_MDA (strdup, char *, (char const *__s));
626 # else
627 # if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup
628 /* strdup exists as a function and as a macro. Get rid of the macro. */
629 # undef strdup
630 # endif
631 # if (!@HAVE_DECL_STRDUP@ || (__GNUC__ >= 11 && !defined __clang__)) \
632 && !defined strdup
633 # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
634 _GL_FUNCDECL_SYS (strdup, char *,
635 (char const *__s),
636 _GL_ARG_NONNULL ((1))
637 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
638 _GL_ATTRIBUTE_NOTHROW;
639 # else
640 _GL_FUNCDECL_SYS (strdup, char *,
641 (char const *__s),
642 _GL_ARG_NONNULL ((1))
643 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
644 # endif
645 # endif
646 _GL_CXXALIAS_SYS (strdup, char *, (char const *__s));
647 # endif
648 _GL_CXXALIASWARN (strdup);
649 #else
650 # if (__GNUC__ >= 11 && !defined __clang__) && !defined strdup
651 /* For -Wmismatched-dealloc: Associate strdup with free or rpl_free. */
652 # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
653 _GL_FUNCDECL_SYS (strdup, char *,
654 (char const *__s),
655 _GL_ARG_NONNULL ((1))
656 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
657 _GL_ATTRIBUTE_NOTHROW;
658 # else
659 _GL_FUNCDECL_SYS (strdup, char *,
660 (char const *__s),
661 _GL_ARG_NONNULL ((1))
662 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
663 # endif
664 # endif
665 # if defined GNULIB_POSIXCHECK
666 # undef strdup
667 # if HAVE_RAW_DECL_STRDUP
668 _GL_WARN_ON_USE (strdup, "strdup is unportable - "
669 "use gnulib module strdup for portability");
670 # endif
671 # elif @GNULIB_MDA_STRDUP@
672 /* On native Windows, map 'creat' to '_creat', so that -loldnames is not
673 required. In C++ with GNULIB_NAMESPACE, avoid differences between
674 platforms by defining GNULIB_NAMESPACE::strdup always. */
675 # if defined _WIN32 && !defined __CYGWIN__
676 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
677 # undef strdup
678 # define strdup _strdup
679 # endif
680 _GL_CXXALIAS_MDA (strdup, char *, (char const *__s));
681 # else
682 # if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup
683 # undef strdup
684 # endif
685 _GL_CXXALIAS_SYS (strdup, char *, (char const *__s));
686 # endif
687 _GL_CXXALIASWARN (strdup);
688 # endif
689 #endif
690
691 /* Append no more than N characters from SRC onto DEST. */
692 #if @GNULIB_STRNCAT@
693 # if @REPLACE_STRNCAT@
694 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
695 # undef strncat
696 # define strncat rpl_strncat
697 # endif
698 _GL_FUNCDECL_RPL (strncat, char *,
699 (char *restrict dest, const char *restrict src, size_t n),
700 _GL_ARG_NONNULL ((1, 2)));
701 _GL_CXXALIAS_RPL (strncat, char *,
702 (char *restrict dest, const char *restrict src, size_t n));
703 # else
704 _GL_CXXALIAS_SYS (strncat, char *,
705 (char *restrict dest, const char *restrict src, size_t n));
706 # endif
707 # if __GLIBC__ >= 2
708 _GL_CXXALIASWARN (strncat);
709 # endif
710 #elif defined GNULIB_POSIXCHECK
711 # undef strncat
712 # if HAVE_RAW_DECL_STRNCAT
713 _GL_WARN_ON_USE (strncat, "strncat is unportable - "
714 "use gnulib module strncat for portability");
715 # endif
716 #endif
717
718 /* Return a newly allocated copy of at most N bytes of STRING. */
719 #if @GNULIB_STRNDUP@
720 # if @REPLACE_STRNDUP@
721 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
722 # undef strndup
723 # define strndup rpl_strndup
724 # endif
725 _GL_FUNCDECL_RPL (strndup, char *,
726 (char const *__s, size_t __n),
727 _GL_ARG_NONNULL ((1))
728 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
729 _GL_CXXALIAS_RPL (strndup, char *, (char const *__s, size_t __n));
730 # else
731 # if !@HAVE_DECL_STRNDUP@ \
732 || ((__GNUC__ >= 11 && !defined __clang__) && !defined strndup)
733 # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
734 _GL_FUNCDECL_SYS (strndup, char *,
735 (char const *__s, size_t __n),
736 _GL_ARG_NONNULL ((1))
737 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
738 _GL_ATTRIBUTE_NOTHROW;
739 # else
740 _GL_FUNCDECL_SYS (strndup, char *,
741 (char const *__s, size_t __n),
742 _GL_ARG_NONNULL ((1))
743 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
744 # endif
745 # endif
746 _GL_CXXALIAS_SYS (strndup, char *, (char const *__s, size_t __n));
747 # endif
748 _GL_CXXALIASWARN (strndup);
749 #else
750 # if (__GNUC__ >= 11 && !defined __clang__) && !defined strndup
751 /* For -Wmismatched-dealloc: Associate strndup with free or rpl_free. */
752 # if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
753 _GL_FUNCDECL_SYS (strndup, char *,
754 (char const *__s, size_t __n),
755 _GL_ARG_NONNULL ((1))
756 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
757 _GL_ATTRIBUTE_NOTHROW;
758 # else
759 _GL_FUNCDECL_SYS (strndup, char *,
760 (char const *__s, size_t __n),
761 _GL_ARG_NONNULL ((1))
762 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
763 # endif
764 # endif
765 # if defined GNULIB_POSIXCHECK
766 # undef strndup
767 # if HAVE_RAW_DECL_STRNDUP
768 _GL_WARN_ON_USE (strndup, "strndup is unportable - "
769 "use gnulib module strndup for portability");
770 # endif
771 # endif
772 #endif
773
774 /* Find the length (number of bytes) of STRING, but scan at most
775 MAXLEN bytes. If no '\0' terminator is found in that many bytes,
776 return MAXLEN. */
777 #if @GNULIB_STRNLEN@
778 # if @REPLACE_STRNLEN@
779 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
780 # undef strnlen
781 # define strnlen rpl_strnlen
782 # endif
783 _GL_FUNCDECL_RPL (strnlen, size_t, (char const *__s, size_t __maxlen),
784 _GL_ATTRIBUTE_PURE
785 _GL_ARG_NONNULL ((1)));
786 _GL_CXXALIAS_RPL (strnlen, size_t, (char const *__s, size_t __maxlen));
787 # else
788 # if ! @HAVE_DECL_STRNLEN@
789 _GL_FUNCDECL_SYS (strnlen, size_t, (char const *__s, size_t __maxlen),
790 _GL_ATTRIBUTE_PURE
791 _GL_ARG_NONNULL ((1)));
792 # endif
793 _GL_CXXALIAS_SYS (strnlen, size_t, (char const *__s, size_t __maxlen));
794 # endif
795 _GL_CXXALIASWARN (strnlen);
796 #elif defined GNULIB_POSIXCHECK
797 # undef strnlen
798 # if HAVE_RAW_DECL_STRNLEN
799 _GL_WARN_ON_USE (strnlen, "strnlen is unportable - "
800 "use gnulib module strnlen for portability");
801 # endif
802 #endif
803
804 #if defined GNULIB_POSIXCHECK
805 /* strcspn() assumes the second argument is a list of single-byte characters.
806 Even in this simple case, it does not work with multibyte strings if the
807 locale encoding is GB18030 and one of the characters to be searched is a
808 digit. */
809 # undef strcspn
810 /* Assume strcspn is always declared. */
811 _GL_WARN_ON_USE (strcspn, "strcspn cannot work correctly on character strings "
812 "in multibyte locales - "
813 "use mbscspn if you care about internationalization");
814 #endif
815
816 /* Find the first occurrence in S of any character in ACCEPT. */
817 #if @GNULIB_STRPBRK@
818 # if ! @HAVE_STRPBRK@
819 _GL_FUNCDECL_SYS (strpbrk, char *, (char const *__s, char const *__accept),
820 _GL_ATTRIBUTE_PURE
821 _GL_ARG_NONNULL ((1, 2)));
822 # endif
823 /* On some systems, this function is defined as an overloaded function:
824 extern "C" { const char * strpbrk (const char *, const char *); }
825 extern "C++" { char * strpbrk (char *, const char *); } */
826 _GL_CXXALIAS_SYS_CAST2 (strpbrk,
827 char *, (char const *__s, char const *__accept),
828 const char *, (char const *__s, char const *__accept));
829 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
830 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \
831 || defined __clang__)
832 _GL_CXXALIASWARN1 (strpbrk, char *,
833 (char *__s, char const *__accept)
834 _GL_ATTRIBUTE_NOTHROW);
835 _GL_CXXALIASWARN1 (strpbrk, char const *,
836 (char const *__s, char const *__accept)
837 _GL_ATTRIBUTE_NOTHROW);
838 # elif __GLIBC__ >= 2
839 _GL_CXXALIASWARN (strpbrk);
840 # endif
841 # if defined GNULIB_POSIXCHECK
842 /* strpbrk() assumes the second argument is a list of single-byte characters.
843 Even in this simple case, it does not work with multibyte strings if the
844 locale encoding is GB18030 and one of the characters to be searched is a
845 digit. */
846 # undef strpbrk
847 _GL_WARN_ON_USE_CXX (strpbrk,
848 const char *, char *, (const char *, const char *),
849 "strpbrk cannot work correctly on character strings "
850 "in multibyte locales - "
851 "use mbspbrk if you care about internationalization");
852 # endif
853 #elif defined GNULIB_POSIXCHECK
854 # undef strpbrk
855 # if HAVE_RAW_DECL_STRPBRK
856 _GL_WARN_ON_USE_CXX (strpbrk,
857 const char *, char *, (const char *, const char *),
858 "strpbrk is unportable - "
859 "use gnulib module strpbrk for portability");
860 # endif
861 #endif
862
863 #if defined GNULIB_POSIXCHECK
864 /* strspn() assumes the second argument is a list of single-byte characters.
865 Even in this simple case, it cannot work with multibyte strings. */
866 # undef strspn
867 /* Assume strspn is always declared. */
868 _GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings "
869 "in multibyte locales - "
870 "use mbsspn if you care about internationalization");
871 #endif
872
873 #if defined GNULIB_POSIXCHECK
874 /* strrchr() does not work with multibyte strings if the locale encoding is
875 GB18030 and the character to be searched is a digit. */
876 # undef strrchr
877 /* Assume strrchr is always declared. */
878 _GL_WARN_ON_USE_CXX (strrchr,
879 const char *, char *, (const char *, int),
880 "strrchr cannot work correctly on character strings "
881 "in some multibyte locales - "
882 "use mbsrchr if you care about internationalization");
883 #endif
884
885 /* Search the next delimiter (char listed in DELIM) starting at *STRINGP.
886 If one is found, overwrite it with a NUL, and advance *STRINGP
887 to point to the next char after it. Otherwise, set *STRINGP to NULL.
888 If *STRINGP was already NULL, nothing happens.
889 Return the old value of *STRINGP.
890
891 This is a variant of strtok() that is multithread-safe and supports
892 empty fields.
893
894 Caveat: It modifies the original string.
895 Caveat: These functions cannot be used on constant strings.
896 Caveat: The identity of the delimiting character is lost.
897 Caveat: It doesn't work with multibyte strings unless all of the delimiter
898 characters are ASCII characters < 0x30.
899
900 See also strtok_r(). */
901 #if @GNULIB_STRSEP@
902 # if ! @HAVE_STRSEP@
903 _GL_FUNCDECL_SYS (strsep, char *,
904 (char **restrict __stringp, char const *restrict __delim),
905 _GL_ARG_NONNULL ((1, 2)));
906 # endif
907 _GL_CXXALIAS_SYS (strsep, char *,
908 (char **restrict __stringp, char const *restrict __delim));
909 _GL_CXXALIASWARN (strsep);
910 # if defined GNULIB_POSIXCHECK
911 # undef strsep
912 _GL_WARN_ON_USE (strsep, "strsep cannot work correctly on character strings "
913 "in multibyte locales - "
914 "use mbssep if you care about internationalization");
915 # endif
916 #elif defined GNULIB_POSIXCHECK
917 # undef strsep
918 # if HAVE_RAW_DECL_STRSEP
919 _GL_WARN_ON_USE (strsep, "strsep is unportable - "
920 "use gnulib module strsep for portability");
921 # endif
922 #endif
923
924 #if @GNULIB_STRSTR@
925 # if @REPLACE_STRSTR@
926 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
927 # define strstr rpl_strstr
928 # endif
929 _GL_FUNCDECL_RPL (strstr, char *, (const char *haystack, const char *needle),
930 _GL_ATTRIBUTE_PURE
931 _GL_ARG_NONNULL ((1, 2)));
932 _GL_CXXALIAS_RPL (strstr, char *, (const char *haystack, const char *needle));
933 # else
934 /* On some systems, this function is defined as an overloaded function:
935 extern "C++" { const char * strstr (const char *, const char *); }
936 extern "C++" { char * strstr (char *, const char *); } */
937 _GL_CXXALIAS_SYS_CAST2 (strstr,
938 char *, (const char *haystack, const char *needle),
939 const char *, (const char *haystack, const char *needle));
940 # endif
941 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
942 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \
943 || defined __clang__)
944 _GL_CXXALIASWARN1 (strstr, char *,
945 (char *haystack, const char *needle)
946 _GL_ATTRIBUTE_NOTHROW);
947 _GL_CXXALIASWARN1 (strstr, const char *,
948 (const char *haystack, const char *needle)
949 _GL_ATTRIBUTE_NOTHROW);
950 # elif __GLIBC__ >= 2
951 _GL_CXXALIASWARN (strstr);
952 # endif
953 #elif defined GNULIB_POSIXCHECK
954 /* strstr() does not work with multibyte strings if the locale encoding is
955 different from UTF-8:
956 POSIX says that it operates on "strings", and "string" in POSIX is defined
957 as a sequence of bytes, not of characters. */
958 # undef strstr
959 /* Assume strstr is always declared. */
960 _GL_WARN_ON_USE (strstr, "strstr is quadratic on many systems, and cannot "
961 "work correctly on character strings in most "
962 "multibyte locales - "
963 "use mbsstr if you care about internationalization, "
964 "or use strstr if you care about speed");
965 #endif
966
967 /* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive
968 comparison. */
969 #if @GNULIB_STRCASESTR@
970 # if @REPLACE_STRCASESTR@
971 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
972 # define strcasestr rpl_strcasestr
973 # endif
974 _GL_FUNCDECL_RPL (strcasestr, char *,
975 (const char *haystack, const char *needle),
976 _GL_ATTRIBUTE_PURE
977 _GL_ARG_NONNULL ((1, 2)));
978 _GL_CXXALIAS_RPL (strcasestr, char *,
979 (const char *haystack, const char *needle));
980 # else
981 # if ! @HAVE_STRCASESTR@
982 _GL_FUNCDECL_SYS (strcasestr, char *,
983 (const char *haystack, const char *needle),
984 _GL_ATTRIBUTE_PURE
985 _GL_ARG_NONNULL ((1, 2)));
986 # endif
987 /* On some systems, this function is defined as an overloaded function:
988 extern "C++" { const char * strcasestr (const char *, const char *); }
989 extern "C++" { char * strcasestr (char *, const char *); } */
990 _GL_CXXALIAS_SYS_CAST2 (strcasestr,
991 char *, (const char *haystack, const char *needle),
992 const char *, (const char *haystack, const char *needle));
993 # endif
994 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
995 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) \
996 || defined __clang__)
997 _GL_CXXALIASWARN1 (strcasestr, char *,
998 (char *haystack, const char *needle)
999 _GL_ATTRIBUTE_NOTHROW);
1000 _GL_CXXALIASWARN1 (strcasestr, const char *,
1001 (const char *haystack, const char *needle)
1002 _GL_ATTRIBUTE_NOTHROW);
1003 # elif __GLIBC__ >= 2
1004 _GL_CXXALIASWARN (strcasestr);
1005 # endif
1006 #elif defined GNULIB_POSIXCHECK
1007 /* strcasestr() does not work with multibyte strings:
1008 It is a glibc extension, and glibc implements it only for unibyte
1009 locales. */
1010 # undef strcasestr
1011 # if HAVE_RAW_DECL_STRCASESTR
1012 _GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character "
1013 "strings in multibyte locales - "
1014 "use mbscasestr if you care about "
1015 "internationalization, or use c-strcasestr if you want "
1016 "a locale independent function");
1017 # endif
1018 #endif
1019
1020 /* Parse S into tokens separated by characters in DELIM.
1021 If S is NULL, the saved pointer in SAVE_PTR is used as
1022 the next starting point. For example:
1023 char s[] = "-abc-=-def";
1024 char *sp;
1025 x = strtok_r(s, "-", &sp); // x = "abc", sp = "=-def"
1026 x = strtok_r(NULL, "-=", &sp); // x = "def", sp = NULL
1027 x = strtok_r(NULL, "=", &sp); // x = NULL
1028 // s = "abc\0-def\0"
1029
1030 This is a variant of strtok() that is multithread-safe.
1031
1032 For the POSIX documentation for this function, see:
1033 https://pubs.opengroup.org/onlinepubs/9699919799/functions/strtok.html
1034
1035 Caveat: It modifies the original string.
1036 Caveat: These functions cannot be used on constant strings.
1037 Caveat: The identity of the delimiting character is lost.
1038 Caveat: It doesn't work with multibyte strings unless all of the delimiter
1039 characters are ASCII characters < 0x30.
1040
1041 See also strsep(). */
1042 #if @GNULIB_STRTOK_R@
1043 # if @REPLACE_STRTOK_R@
1044 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1045 # undef strtok_r
1046 # define strtok_r rpl_strtok_r
1047 # endif
1048 _GL_FUNCDECL_RPL (strtok_r, char *,
1049 (char *restrict s, char const *restrict delim,
1050 char **restrict save_ptr),
1051 _GL_ARG_NONNULL ((2, 3)));
1052 _GL_CXXALIAS_RPL (strtok_r, char *,
1053 (char *restrict s, char const *restrict delim,
1054 char **restrict save_ptr));
1055 # else
1056 # if @UNDEFINE_STRTOK_R@ || defined GNULIB_POSIXCHECK
1057 # undef strtok_r
1058 # endif
1059 # if ! @HAVE_DECL_STRTOK_R@
1060 _GL_FUNCDECL_SYS (strtok_r, char *,
1061 (char *restrict s, char const *restrict delim,
1062 char **restrict save_ptr),
1063 _GL_ARG_NONNULL ((2, 3)));
1064 # endif
1065 _GL_CXXALIAS_SYS (strtok_r, char *,
1066 (char *restrict s, char const *restrict delim,
1067 char **restrict save_ptr));
1068 # endif
1069 _GL_CXXALIASWARN (strtok_r);
1070 # if defined GNULIB_POSIXCHECK
1071 _GL_WARN_ON_USE (strtok_r, "strtok_r cannot work correctly on character "
1072 "strings in multibyte locales - "
1073 "use mbstok_r if you care about internationalization");
1074 # endif
1075 #elif defined GNULIB_POSIXCHECK
1076 # undef strtok_r
1077 # if HAVE_RAW_DECL_STRTOK_R
1078 _GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - "
1079 "use gnulib module strtok_r for portability");
1080 # endif
1081 #endif
1082
1083
1084 /* The following functions are not specified by POSIX. They are gnulib
1085 extensions. */
1086
1087 #if @GNULIB_STR_STARTSWITH@
1088 /* Returns true if STRING starts with PREFIX.
1089 Returns false otherwise. */
1090 _GL_EXTERN_C bool str_startswith (const char *string, const char *prefix)
1091 _GL_ATTRIBUTE_PURE
1092 _GL_ARG_NONNULL ((1, 2));
1093 #endif
1094
1095 #if @GNULIB_STR_ENDSWITH@
1096 /* Returns true if STRING ends with SUFFIX.
1097 Returns false otherwise. */
1098 _GL_EXTERN_C bool str_endswith (const char *string, const char *prefix)
1099 _GL_ATTRIBUTE_PURE
1100 _GL_ARG_NONNULL ((1, 2));
1101 #endif
1102
1103 #if @GNULIB_MBSLEN@
1104 /* Return the number of multibyte characters in the character string STRING.
1105 This considers multibyte characters, unlike strlen, which counts bytes. */
1106 # ifdef __MirBSD__ /* MirBSD defines mbslen as a macro. Override it. */
1107 # undef mbslen
1108 # endif
1109 # if @HAVE_MBSLEN@ /* AIX, OSF/1, MirBSD define mbslen already in libc. */
1110 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1111 # define mbslen rpl_mbslen
1112 # endif
1113 _GL_FUNCDECL_RPL (mbslen, size_t, (const char *string),
1114 _GL_ATTRIBUTE_PURE
1115 _GL_ARG_NONNULL ((1)));
1116 _GL_CXXALIAS_RPL (mbslen, size_t, (const char *string));
1117 # else
1118 _GL_FUNCDECL_SYS (mbslen, size_t, (const char *string),
1119 _GL_ATTRIBUTE_PURE
1120 _GL_ARG_NONNULL ((1)));
1121 _GL_CXXALIAS_SYS (mbslen, size_t, (const char *string));
1122 # endif
1123 # if __GLIBC__ >= 2
1124 _GL_CXXALIASWARN (mbslen);
1125 # endif
1126 #endif
1127
1128 #if @GNULIB_MBSNLEN@
1129 /* Return the number of multibyte characters in the character string starting
1130 at STRING and ending at STRING + LEN. */
1131 _GL_EXTERN_C size_t mbsnlen (const char *string, size_t len)
1132 _GL_ATTRIBUTE_PURE
1133 _GL_ARG_NONNULL ((1));
1134 #endif
1135
1136 #if @GNULIB_MBSCHR@
1137 /* Locate the first single-byte character C in the character string STRING,
1138 and return a pointer to it. Return NULL if C is not found in STRING.
1139 Unlike strchr(), this function works correctly in multibyte locales with
1140 encodings such as GB18030. */
1141 # if defined __hpux
1142 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1143 # define mbschr rpl_mbschr /* avoid collision with HP-UX function */
1144 # endif
1145 _GL_FUNCDECL_RPL (mbschr, char *, (const char *string, int c),
1146 _GL_ATTRIBUTE_PURE
1147 _GL_ARG_NONNULL ((1)));
1148 _GL_CXXALIAS_RPL (mbschr, char *, (const char *string, int c));
1149 # else
1150 _GL_FUNCDECL_SYS (mbschr, char *, (const char *string, int c),
1151 _GL_ATTRIBUTE_PURE
1152 _GL_ARG_NONNULL ((1)));
1153 _GL_CXXALIAS_SYS (mbschr, char *, (const char *string, int c));
1154 # endif
1155 _GL_CXXALIASWARN (mbschr);
1156 #endif
1157
1158 #if @GNULIB_MBSRCHR@
1159 /* Locate the last single-byte character C in the character string STRING,
1160 and return a pointer to it. Return NULL if C is not found in STRING.
1161 Unlike strrchr(), this function works correctly in multibyte locales with
1162 encodings such as GB18030. */
1163 # if defined __hpux || defined __INTERIX
1164 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1165 # define mbsrchr rpl_mbsrchr /* avoid collision with system function */
1166 # endif
1167 _GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c),
1168 _GL_ATTRIBUTE_PURE
1169 _GL_ARG_NONNULL ((1)));
1170 _GL_CXXALIAS_RPL (mbsrchr, char *, (const char *string, int c));
1171 # else
1172 _GL_FUNCDECL_SYS (mbsrchr, char *, (const char *string, int c),
1173 _GL_ATTRIBUTE_PURE
1174 _GL_ARG_NONNULL ((1)));
1175 _GL_CXXALIAS_SYS (mbsrchr, char *, (const char *string, int c));
1176 # endif
1177 _GL_CXXALIASWARN (mbsrchr);
1178 #endif
1179
1180 #if @GNULIB_MBSSTR@
1181 /* Find the first occurrence of the character string NEEDLE in the character
1182 string HAYSTACK. Return NULL if NEEDLE is not found in HAYSTACK.
1183 Unlike strstr(), this function works correctly in multibyte locales with
1184 encodings different from UTF-8. */
1185 _GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle)
1186 _GL_ATTRIBUTE_PURE
1187 _GL_ARG_NONNULL ((1, 2));
1188 # ifndef _GL_NO_CONST_GENERICS
1189 /* Don't silently convert a 'const char *' to a 'char *'. Programmers want
1190 compiler warnings for 'const' related mistakes. */
1191 # ifdef __cplusplus
1192 extern "C++" { /* needed for AIX */
1193 template <typename T>
1194 T * mbsstr_template (T* haystack, const char *needle);
1195 template <>
1196 inline char * mbsstr_template (char *haystack, const char *needle)
1197 { return mbsstr (haystack, needle); }
1198 template <>
1199 inline const char * mbsstr_template (const char *haystack, const char *needle)
1200 { return mbsstr (haystack, needle); }
1201 }
1202 # undef mbsstr
1203 # define mbsstr mbsstr_template
1204 # elif !defined mbsstr
1205 # if ((__GNUC__ + (__GNUC_MINOR__ >= 9) > 4) || (__clang_major__ >= 3) \
1206 || defined __ICC || defined __TINYC__ \
1207 || (__STDC_VERSION__ >= 201112L && !(defined __GNUC__ || defined __clang__)))
1208 # define mbsstr(h,n) \
1209 _Generic ((h), \
1210 char const *: (char const *) mbsstr ((h), (n)), \
1211 default : mbsstr ((h), (n)))
1212 # endif
1213 # endif
1214 # endif
1215 #endif
1216
1217 #if @GNULIB_MBSCASECMP@
1218 /* Compare the character strings S1 and S2, ignoring case, returning less than,
1219 equal to or greater than zero if S1 is lexicographically less than, equal to
1220 or greater than S2.
1221 Note: This function may, in multibyte locales, return 0 for strings of
1222 different lengths!
1223 Unlike strcasecmp(), this function works correctly in multibyte locales. */
1224 _GL_EXTERN_C int mbscasecmp (const char *s1, const char *s2)
1225 _GL_ATTRIBUTE_PURE
1226 _GL_ARG_NONNULL ((1, 2));
1227 #endif
1228
1229 #if @GNULIB_MBSNCASECMP@
1230 /* Compare the initial segment of the character string S1 consisting of at most
1231 N characters with the initial segment of the character string S2 consisting
1232 of at most N characters, ignoring case, returning less than, equal to or
1233 greater than zero if the initial segment of S1 is lexicographically less
1234 than, equal to or greater than the initial segment of S2.
1235 Note: This function may, in multibyte locales, return 0 for initial segments
1236 of different lengths!
1237 Unlike strncasecmp(), this function works correctly in multibyte locales.
1238 But beware that N is not a byte count but a character count! */
1239 _GL_EXTERN_C int mbsncasecmp (const char *s1, const char *s2, size_t n)
1240 _GL_ATTRIBUTE_PURE
1241 _GL_ARG_NONNULL ((1, 2));
1242 #endif
1243
1244 #if @GNULIB_MBSPCASECMP@
1245 /* Compare the initial segment of the character string STRING consisting of
1246 at most mbslen (PREFIX) characters with the character string PREFIX,
1247 ignoring case. If the two match, return a pointer to the first byte
1248 after this prefix in STRING. Otherwise, return NULL.
1249 Note: This function may, in multibyte locales, return non-NULL if STRING
1250 is of smaller length than PREFIX!
1251 Unlike strncasecmp(), this function works correctly in multibyte
1252 locales. */
1253 _GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix)
1254 _GL_ATTRIBUTE_PURE
1255 _GL_ARG_NONNULL ((1, 2));
1256 # ifndef _GL_NO_CONST_GENERICS
1257 /* Don't silently convert a 'const char *' to a 'char *'. Programmers want
1258 compiler warnings for 'const' related mistakes. */
1259 # ifdef __cplusplus
1260 extern "C++" { /* needed for AIX */
1261 template <typename T>
1262 T * mbspcasecmp_template (T* string, const char *prefix);
1263 template <>
1264 inline char * mbspcasecmp_template (char *string, const char *prefix)
1265 { return mbspcasecmp (string, prefix); }
1266 template <>
1267 inline const char * mbspcasecmp_template (const char *string, const char *prefix)
1268 { return mbspcasecmp (string, prefix); }
1269 }
1270 # undef mbspcasecmp
1271 # define mbspcasecmp mbspcasecmp_template
1272 # elif !defined mbspcasecmp
1273 # if ((__GNUC__ + (__GNUC_MINOR__ >= 9) > 4) || (__clang_major__ >= 3) \
1274 || defined __ICC || defined __TINYC__ \
1275 || (__STDC_VERSION__ >= 201112L && !(defined __GNUC__ || defined __clang__)))
1276 # define mbspcasecmp(s,p) \
1277 _Generic ((s), \
1278 char const *: (char const *) mbspcasecmp ((s), (p)), \
1279 default : mbspcasecmp ((s), (p)))
1280 # endif
1281 # endif
1282 # endif
1283 #endif
1284
1285 #if @GNULIB_MBSCASESTR@
1286 /* Find the first occurrence of the character string NEEDLE in the character
1287 string HAYSTACK, using case-insensitive comparison.
1288 Note: This function may, in multibyte locales, return success even if
1289 strlen (haystack) < strlen (needle) !
1290 Unlike strcasestr(), this function works correctly in multibyte locales. */
1291 _GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle)
1292 _GL_ATTRIBUTE_PURE
1293 _GL_ARG_NONNULL ((1, 2));
1294 # ifndef _GL_NO_CONST_GENERICS
1295 /* Don't silently convert a 'const char *' to a 'char *'. Programmers want
1296 compiler warnings for 'const' related mistakes. */
1297 # ifdef __cplusplus
1298 extern "C++" { /* needed for AIX */
1299 template <typename T>
1300 T * mbscasestr_template (T* haystack, const char *needle);
1301 template <>
1302 inline char * mbscasestr_template (char *haystack, const char *needle)
1303 { return mbscasestr (haystack, needle); }
1304 template <>
1305 inline const char * mbscasestr_template (const char *haystack, const char *needle)
1306 { return mbscasestr (haystack, needle); }
1307 }
1308 # undef mbscasestr
1309 # define mbscasestr mbscasestr_template
1310 # elif !defined mbscasestr
1311 # if ((__GNUC__ + (__GNUC_MINOR__ >= 9) > 4) || (__clang_major__ >= 3) \
1312 || defined __ICC || defined __TINYC__ \
1313 || (__STDC_VERSION__ >= 201112L && !(defined __GNUC__ || defined __clang__)))
1314 # define mbscasestr(h,n) \
1315 _Generic ((h), \
1316 char const *: (char const *) mbscasestr ((h), (n)), \
1317 default : mbscasestr ((h), (n)))
1318 # endif
1319 # endif
1320 # endif
1321 #endif
1322
1323 #if @GNULIB_MBSCSPN@
1324 /* Find the first occurrence in the character string STRING of any character
1325 in the character string ACCEPT. Return the number of bytes from the
1326 beginning of the string to this occurrence, or to the end of the string
1327 if none exists.
1328 Unlike strcspn(), this function works correctly in multibyte locales. */
1329 _GL_EXTERN_C size_t mbscspn (const char *string, const char *accept)
1330 _GL_ATTRIBUTE_PURE
1331 _GL_ARG_NONNULL ((1, 2));
1332 #endif
1333
1334 #if @GNULIB_MBSPBRK@
1335 /* Find the first occurrence in the character string STRING of any character
1336 in the character string ACCEPT. Return the pointer to it, or NULL if none
1337 exists.
1338 Unlike strpbrk(), this function works correctly in multibyte locales. */
1339 # if defined __hpux
1340 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1341 # define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */
1342 # endif
1343 _GL_FUNCDECL_RPL (mbspbrk, char *, (const char *string, const char *accept),
1344 _GL_ATTRIBUTE_PURE
1345 _GL_ARG_NONNULL ((1, 2)));
1346 _GL_CXXALIAS_RPL (mbspbrk, char *, (const char *string, const char *accept));
1347 # else
1348 _GL_FUNCDECL_SYS (mbspbrk, char *, (const char *string, const char *accept),
1349 _GL_ATTRIBUTE_PURE
1350 _GL_ARG_NONNULL ((1, 2)));
1351 _GL_CXXALIAS_SYS (mbspbrk, char *, (const char *string, const char *accept));
1352 # endif
1353 _GL_CXXALIASWARN (mbspbrk);
1354 #endif
1355
1356 #if @GNULIB_MBSSPN@
1357 /* Find the first occurrence in the character string STRING of any character
1358 not in the character string REJECT. Return the number of bytes from the
1359 beginning of the string to this occurrence, or to the end of the string
1360 if none exists.
1361 Unlike strspn(), this function works correctly in multibyte locales. */
1362 _GL_EXTERN_C size_t mbsspn (const char *string, const char *reject)
1363 _GL_ATTRIBUTE_PURE
1364 _GL_ARG_NONNULL ((1, 2));
1365 #endif
1366
1367 #if @GNULIB_MBSSEP@
1368 /* Search the next delimiter (multibyte character listed in the character
1369 string DELIM) starting at the character string *STRINGP.
1370 If one is found, overwrite it with a NUL, and advance *STRINGP to point
1371 to the next multibyte character after it. Otherwise, set *STRINGP to NULL.
1372 If *STRINGP was already NULL, nothing happens.
1373 Return the old value of *STRINGP.
1374
1375 This is a variant of mbstok_r() that supports empty fields.
1376
1377 Caveat: It modifies the original string.
1378 Caveat: These functions cannot be used on constant strings.
1379 Caveat: The identity of the delimiting character is lost.
1380
1381 See also mbstok_r(). */
1382 _GL_EXTERN_C char * mbssep (char **stringp, const char *delim)
1383 _GL_ARG_NONNULL ((1, 2));
1384 #endif
1385
1386 #if @GNULIB_MBSTOK_R@
1387 /* Parse the character string STRING into tokens separated by characters in
1388 the character string DELIM.
1389 If STRING is NULL, the saved pointer in SAVE_PTR is used as
1390 the next starting point. For example:
1391 char s[] = "-abc-=-def";
1392 char *sp;
1393 x = mbstok_r(s, "-", &sp); // x = "abc", sp = "=-def"
1394 x = mbstok_r(NULL, "-=", &sp); // x = "def", sp = NULL
1395 x = mbstok_r(NULL, "=", &sp); // x = NULL
1396 // s = "abc\0-def\0"
1397
1398 Caveat: It modifies the original string.
1399 Caveat: These functions cannot be used on constant strings.
1400 Caveat: The identity of the delimiting character is lost.
1401
1402 See also mbssep(). */
1403 _GL_EXTERN_C char * mbstok_r (char *restrict string, const char *delim,
1404 char **save_ptr)
1405 _GL_ARG_NONNULL ((2, 3));
1406 #endif
1407
1408 #if @GNULIB_MBS_STARTSWITH@
1409 /* Returns true if STRING starts with PREFIX.
1410 Returns false otherwise. */
1411 _GL_EXTERN_C bool mbs_startswith (const char *string, const char *prefix)
1412 _GL_ATTRIBUTE_PURE
1413 _GL_ARG_NONNULL ((1, 2));
1414 /* No extra code is needed for multibyte locales for this function. */
1415 # define mbs_startswith str_startswith
1416 #endif
1417
1418 #if @GNULIB_MBS_ENDSWITH@
1419 /* Returns true if STRING ends with SUFFIX.
1420 Returns false otherwise.
1421 Unlike str_endswith(), this function works correctly in multibyte locales.
1422 */
1423 _GL_EXTERN_C bool mbs_endswith (const char *string, const char *suffix)
1424 _GL_ATTRIBUTE_PURE
1425 _GL_ARG_NONNULL ((1, 2));
1426 #endif
1427
1428 /* Map any int, typically from errno, into an error message. */
1429 #if @GNULIB_STRERROR@
1430 # if @REPLACE_STRERROR@
1431 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1432 # undef strerror
1433 # define strerror rpl_strerror
1434 # endif
1435 _GL_FUNCDECL_RPL (strerror, char *, (int), );
1436 _GL_CXXALIAS_RPL (strerror, char *, (int));
1437 # else
1438 _GL_CXXALIAS_SYS (strerror, char *, (int));
1439 # endif
1440 # if __GLIBC__ >= 2
1441 _GL_CXXALIASWARN (strerror);
1442 # endif
1443 #elif defined GNULIB_POSIXCHECK
1444 # undef strerror
1445 /* Assume strerror is always declared. */
1446 _GL_WARN_ON_USE (strerror, "strerror is unportable - "
1447 "use gnulib module strerror to guarantee non-NULL result");
1448 #endif
1449
1450 /* Map any int, typically from errno, into an error message. Multithread-safe.
1451 Uses the POSIX declaration, not the glibc declaration. */
1452 #if @GNULIB_STRERROR_R@
1453 # if @REPLACE_STRERROR_R@
1454 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1455 # undef strerror_r
1456 # define strerror_r rpl_strerror_r
1457 # endif
1458 _GL_FUNCDECL_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen),
1459 _GL_ARG_NONNULL ((2)));
1460 _GL_CXXALIAS_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen));
1461 # else
1462 # if !@HAVE_DECL_STRERROR_R@
1463 _GL_FUNCDECL_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen),
1464 _GL_ARG_NONNULL ((2)));
1465 # endif
1466 _GL_CXXALIAS_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen));
1467 # endif
1468 # if __GLIBC__ >= 2 && @HAVE_DECL_STRERROR_R@
1469 _GL_CXXALIASWARN (strerror_r);
1470 # endif
1471 #elif defined GNULIB_POSIXCHECK
1472 # undef strerror_r
1473 # if HAVE_RAW_DECL_STRERROR_R
1474 _GL_WARN_ON_USE (strerror_r, "strerror_r is unportable - "
1475 "use gnulib module strerror_r-posix for portability");
1476 # endif
1477 #endif
1478
1479 /* Map any int, typically from errno, into an error message.
1480 With locale_t argument. */
1481 #if @GNULIB_STRERROR_L@
1482 # if @REPLACE_STRERROR_L@
1483 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1484 # undef strerror_l
1485 # define strerror_l rpl_strerror_l
1486 # endif
1487 _GL_FUNCDECL_RPL (strerror_l, char *, (int errnum, locale_t locale),
1488 _GL_ARG_NONNULL ((2)));
1489 _GL_CXXALIAS_RPL (strerror_l, char *, (int errnum, locale_t locale));
1490 # else
1491 # if !@HAVE_STRERROR_L@
1492 _GL_FUNCDECL_SYS (strerror_l, char *, (int errnum, locale_t locale),
1493 _GL_ARG_NONNULL ((2)));
1494 # endif
1495 _GL_CXXALIAS_SYS (strerror_l, char *, (int errnum, locale_t locale));
1496 # endif
1497 # if __GLIBC__ >= 2
1498 _GL_CXXALIASWARN (strerror_l);
1499 # endif
1500 #elif defined GNULIB_POSIXCHECK
1501 # undef strerror_l
1502 /* Assume strerror_l is always declared. */
1503 _GL_WARN_ON_USE (strerror_l, "strerror_l is unportable - "
1504 "use gnulib module strerror_l for portability");
1505 #endif
1506
1507 /* Map any int, typically from errno, into an error message. Multithread-safe,
1508 with locale_t argument.
1509 Not portable! Only provided by gnulib. */
1510 #if @GNULIB_STRERROR_L@
1511 _GL_FUNCDECL_SYS (strerror_l_r, int,
1512 (int errnum, char *buf, size_t buflen, locale_t locale),
1513 _GL_ARG_NONNULL ((2, 4)));
1514 #endif
1515
1516 /* Return the name of the system error code ERRNUM. */
1517 #if @GNULIB_STRERRORNAME_NP@
1518 # if @REPLACE_STRERRORNAME_NP@
1519 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1520 # undef strerrorname_np
1521 # define strerrorname_np rpl_strerrorname_np
1522 # endif
1523 _GL_FUNCDECL_RPL (strerrorname_np, const char *, (int errnum), );
1524 _GL_CXXALIAS_RPL (strerrorname_np, const char *, (int errnum));
1525 # else
1526 # if !@HAVE_STRERRORNAME_NP@
1527 _GL_FUNCDECL_SYS (strerrorname_np, const char *, (int errnum), );
1528 # endif
1529 _GL_CXXALIAS_SYS (strerrorname_np, const char *, (int errnum));
1530 # endif
1531 # if __GLIBC__ >= 2
1532 _GL_CXXALIASWARN (strerrorname_np);
1533 # endif
1534 #elif defined GNULIB_POSIXCHECK
1535 # undef strerrorname_np
1536 # if HAVE_RAW_DECL_STRERRORNAME_NP
1537 _GL_WARN_ON_USE (strerrorname_np, "strerrorname_np is unportable - "
1538 "use gnulib module strerrorname_np for portability");
1539 # endif
1540 #endif
1541
1542 /* Return an abbreviation string for the signal number SIG. */
1543 #if @GNULIB_SIGABBREV_NP@
1544 # if ! @HAVE_SIGABBREV_NP@
1545 _GL_FUNCDECL_SYS (sigabbrev_np, const char *, (int sig), );
1546 # endif
1547 _GL_CXXALIAS_SYS (sigabbrev_np, const char *, (int sig));
1548 _GL_CXXALIASWARN (sigabbrev_np);
1549 #elif defined GNULIB_POSIXCHECK
1550 # undef sigabbrev_np
1551 # if HAVE_RAW_DECL_SIGABBREV_NP
1552 _GL_WARN_ON_USE (sigabbrev_np, "sigabbrev_np is unportable - "
1553 "use gnulib module sigabbrev_np for portability");
1554 # endif
1555 #endif
1556
1557 /* Return an English description string for the signal number SIG. */
1558 #if @GNULIB_SIGDESCR_NP@
1559 # if ! @HAVE_SIGDESCR_NP@
1560 _GL_FUNCDECL_SYS (sigdescr_np, const char *, (int sig), );
1561 # endif
1562 _GL_CXXALIAS_SYS (sigdescr_np, const char *, (int sig));
1563 _GL_CXXALIASWARN (sigdescr_np);
1564 #elif defined GNULIB_POSIXCHECK
1565 # undef sigdescr_np
1566 # if HAVE_RAW_DECL_SIGDESCR_NP
1567 _GL_WARN_ON_USE (sigdescr_np, "sigdescr_np is unportable - "
1568 "use gnulib module sigdescr_np for portability");
1569 # endif
1570 #endif
1571
1572 #if @GNULIB_STRSIGNAL@
1573 # if @REPLACE_STRSIGNAL@
1574 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1575 # define strsignal rpl_strsignal
1576 # endif
1577 _GL_FUNCDECL_RPL (strsignal, char *, (int __sig), );
1578 _GL_CXXALIAS_RPL (strsignal, char *, (int __sig));
1579 # else
1580 # if ! @HAVE_DECL_STRSIGNAL@
1581 _GL_FUNCDECL_SYS (strsignal, char *, (int __sig), );
1582 # endif
1583 /* Need to cast, because on Cygwin 1.5.x systems, the return type is
1584 'const char *'. */
1585 _GL_CXXALIAS_SYS_CAST (strsignal, char *, (int __sig));
1586 # endif
1587 _GL_CXXALIASWARN (strsignal);
1588 #elif defined GNULIB_POSIXCHECK
1589 # undef strsignal
1590 # if HAVE_RAW_DECL_STRSIGNAL
1591 _GL_WARN_ON_USE (strsignal, "strsignal is unportable - "
1592 "use gnulib module strsignal for portability");
1593 # endif
1594 #endif
1595
1596 #if @GNULIB_STRVERSCMP@
1597 # if @REPLACE_STRVERSCMP@
1598 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1599 # define strverscmp rpl_strverscmp
1600 # endif
1601 _GL_FUNCDECL_RPL (strverscmp, int, (const char *, const char *),
1602 _GL_ATTRIBUTE_PURE
1603 _GL_ARG_NONNULL ((1, 2)));
1604 _GL_CXXALIAS_RPL (strverscmp, int, (const char *, const char *));
1605 # else
1606 # if !@HAVE_STRVERSCMP@
1607 _GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *),
1608 _GL_ATTRIBUTE_PURE
1609 _GL_ARG_NONNULL ((1, 2)));
1610 # endif
1611 _GL_CXXALIAS_SYS (strverscmp, int, (const char *, const char *));
1612 # endif
1613 _GL_CXXALIASWARN (strverscmp);
1614 #elif defined GNULIB_POSIXCHECK
1615 # undef strverscmp
1616 # if HAVE_RAW_DECL_STRVERSCMP
1617 _GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - "
1618 "use gnulib module strverscmp for portability");
1619 # endif
1620 #endif
1621
1622
1623 #endif /* _@GUARD_PREFIX@_STRING_H */
1624 #endif /* _@GUARD_PREFIX@_STRING_H */
1625 #endif