1/* -*- buffer-read-only: t -*- vi: set ro: */ 2/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ 3#line 1 4/* A GNU-like <string.h>. 5 6 Copyright (C) 1995-1996, 2001-2010 Free Software Foundation, Inc. 7 8 This program is free software; you can redistribute it and/or modify 9 it under the terms of the GNU General Public License as published by 10 the Free Software Foundation; either version 3, or (at your option) 11 any later version. 12 13 This program is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with this program; if not, write to the Free Software Foundation, 20 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ 21 22#ifndef _GL_STRING_H 23 24#if __GNUC__ >= 3 25@PRAGMA_SYSTEM_HEADER@ 26#endif 27 28/* The include_next requires a split double-inclusion guard. */ 29#@INCLUDE_NEXT@ @NEXT_STRING_H@ 30 31#ifndef _GL_STRING_H 32#define _GL_STRING_H 33 34/* NetBSD 5.0 mis-defines NULL. */ 35#include <stddef.h> 36 37/* MirBSD defines mbslen as a macro. */ 38#if @GNULIB_MBSLEN@ && defined __MirBSD__ 39# include <wchar.h> 40#endif 41 42#ifndef __attribute__ 43/* This feature is available in gcc versions 2.5 and later. */ 44# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) 45# define __attribute__(Spec) /* empty */ 46# endif 47/* The attribute __pure__ was added in gcc 2.96. */ 48# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 96) 49# define __pure__ /* empty */ 50# endif 51#endif 52 53 54/* The definition of GL_LINK_WARNING is copied here. */ 55 56/* The definition of _GL_ARG_NONNULL is copied here. */ 57 58 59#ifdef __cplusplus 60extern "C" { 61#endif 62 63 64/* Return the first instance of C within N bytes of S, or NULL. */ 65#if @GNULIB_MEMCHR@ 66# if @REPLACE_MEMCHR@ 67# define memchr rpl_memchr 68extern void *memchr (void const *__s, int __c, size_t __n) 69 __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1)); 70# endif 71#elif defined GNULIB_POSIXCHECK 72# undef memchr 73# define memchr(s,c,n) \ 74 (GL_LINK_WARNING ("memchr has platform-specific bugs - " \ 75 "use gnulib module memchr for portability" ), \ 76 memchr (s, c, n)) 77#endif 78 79/* Return the first occurrence of NEEDLE in HAYSTACK. */ 80#if @GNULIB_MEMMEM@ 81# if @REPLACE_MEMMEM@ 82# define memmem rpl_memmem 83# endif 84# if ! @HAVE_DECL_MEMMEM@ || @REPLACE_MEMMEM@ 85extern void *memmem (void const *__haystack, size_t __haystack_len, 86 void const *__needle, size_t __needle_len) 87 __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 3)); 88# endif 89#elif defined GNULIB_POSIXCHECK 90# undef memmem 91# define memmem(a,al,b,bl) \ 92 (GL_LINK_WARNING ("memmem is unportable and often quadratic - " \ 93 "use gnulib module memmem-simple for portability, " \ 94 "and module memmem for speed" ), \ 95 memmem (a, al, b, bl)) 96#endif 97 98/* Copy N bytes of SRC to DEST, return pointer to bytes after the 99 last written byte. */ 100#if @GNULIB_MEMPCPY@ 101# if ! @HAVE_MEMPCPY@ 102extern void *mempcpy (void *restrict __dest, void const *restrict __src, 103 size_t __n) 104 _GL_ARG_NONNULL ((1, 2)); 105# endif 106#elif defined GNULIB_POSIXCHECK 107# undef mempcpy 108# define mempcpy(a,b,n) \ 109 (GL_LINK_WARNING ("mempcpy is unportable - " \ 110 "use gnulib module mempcpy for portability"), \ 111 mempcpy (a, b, n)) 112#endif 113 114/* Search backwards through a block for a byte (specified as an int). */ 115#if @GNULIB_MEMRCHR@ 116# if ! @HAVE_DECL_MEMRCHR@ 117extern void *memrchr (void const *, int, size_t) 118 __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1)); 119# endif 120#elif defined GNULIB_POSIXCHECK 121# undef memrchr 122# define memrchr(a,b,c) \ 123 (GL_LINK_WARNING ("memrchr is unportable - " \ 124 "use gnulib module memrchr for portability"), \ 125 memrchr (a, b, c)) 126#endif 127 128/* Find the first occurrence of C in S. More efficient than 129 memchr(S,C,N), at the expense of undefined behavior if C does not 130 occur within N bytes. */ 131#if @GNULIB_RAWMEMCHR@ 132# if ! @HAVE_RAWMEMCHR@ 133extern void *rawmemchr (void const *__s, int __c_in) 134 __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1)); 135# endif 136#elif defined GNULIB_POSIXCHECK 137# undef rawmemchr 138# define rawmemchr(a,b) \ 139 (GL_LINK_WARNING ("rawmemchr is unportable - " \ 140 "use gnulib module rawmemchr for portability"), \ 141 rawmemchr (a, b)) 142#endif 143 144/* Copy SRC to DST, returning the address of the terminating '\0' in DST. */ 145#if @GNULIB_STPCPY@ 146# if ! @HAVE_STPCPY@ 147extern char *stpcpy (char *restrict __dst, char const *restrict __src) 148 _GL_ARG_NONNULL ((1, 2)); 149# endif 150#elif defined GNULIB_POSIXCHECK 151# undef stpcpy 152# define stpcpy(a,b) \ 153 (GL_LINK_WARNING ("stpcpy is unportable - " \ 154 "use gnulib module stpcpy for portability"), \ 155 stpcpy (a, b)) 156#endif 157 158/* Copy no more than N bytes of SRC to DST, returning a pointer past the 159 last non-NUL byte written into DST. */ 160#if @GNULIB_STPNCPY@ 161# if ! @HAVE_STPNCPY@ 162# define stpncpy gnu_stpncpy 163extern char *stpncpy (char *restrict __dst, char const *restrict __src, 164 size_t __n) 165 _GL_ARG_NONNULL ((1, 2)); 166# endif 167#elif defined GNULIB_POSIXCHECK 168# undef stpncpy 169# define stpncpy(a,b,n) \ 170 (GL_LINK_WARNING ("stpncpy is unportable - " \ 171 "use gnulib module stpncpy for portability"), \ 172 stpncpy (a, b, n)) 173#endif 174 175#if defined GNULIB_POSIXCHECK 176/* strchr() does not work with multibyte strings if the locale encoding is 177 GB18030 and the character to be searched is a digit. */ 178# undef strchr 179# define strchr(s,c) \ 180 (GL_LINK_WARNING ("strchr cannot work correctly on character strings " \ 181 "in some multibyte locales - " \ 182 "use mbschr if you care about internationalization"), \ 183 strchr (s, c)) 184#endif 185 186/* Find the first occurrence of C in S or the final NUL byte. */ 187#if @GNULIB_STRCHRNUL@ 188# if ! @HAVE_STRCHRNUL@ 189extern char *strchrnul (char const *__s, int __c_in) 190 __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1)); 191# endif 192#elif defined GNULIB_POSIXCHECK 193# undef strchrnul 194# define strchrnul(a,b) \ 195 (GL_LINK_WARNING ("strchrnul is unportable - " \ 196 "use gnulib module strchrnul for portability"), \ 197 strchrnul (a, b)) 198#endif 199 200/* Duplicate S, returning an identical malloc'd string. */ 201#if @GNULIB_STRDUP@ 202# if @REPLACE_STRDUP@ 203# undef strdup 204# define strdup rpl_strdup 205# endif 206# if !(@HAVE_DECL_STRDUP@ || defined strdup) || @REPLACE_STRDUP@ 207extern char *strdup (char const *__s) _GL_ARG_NONNULL ((1)); 208# endif 209#elif defined GNULIB_POSIXCHECK 210# undef strdup 211# define strdup(a) \ 212 (GL_LINK_WARNING ("strdup is unportable - " \ 213 "use gnulib module strdup for portability"), \ 214 strdup (a)) 215#endif 216 217/* Return a newly allocated copy of at most N bytes of STRING. */ 218#if @GNULIB_STRNDUP@ 219# if @REPLACE_STRNDUP@ 220# undef strndup 221# define strndup rpl_strndup 222# endif 223# if @REPLACE_STRNDUP@ || ! @HAVE_DECL_STRNDUP@ 224extern char *strndup (char const *__string, size_t __n) _GL_ARG_NONNULL ((1)); 225# endif 226#elif defined GNULIB_POSIXCHECK 227# undef strndup 228# define strndup(a,n) \ 229 (GL_LINK_WARNING ("strndup is unportable - " \ 230 "use gnulib module strndup for portability"), \ 231 strndup (a, n)) 232#endif 233 234/* Find the length (number of bytes) of STRING, but scan at most 235 MAXLEN bytes. If no '\0' terminator is found in that many bytes, 236 return MAXLEN. */ 237#if @GNULIB_STRNLEN@ 238# if ! @HAVE_DECL_STRNLEN@ 239extern size_t strnlen (char const *__string, size_t __maxlen) 240 __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1)); 241# endif 242#elif defined GNULIB_POSIXCHECK 243# undef strnlen 244# define strnlen(a,n) \ 245 (GL_LINK_WARNING ("strnlen is unportable - " \ 246 "use gnulib module strnlen for portability"), \ 247 strnlen (a, n)) 248#endif 249 250#if defined GNULIB_POSIXCHECK 251/* strcspn() assumes the second argument is a list of single-byte characters. 252 Even in this simple case, it does not work with multibyte strings if the 253 locale encoding is GB18030 and one of the characters to be searched is a 254 digit. */ 255# undef strcspn 256# define strcspn(s,a) \ 257 (GL_LINK_WARNING ("strcspn cannot work correctly on character strings " \ 258 "in multibyte locales - " \ 259 "use mbscspn if you care about internationalization"), \ 260 strcspn (s, a)) 261#endif 262 263/* Find the first occurrence in S of any character in ACCEPT. */ 264#if @GNULIB_STRPBRK@ 265# if ! @HAVE_STRPBRK@ 266extern char *strpbrk (char const *__s, char const *__accept) 267 __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 2)); 268# endif 269# if defined GNULIB_POSIXCHECK 270/* strpbrk() assumes the second argument is a list of single-byte characters. 271 Even in this simple case, it does not work with multibyte strings if the 272 locale encoding is GB18030 and one of the characters to be searched is a 273 digit. */ 274# undef strpbrk 275# define strpbrk(s,a) \ 276 (GL_LINK_WARNING ("strpbrk cannot work correctly on character strings " \ 277 "in multibyte locales - " \ 278 "use mbspbrk if you care about internationalization"), \ 279 strpbrk (s, a)) 280# endif 281#elif defined GNULIB_POSIXCHECK 282# undef strpbrk 283# define strpbrk(s,a) \ 284 (GL_LINK_WARNING ("strpbrk is unportable - " \ 285 "use gnulib module strpbrk for portability"), \ 286 strpbrk (s, a)) 287#endif 288 289#if defined GNULIB_POSIXCHECK 290/* strspn() assumes the second argument is a list of single-byte characters. 291 Even in this simple case, it cannot work with multibyte strings. */ 292# undef strspn 293# define strspn(s,a) \ 294 (GL_LINK_WARNING ("strspn cannot work correctly on character strings " \ 295 "in multibyte locales - " \ 296 "use mbsspn if you care about internationalization"), \ 297 strspn (s, a)) 298#endif 299 300#if defined GNULIB_POSIXCHECK 301/* strrchr() does not work with multibyte strings if the locale encoding is 302 GB18030 and the character to be searched is a digit. */ 303# undef strrchr 304# define strrchr(s,c) \ 305 (GL_LINK_WARNING ("strrchr cannot work correctly on character strings " \ 306 "in some multibyte locales - " \ 307 "use mbsrchr if you care about internationalization"), \ 308 strrchr (s, c)) 309#endif 310 311/* Search the next delimiter (char listed in DELIM) starting at *STRINGP. 312 If one is found, overwrite it with a NUL, and advance *STRINGP 313 to point to the next char after it. Otherwise, set *STRINGP to NULL. 314 If *STRINGP was already NULL, nothing happens. 315 Return the old value of *STRINGP. 316 317 This is a variant of strtok() that is multithread-safe and supports 318 empty fields. 319 320 Caveat: It modifies the original string. 321 Caveat: These functions cannot be used on constant strings. 322 Caveat: The identity of the delimiting character is lost. 323 Caveat: It doesn't work with multibyte strings unless all of the delimiter 324 characters are ASCII characters < 0x30. 325 326 See also strtok_r(). */ 327#if @GNULIB_STRSEP@ 328# if ! @HAVE_STRSEP@ 329extern char *strsep (char **restrict __stringp, char const *restrict __delim) 330 _GL_ARG_NONNULL ((1, 2)); 331# endif 332# if defined GNULIB_POSIXCHECK 333# undef strsep 334# define strsep(s,d) \ 335 (GL_LINK_WARNING ("strsep cannot work correctly on character strings " \ 336 "in multibyte locales - " \ 337 "use mbssep if you care about internationalization"), \ 338 strsep (s, d)) 339# endif 340#elif defined GNULIB_POSIXCHECK 341# undef strsep 342# define strsep(s,d) \ 343 (GL_LINK_WARNING ("strsep is unportable - " \ 344 "use gnulib module strsep for portability"), \ 345 strsep (s, d)) 346#endif 347 348#if @GNULIB_STRSTR@ 349# if @REPLACE_STRSTR@ 350# define strstr rpl_strstr 351extern char *strstr (const char *haystack, const char *needle) 352 __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 2)); 353# endif 354#elif defined GNULIB_POSIXCHECK 355/* strstr() does not work with multibyte strings if the locale encoding is 356 different from UTF-8: 357 POSIX says that it operates on "strings", and "string" in POSIX is defined 358 as a sequence of bytes, not of characters. */ 359# undef strstr 360# define strstr(a,b) \ 361 (GL_LINK_WARNING ("strstr is quadratic on many systems, and cannot " \ 362 "work correctly on character strings in most " \ 363 "multibyte locales - " \ 364 "use mbsstr if you care about internationalization, " \ 365 "or use strstr if you care about speed"), \ 366 strstr (a, b)) 367#endif 368 369/* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive 370 comparison. */ 371#if @GNULIB_STRCASESTR@ 372# if @REPLACE_STRCASESTR@ 373# define strcasestr rpl_strcasestr 374# endif 375# if ! @HAVE_STRCASESTR@ || @REPLACE_STRCASESTR@ 376extern char *strcasestr (const char *haystack, const char *needle) 377 __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 2)); 378# endif 379#elif defined GNULIB_POSIXCHECK 380/* strcasestr() does not work with multibyte strings: 381 It is a glibc extension, and glibc implements it only for unibyte 382 locales. */ 383# undef strcasestr 384# define strcasestr(a,b) \ 385 (GL_LINK_WARNING ("strcasestr does work correctly on character strings " \ 386 "in multibyte locales - " \ 387 "use mbscasestr if you care about " \ 388 "internationalization, or use c-strcasestr if you want " \ 389 "a locale independent function"), \ 390 strcasestr (a, b)) 391#endif 392 393/* Parse S into tokens separated by characters in DELIM. 394 If S is NULL, the saved pointer in SAVE_PTR is used as 395 the next starting point. For example: 396 char s[] = "-abc-=-def"; 397 char *sp; 398 x = strtok_r(s, "-", &sp); // x = "abc", sp = "=-def" 399 x = strtok_r(NULL, "-=", &sp); // x = "def", sp = NULL 400 x = strtok_r(NULL, "=", &sp); // x = NULL 401 // s = "abc\0-def\0" 402 403 This is a variant of strtok() that is multithread-safe. 404 405 For the POSIX documentation for this function, see: 406 http://www.opengroup.org/susv3xsh/strtok.html 407 408 Caveat: It modifies the original string. 409 Caveat: These functions cannot be used on constant strings. 410 Caveat: The identity of the delimiting character is lost. 411 Caveat: It doesn't work with multibyte strings unless all of the delimiter 412 characters are ASCII characters < 0x30. 413 414 See also strsep(). */ 415#if @GNULIB_STRTOK_R@ 416# if @REPLACE_STRTOK_R@ 417# undef strtok_r 418# define strtok_r rpl_strtok_r 419# elif @UNDEFINE_STRTOK_R@ 420# undef strtok_r 421# endif 422# if ! @HAVE_DECL_STRTOK_R@ || @REPLACE_STRTOK_R@ 423extern char *strtok_r (char *restrict s, char const *restrict delim, 424 char **restrict save_ptr) 425 _GL_ARG_NONNULL ((2, 3)); 426# endif 427# if defined GNULIB_POSIXCHECK 428# undef strtok_r 429# define strtok_r(s,d,p) \ 430 (GL_LINK_WARNING ("strtok_r cannot work correctly on character strings " \ 431 "in multibyte locales - " \ 432 "use mbstok_r if you care about internationalization"), \ 433 strtok_r (s, d, p)) 434# endif 435#elif defined GNULIB_POSIXCHECK 436# undef strtok_r 437# define strtok_r(s,d,p) \ 438 (GL_LINK_WARNING ("strtok_r is unportable - " \ 439 "use gnulib module strtok_r for portability"), \ 440 strtok_r (s, d, p)) 441#endif 442 443 444/* The following functions are not specified by POSIX. They are gnulib 445 extensions. */ 446 447#if @GNULIB_MBSLEN@ 448/* Return the number of multibyte characters in the character string STRING. 449 This considers multibyte characters, unlike strlen, which counts bytes. */ 450# ifdef __MirBSD__ /* MirBSD defines mbslen as a macro. Override it. */ 451# undef mbslen 452# endif 453# if @HAVE_MBSLEN@ /* AIX, OSF/1, MirBSD define mbslen already in libc. */ 454# define mbslen rpl_mbslen 455# endif 456extern size_t mbslen (const char *string) _GL_ARG_NONNULL ((1)); 457#endif 458 459#if @GNULIB_MBSNLEN@ 460/* Return the number of multibyte characters in the character string starting 461 at STRING and ending at STRING + LEN. */ 462extern size_t mbsnlen (const char *string, size_t len) _GL_ARG_NONNULL ((1)); 463#endif 464 465#if @GNULIB_MBSCHR@ 466/* Locate the first single-byte character C in the character string STRING, 467 and return a pointer to it. Return NULL if C is not found in STRING. 468 Unlike strchr(), this function works correctly in multibyte locales with 469 encodings such as GB18030. */ 470# define mbschr rpl_mbschr /* avoid collision with HP-UX function */ 471extern char * mbschr (const char *string, int c) _GL_ARG_NONNULL ((1)); 472#endif 473 474#if @GNULIB_MBSRCHR@ 475/* Locate the last single-byte character C in the character string STRING, 476 and return a pointer to it. Return NULL if C is not found in STRING. 477 Unlike strrchr(), this function works correctly in multibyte locales with 478 encodings such as GB18030. */ 479# define mbsrchr rpl_mbsrchr /* avoid collision with HP-UX function */ 480extern char * mbsrchr (const char *string, int c) _GL_ARG_NONNULL ((1)); 481#endif 482 483#if @GNULIB_MBSSTR@ 484/* Find the first occurrence of the character string NEEDLE in the character 485 string HAYSTACK. Return NULL if NEEDLE is not found in HAYSTACK. 486 Unlike strstr(), this function works correctly in multibyte locales with 487 encodings different from UTF-8. */ 488extern char * mbsstr (const char *haystack, const char *needle) 489 _GL_ARG_NONNULL ((1, 2)); 490#endif 491 492#if @GNULIB_MBSCASECMP@ 493/* Compare the character strings S1 and S2, ignoring case, returning less than, 494 equal to or greater than zero if S1 is lexicographically less than, equal to 495 or greater than S2. 496 Note: This function may, in multibyte locales, return 0 for strings of 497 different lengths! 498 Unlike strcasecmp(), this function works correctly in multibyte locales. */ 499extern int mbscasecmp (const char *s1, const char *s2) 500 _GL_ARG_NONNULL ((1, 2)); 501#endif 502 503#if @GNULIB_MBSNCASECMP@ 504/* Compare the initial segment of the character string S1 consisting of at most 505 N characters with the initial segment of the character string S2 consisting 506 of at most N characters, ignoring case, returning less than, equal to or 507 greater than zero if the initial segment of S1 is lexicographically less 508 than, equal to or greater than the initial segment of S2. 509 Note: This function may, in multibyte locales, return 0 for initial segments 510 of different lengths! 511 Unlike strncasecmp(), this function works correctly in multibyte locales. 512 But beware that N is not a byte count but a character count! */ 513extern int mbsncasecmp (const char *s1, const char *s2, size_t n) 514 _GL_ARG_NONNULL ((1, 2)); 515#endif 516 517#if @GNULIB_MBSPCASECMP@ 518/* Compare the initial segment of the character string STRING consisting of 519 at most mbslen (PREFIX) characters with the character string PREFIX, 520 ignoring case, returning less than, equal to or greater than zero if this 521 initial segment is lexicographically less than, equal to or greater than 522 PREFIX. 523 Note: This function may, in multibyte locales, return 0 if STRING is of 524 smaller length than PREFIX! 525 Unlike strncasecmp(), this function works correctly in multibyte 526 locales. */ 527extern char * mbspcasecmp (const char *string, const char *prefix) 528 _GL_ARG_NONNULL ((1, 2)); 529#endif 530 531#if @GNULIB_MBSCASESTR@ 532/* Find the first occurrence of the character string NEEDLE in the character 533 string HAYSTACK, using case-insensitive comparison. 534 Note: This function may, in multibyte locales, return success even if 535 strlen (haystack) < strlen (needle) ! 536 Unlike strcasestr(), this function works correctly in multibyte locales. */ 537extern char * mbscasestr (const char *haystack, const char *needle) 538 _GL_ARG_NONNULL ((1, 2)); 539#endif 540 541#if @GNULIB_MBSCSPN@ 542/* Find the first occurrence in the character string STRING of any character 543 in the character string ACCEPT. Return the number of bytes from the 544 beginning of the string to this occurrence, or to the end of the string 545 if none exists. 546 Unlike strcspn(), this function works correctly in multibyte locales. */ 547extern size_t mbscspn (const char *string, const char *accept) 548 _GL_ARG_NONNULL ((1, 2)); 549#endif 550 551#if @GNULIB_MBSPBRK@ 552/* Find the first occurrence in the character string STRING of any character 553 in the character string ACCEPT. Return the pointer to it, or NULL if none 554 exists. 555 Unlike strpbrk(), this function works correctly in multibyte locales. */ 556# define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */ 557extern char * mbspbrk (const char *string, const char *accept) 558 _GL_ARG_NONNULL ((1, 2)); 559#endif 560 561#if @GNULIB_MBSSPN@ 562/* Find the first occurrence in the character string STRING of any character 563 not in the character string REJECT. Return the number of bytes from the 564 beginning of the string to this occurrence, or to the end of the string 565 if none exists. 566 Unlike strspn(), this function works correctly in multibyte locales. */ 567extern size_t mbsspn (const char *string, const char *reject) 568 _GL_ARG_NONNULL ((1, 2)); 569#endif 570 571#if @GNULIB_MBSSEP@ 572/* Search the next delimiter (multibyte character listed in the character 573 string DELIM) starting at the character string *STRINGP. 574 If one is found, overwrite it with a NUL, and advance *STRINGP to point 575 to the next multibyte character after it. Otherwise, set *STRINGP to NULL. 576 If *STRINGP was already NULL, nothing happens. 577 Return the old value of *STRINGP. 578 579 This is a variant of mbstok_r() that supports empty fields. 580 581 Caveat: It modifies the original string. 582 Caveat: These functions cannot be used on constant strings. 583 Caveat: The identity of the delimiting character is lost. 584 585 See also mbstok_r(). */ 586extern char * mbssep (char **stringp, const char *delim) 587 _GL_ARG_NONNULL ((1, 2)); 588#endif 589 590#if @GNULIB_MBSTOK_R@ 591/* Parse the character string STRING into tokens separated by characters in 592 the character string DELIM. 593 If STRING is NULL, the saved pointer in SAVE_PTR is used as 594 the next starting point. For example: 595 char s[] = "-abc-=-def"; 596 char *sp; 597 x = mbstok_r(s, "-", &sp); // x = "abc", sp = "=-def" 598 x = mbstok_r(NULL, "-=", &sp); // x = "def", sp = NULL 599 x = mbstok_r(NULL, "=", &sp); // x = NULL 600 // s = "abc\0-def\0" 601 602 Caveat: It modifies the original string. 603 Caveat: These functions cannot be used on constant strings. 604 Caveat: The identity of the delimiting character is lost. 605 606 See also mbssep(). */ 607extern char * mbstok_r (char *string, const char *delim, char **save_ptr) 608 _GL_ARG_NONNULL ((2, 3)); 609#endif 610 611/* Map any int, typically from errno, into an error message. */ 612#if @GNULIB_STRERROR@ 613# if @REPLACE_STRERROR@ 614# undef strerror 615# define strerror rpl_strerror 616extern char *strerror (int); 617# endif 618#elif defined GNULIB_POSIXCHECK 619# undef strerror 620# define strerror(e) \ 621 (GL_LINK_WARNING ("strerror is unportable - " \ 622 "use gnulib module strerror to guarantee non-NULL result"), \ 623 strerror (e)) 624#endif 625 626#if @GNULIB_STRSIGNAL@ 627# if @REPLACE_STRSIGNAL@ 628# define strsignal rpl_strsignal 629# endif 630# if ! @HAVE_DECL_STRSIGNAL@ || @REPLACE_STRSIGNAL@ 631extern char *strsignal (int __sig); 632# endif 633#elif defined GNULIB_POSIXCHECK 634# undef strsignal 635# define strsignal(a) \ 636 (GL_LINK_WARNING ("strsignal is unportable - " \ 637 "use gnulib module strsignal for portability"), \ 638 strsignal (a)) 639#endif 640 641#if @GNULIB_STRVERSCMP@ 642# if !@HAVE_STRVERSCMP@ 643extern int strverscmp (const char *, const char *) _GL_ARG_NONNULL ((1, 2)); 644# endif 645#elif defined GNULIB_POSIXCHECK 646# undef strverscmp 647# define strverscmp(a, b) \ 648 (GL_LINK_WARNING ("strverscmp is unportable - " \ 649 "use gnulib module strverscmp for portability"), \ 650 strverscmp (a, b)) 651#endif 652 653 654#ifdef __cplusplus 655} 656#endif 657 658#endif /* _GL_STRING_H */ 659#endif /* _GL_STRING_H */ 660