root/maint/gnulib/lib/string.in.h

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

/* [previous][next][first][last][top][bottom][index][help] */