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