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