annotate lib/string.in.h @ 11621:c98fca1ff8b8

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