annotate lib/string.in.h @ 11624:82b5a4d577af

docs: memchr is no longer obsolete * MODULES.html.sh: Move memchr from obsolete to string.h section. * lib/string.in.h (memchr): Simplify logic. Signed-off-by: Eric Blake <ebb9@byu.net>
author Eric Blake <ebb9@byu.net>
date Mon, 15 Jun 2009 07:49:35 -0600
parents c98fca1ff8b8
children ff3dd373542b
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 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
57 __attribute__ ((__pure__));
c98fca1ff8b8 memchr: detect broken x86_64 and alpha implementations
Eric Blake <ebb9@byu.net>
parents: 10655
diff changeset
58 # endif
c98fca1ff8b8 memchr: detect broken x86_64 and alpha implementations
Eric Blake <ebb9@byu.net>
parents: 10655
diff changeset
59 #elif defined GNULIB_POSIXCHECK
c98fca1ff8b8 memchr: detect broken x86_64 and alpha implementations
Eric Blake <ebb9@byu.net>
parents: 10655
diff changeset
60 # undef memchr
c98fca1ff8b8 memchr: detect broken x86_64 and alpha implementations
Eric Blake <ebb9@byu.net>
parents: 10655
diff changeset
61 # define memchr(s,c,n) \
c98fca1ff8b8 memchr: detect broken x86_64 and alpha implementations
Eric Blake <ebb9@byu.net>
parents: 10655
diff changeset
62 (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
63 "use gnulib module memchr for portability" ), \
c98fca1ff8b8 memchr: detect broken x86_64 and alpha implementations
Eric Blake <ebb9@byu.net>
parents: 10655
diff changeset
64 memchr (s, c, n))
c98fca1ff8b8 memchr: detect broken x86_64 and alpha implementations
Eric Blake <ebb9@byu.net>
parents: 10655
diff changeset
65 #endif
c98fca1ff8b8 memchr: detect broken x86_64 and alpha implementations
Eric Blake <ebb9@byu.net>
parents: 10655
diff changeset
66
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
67 /* Return the first occurrence of NEEDLE in HAYSTACK. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
68 #if @GNULIB_MEMMEM@
9538
43d9769bf4d0 Fix memmem to avoid O(n^2) worst-case complexity.
Eric Blake <ebb9@byu.net>
parents: 9496
diff changeset
69 # if @REPLACE_MEMMEM@
43d9769bf4d0 Fix memmem to avoid O(n^2) worst-case complexity.
Eric Blake <ebb9@byu.net>
parents: 9496
diff changeset
70 # define memmem rpl_memmem
43d9769bf4d0 Fix memmem to avoid O(n^2) worst-case complexity.
Eric Blake <ebb9@byu.net>
parents: 9496
diff changeset
71 # endif
43d9769bf4d0 Fix memmem to avoid O(n^2) worst-case complexity.
Eric Blake <ebb9@byu.net>
parents: 9496
diff changeset
72 # if ! @HAVE_DECL_MEMMEM@ || @REPLACE_MEMMEM@
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
73 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
74 void const *__needle, size_t __needle_len)
246fc6fd3787 Give gcc some memmem optimization hints.
Eric Blake <ebb9@byu.net>
parents: 9538
diff changeset
75 __attribute__ ((__pure__));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
76 # endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
77 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
78 # undef memmem
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
79 # define memmem(a,al,b,bl) \
9600
99268e709d31 Avoid quadratic strstr implementations.
Eric Blake <ebb9@byu.net>
parents: 9590
diff changeset
80 (GL_LINK_WARNING ("memmem is unportable and often quadratic - " \
99268e709d31 Avoid quadratic strstr implementations.
Eric Blake <ebb9@byu.net>
parents: 9590
diff changeset
81 "use gnulib module memmem-simple for portability, " \
99268e709d31 Avoid quadratic strstr implementations.
Eric Blake <ebb9@byu.net>
parents: 9590
diff changeset
82 "and module memmem for speed" ), \
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
83 memmem (a, al, b, bl))
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
84 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
85
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
86 /* 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
87 last written byte. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
88 #if @GNULIB_MEMPCPY@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
89 # if ! @HAVE_MEMPCPY@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
90 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
91 size_t __n);
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
92 # endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
93 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
94 # undef mempcpy
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
95 # define mempcpy(a,b,n) \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
96 (GL_LINK_WARNING ("mempcpy is unportable - " \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
97 "use gnulib module mempcpy for portability"), \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
98 mempcpy (a, b, n))
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
99 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
100
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
101 /* 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
102 #if @GNULIB_MEMRCHR@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
103 # if ! @HAVE_DECL_MEMRCHR@
9590
246fc6fd3787 Give gcc some memmem optimization hints.
Eric Blake <ebb9@byu.net>
parents: 9538
diff changeset
104 extern void *memrchr (void const *, int, size_t)
246fc6fd3787 Give gcc some memmem optimization hints.
Eric Blake <ebb9@byu.net>
parents: 9538
diff changeset
105 __attribute__ ((__pure__));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
106 # endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
107 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
108 # undef memrchr
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
109 # define memrchr(a,b,c) \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
110 (GL_LINK_WARNING ("memrchr is unportable - " \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
111 "use gnulib module memrchr for portability"), \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
112 memrchr (a, b, c))
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
113 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
114
9999
5f559abfabef Add rawmemchr module, matching glibc.
Eric Blake <ebb9@byu.net>
parents: 9623
diff changeset
115 /* 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
116 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
117 occur within N bytes. */
5f559abfabef Add rawmemchr module, matching glibc.
Eric Blake <ebb9@byu.net>
parents: 9623
diff changeset
118 #if @GNULIB_RAWMEMCHR@
5f559abfabef Add rawmemchr module, matching glibc.
Eric Blake <ebb9@byu.net>
parents: 9623
diff changeset
119 # if ! @HAVE_RAWMEMCHR@
5f559abfabef Add rawmemchr module, matching glibc.
Eric Blake <ebb9@byu.net>
parents: 9623
diff changeset
120 extern void *rawmemchr (void const *__s, int __c_in)
5f559abfabef Add rawmemchr module, matching glibc.
Eric Blake <ebb9@byu.net>
parents: 9623
diff changeset
121 __attribute__ ((__pure__));
5f559abfabef Add rawmemchr module, matching glibc.
Eric Blake <ebb9@byu.net>
parents: 9623
diff changeset
122 # endif
5f559abfabef Add rawmemchr module, matching glibc.
Eric Blake <ebb9@byu.net>
parents: 9623
diff changeset
123 #elif defined GNULIB_POSIXCHECK
5f559abfabef Add rawmemchr module, matching glibc.
Eric Blake <ebb9@byu.net>
parents: 9623
diff changeset
124 # undef rawmemchr
5f559abfabef Add rawmemchr module, matching glibc.
Eric Blake <ebb9@byu.net>
parents: 9623
diff changeset
125 # define rawmemchr(a,b) \
5f559abfabef Add rawmemchr module, matching glibc.
Eric Blake <ebb9@byu.net>
parents: 9623
diff changeset
126 (GL_LINK_WARNING ("rawmemchr is unportable - " \
5f559abfabef Add rawmemchr module, matching glibc.
Eric Blake <ebb9@byu.net>
parents: 9623
diff changeset
127 "use gnulib module rawmemchr for portability"), \
5f559abfabef Add rawmemchr module, matching glibc.
Eric Blake <ebb9@byu.net>
parents: 9623
diff changeset
128 rawmemchr (a, b))
5f559abfabef Add rawmemchr module, matching glibc.
Eric Blake <ebb9@byu.net>
parents: 9623
diff changeset
129 #endif
5f559abfabef Add rawmemchr module, matching glibc.
Eric Blake <ebb9@byu.net>
parents: 9623
diff changeset
130
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
131 /* 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
132 #if @GNULIB_STPCPY@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
133 # if ! @HAVE_STPCPY@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
134 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
135 # endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
136 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
137 # undef stpcpy
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
138 # define stpcpy(a,b) \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
139 (GL_LINK_WARNING ("stpcpy is unportable - " \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
140 "use gnulib module stpcpy for portability"), \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
141 stpcpy (a, b))
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
142 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
143
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
144 /* 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
145 last non-NUL byte written into DST. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
146 #if @GNULIB_STPNCPY@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
147 # if ! @HAVE_STPNCPY@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
148 # define stpncpy gnu_stpncpy
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
149 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
150 size_t __n);
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
151 # endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
152 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
153 # undef stpncpy
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
154 # define stpncpy(a,b,n) \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
155 (GL_LINK_WARNING ("stpncpy is unportable - " \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
156 "use gnulib module stpncpy for portability"), \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
157 stpncpy (a, b, n))
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
158 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
159
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
160 #if defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
161 /* 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
162 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
163 # undef strchr
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
164 # define strchr(s,c) \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
165 (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
166 "in some multibyte locales - " \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
167 "use mbschr if you care about internationalization"), \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
168 strchr (s, c))
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
169 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
170
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
171 /* 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
172 #if @GNULIB_STRCHRNUL@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
173 # if ! @HAVE_STRCHRNUL@
9590
246fc6fd3787 Give gcc some memmem optimization hints.
Eric Blake <ebb9@byu.net>
parents: 9538
diff changeset
174 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
175 __attribute__ ((__pure__));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
176 # endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
177 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
178 # undef strchrnul
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
179 # define strchrnul(a,b) \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
180 (GL_LINK_WARNING ("strchrnul is unportable - " \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
181 "use gnulib module strchrnul for portability"), \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
182 strchrnul (a, b))
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
183 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
184
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
185 /* Duplicate S, returning an identical malloc'd string. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
186 #if @GNULIB_STRDUP@
10456
a821fdd7b2b7 New module 'strdup-posix'.
Bruno Haible <bruno@clisp.org>
parents: 10375
diff changeset
187 # if @REPLACE_STRDUP@
a821fdd7b2b7 New module 'strdup-posix'.
Bruno Haible <bruno@clisp.org>
parents: 10375
diff changeset
188 # undef strdup
a821fdd7b2b7 New module 'strdup-posix'.
Bruno Haible <bruno@clisp.org>
parents: 10375
diff changeset
189 # define strdup rpl_strdup
a821fdd7b2b7 New module 'strdup-posix'.
Bruno Haible <bruno@clisp.org>
parents: 10375
diff changeset
190 # endif
a821fdd7b2b7 New module 'strdup-posix'.
Bruno Haible <bruno@clisp.org>
parents: 10375
diff changeset
191 # 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
192 extern char *strdup (char const *__s);
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
193 # endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
194 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
195 # undef strdup
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
196 # define strdup(a) \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
197 (GL_LINK_WARNING ("strdup is unportable - " \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
198 "use gnulib module strdup for portability"), \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
199 strdup (a))
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
200 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
201
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
202 /* 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
203 #if @GNULIB_STRNDUP@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
204 # if ! @HAVE_STRNDUP@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
205 # undef strndup
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
206 # define strndup rpl_strndup
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
207 # endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
208 # if ! @HAVE_STRNDUP@ || ! @HAVE_DECL_STRNDUP@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
209 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
210 # endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
211 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
212 # undef strndup
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
213 # define strndup(a,n) \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
214 (GL_LINK_WARNING ("strndup is unportable - " \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
215 "use gnulib module strndup for portability"), \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
216 strndup (a, n))
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
217 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
218
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
219 /* 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
220 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
221 return MAXLEN. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
222 #if @GNULIB_STRNLEN@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
223 # if ! @HAVE_DECL_STRNLEN@
9590
246fc6fd3787 Give gcc some memmem optimization hints.
Eric Blake <ebb9@byu.net>
parents: 9538
diff changeset
224 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
225 __attribute__ ((__pure__));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
226 # endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
227 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
228 # undef strnlen
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
229 # define strnlen(a,n) \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
230 (GL_LINK_WARNING ("strnlen is unportable - " \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
231 "use gnulib module strnlen for portability"), \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
232 strnlen (a, n))
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
233 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
234
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
235 #if defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
236 /* 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
237 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
238 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
239 digit. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
240 # undef strcspn
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
241 # define strcspn(s,a) \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
242 (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
243 "in multibyte locales - " \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
244 "use mbscspn if you care about internationalization"), \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
245 strcspn (s, a))
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
246 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
247
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
248 /* 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
249 #if @GNULIB_STRPBRK@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
250 # if ! @HAVE_STRPBRK@
9590
246fc6fd3787 Give gcc some memmem optimization hints.
Eric Blake <ebb9@byu.net>
parents: 9538
diff changeset
251 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
252 __attribute__ ((__pure__));
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
253 # endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
254 # if defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
255 /* 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
256 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
257 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
258 digit. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
259 # undef strpbrk
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
260 # define strpbrk(s,a) \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
261 (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
262 "in multibyte locales - " \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
263 "use mbspbrk if you care about internationalization"), \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
264 strpbrk (s, a))
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
265 # endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
266 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
267 # undef strpbrk
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
268 # define strpbrk(s,a) \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
269 (GL_LINK_WARNING ("strpbrk is unportable - " \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
270 "use gnulib module strpbrk for portability"), \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
271 strpbrk (s, a))
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
272 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
273
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
274 #if defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
275 /* 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
276 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
277 # undef strspn
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
278 # define strspn(s,a) \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
279 (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
280 "in multibyte locales - " \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
281 "use mbsspn if you care about internationalization"), \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
282 strspn (s, a))
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
283 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
284
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
285 #if defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
286 /* 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
287 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
288 # undef strrchr
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
289 # define strrchr(s,c) \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
290 (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
291 "in some multibyte locales - " \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
292 "use mbsrchr if you care about internationalization"), \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
293 strrchr (s, c))
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
294 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
295
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
296 /* 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
297 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
298 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
299 If *STRINGP was already NULL, nothing happens.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
300 Return the old value of *STRINGP.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
301
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
302 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
303 empty fields.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
304
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
305 Caveat: It modifies the original string.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
306 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
307 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
308 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
309 characters are ASCII characters < 0x30.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
310
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
311 See also strtok_r(). */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
312 #if @GNULIB_STRSEP@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
313 # if ! @HAVE_STRSEP@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
314 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
315 # endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
316 # if defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
317 # undef strsep
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
318 # define strsep(s,d) \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
319 (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
320 "in multibyte locales - " \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
321 "use mbssep if you care about internationalization"), \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
322 strsep (s, d))
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
323 # endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
324 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
325 # undef strsep
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
326 # define strsep(s,d) \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
327 (GL_LINK_WARNING ("strsep is unportable - " \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
328 "use gnulib module strsep for portability"), \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
329 strsep (s, d))
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
330 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
331
9600
99268e709d31 Avoid quadratic strstr implementations.
Eric Blake <ebb9@byu.net>
parents: 9590
diff changeset
332 #if @GNULIB_STRSTR@
99268e709d31 Avoid quadratic strstr implementations.
Eric Blake <ebb9@byu.net>
parents: 9590
diff changeset
333 # if @REPLACE_STRSTR@
99268e709d31 Avoid quadratic strstr implementations.
Eric Blake <ebb9@byu.net>
parents: 9590
diff changeset
334 # define strstr rpl_strstr
99268e709d31 Avoid quadratic strstr implementations.
Eric Blake <ebb9@byu.net>
parents: 9590
diff changeset
335 char *strstr (const char *haystack, const char *needle)
99268e709d31 Avoid quadratic strstr implementations.
Eric Blake <ebb9@byu.net>
parents: 9590
diff changeset
336 __attribute__ ((__pure__));
99268e709d31 Avoid quadratic strstr implementations.
Eric Blake <ebb9@byu.net>
parents: 9590
diff changeset
337 # endif
99268e709d31 Avoid quadratic strstr implementations.
Eric Blake <ebb9@byu.net>
parents: 9590
diff changeset
338 #elif defined GNULIB_POSIXCHECK
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
339 /* 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
340 different from UTF-8:
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
341 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
342 as a sequence of bytes, not of characters. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
343 # undef strstr
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
344 # define strstr(a,b) \
9600
99268e709d31 Avoid quadratic strstr implementations.
Eric Blake <ebb9@byu.net>
parents: 9590
diff changeset
345 (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
346 "work correctly on character strings in most " \
99268e709d31 Avoid quadratic strstr implementations.
Eric Blake <ebb9@byu.net>
parents: 9590
diff changeset
347 "multibyte locales - " \
99268e709d31 Avoid quadratic strstr implementations.
Eric Blake <ebb9@byu.net>
parents: 9590
diff changeset
348 "use mbsstr if you care about internationalization, " \
99268e709d31 Avoid quadratic strstr implementations.
Eric Blake <ebb9@byu.net>
parents: 9590
diff changeset
349 "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
350 strstr (a, b))
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
351 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
352
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
353 /* 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
354 comparison. */
9623
69d9307c0aa0 Convert strcasestr module to use Two-Way algorithm.
Eric Blake <ebb9@byu.net>
parents: 9622
diff changeset
355 #if @GNULIB_STRCASESTR@
69d9307c0aa0 Convert strcasestr module to use Two-Way algorithm.
Eric Blake <ebb9@byu.net>
parents: 9622
diff changeset
356 # if @REPLACE_STRCASESTR@
69d9307c0aa0 Convert strcasestr module to use Two-Way algorithm.
Eric Blake <ebb9@byu.net>
parents: 9622
diff changeset
357 # define strcasestr rpl_strcasestr
69d9307c0aa0 Convert strcasestr module to use Two-Way algorithm.
Eric Blake <ebb9@byu.net>
parents: 9622
diff changeset
358 # endif
69d9307c0aa0 Convert strcasestr module to use Two-Way algorithm.
Eric Blake <ebb9@byu.net>
parents: 9622
diff changeset
359 # if ! @HAVE_STRCASESTR@ || @REPLACE_STRCASESTR@
9590
246fc6fd3787 Give gcc some memmem optimization hints.
Eric Blake <ebb9@byu.net>
parents: 9538
diff changeset
360 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
361 __attribute__ ((__pure__));
9623
69d9307c0aa0 Convert strcasestr module to use Two-Way algorithm.
Eric Blake <ebb9@byu.net>
parents: 9622
diff changeset
362 # endif
69d9307c0aa0 Convert strcasestr module to use Two-Way algorithm.
Eric Blake <ebb9@byu.net>
parents: 9622
diff changeset
363 #elif defined GNULIB_POSIXCHECK
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
364 /* strcasestr() does not work with multibyte strings:
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
365 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
366 locales. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
367 # undef strcasestr
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
368 # define strcasestr(a,b) \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
369 (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
370 "in multibyte locales - " \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
371 "use mbscasestr if you care about " \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
372 "internationalization, or use c-strcasestr if you want " \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
373 "a locale independent function"), \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
374 strcasestr (a, b))
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
375 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
376
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
377 /* 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
378 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
379 the next starting point. For example:
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
380 char s[] = "-abc-=-def";
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
381 char *sp;
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
382 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
383 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
384 x = strtok_r(NULL, "=", &sp); // x = NULL
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
385 // s = "abc\0-def\0"
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
386
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
387 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
388
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
389 For the POSIX documentation for this function, see:
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
390 http://www.opengroup.org/susv3xsh/strtok.html
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
391
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
392 Caveat: It modifies the original string.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
393 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
394 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
395 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
396 characters are ASCII characters < 0x30.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
397
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
398 See also strsep(). */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
399 #if @GNULIB_STRTOK_R@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
400 # if ! @HAVE_DECL_STRTOK_R@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
401 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
402 char **restrict save_ptr);
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
403 # endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
404 # if defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
405 # undef strtok_r
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
406 # define strtok_r(s,d,p) \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
407 (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
408 "in multibyte locales - " \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
409 "use mbstok_r if you care about internationalization"), \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
410 strtok_r (s, d, p))
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
411 # endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
412 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
413 # undef strtok_r
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
414 # define strtok_r(s,d,p) \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
415 (GL_LINK_WARNING ("strtok_r is unportable - " \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
416 "use gnulib module strtok_r for portability"), \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
417 strtok_r (s, d, p))
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
418 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
419
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
420
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
421 /* 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
422 extensions. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
423
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
424 #if @GNULIB_MBSLEN@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
425 /* 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
426 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
427 extern size_t mbslen (const char *string);
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
428 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
429
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
430 #if @GNULIB_MBSNLEN@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
431 /* 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
432 at STRING and ending at STRING + LEN. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
433 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
434 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
435
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
436 #if @GNULIB_MBSCHR@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
437 /* 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
438 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
439 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
440 encodings such as GB18030. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
441 # 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
442 extern char * mbschr (const char *string, int c);
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
443 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
444
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
445 #if @GNULIB_MBSRCHR@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
446 /* 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
447 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
448 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
449 encodings such as GB18030. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
450 # 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
451 extern char * mbsrchr (const char *string, int c);
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
452 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
453
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
454 #if @GNULIB_MBSSTR@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
455 /* 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
456 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
457 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
458 encodings different from UTF-8. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
459 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
460 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
461
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
462 #if @GNULIB_MBSCASECMP@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
463 /* 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
464 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
465 or greater than S2.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
466 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
467 different lengths!
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
468 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
469 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
470 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
471
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
472 #if @GNULIB_MBSNCASECMP@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
473 /* 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
474 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
475 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
476 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
477 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
478 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
479 of different lengths!
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
480 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
481 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
482 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
483 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
484
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
485 #if @GNULIB_MBSPCASECMP@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
486 /* 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
487 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
488 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
489 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
490 PREFIX.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
491 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
492 smaller length than PREFIX!
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
493 Unlike strncasecmp(), this function works correctly in multibyte
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
494 locales. */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
495 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
496 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
497
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
498 #if @GNULIB_MBSCASESTR@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
499 /* 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
500 string HAYSTACK, using case-insensitive comparison.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
501 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
502 strlen (haystack) < strlen (needle) !
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
503 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
504 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
505 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
506
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
507 #if @GNULIB_MBSCSPN@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
508 /* 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
509 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
510 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
511 if none exists.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
512 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
513 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
514 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
515
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
516 #if @GNULIB_MBSPBRK@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
517 /* 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
518 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
519 exists.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
520 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
521 # 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
522 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
523 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
524
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
525 #if @GNULIB_MBSSPN@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
526 /* 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
527 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
528 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
529 if none exists.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
530 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
531 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
532 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
533
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
534 #if @GNULIB_MBSSEP@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
535 /* 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
536 string DELIM) starting at the character string *STRINGP.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
537 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
538 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
539 If *STRINGP was already NULL, nothing happens.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
540 Return the old value of *STRINGP.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
541
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
542 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
543
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
544 Caveat: It modifies the original string.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
545 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
546 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
547
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
548 See also mbstok_r(). */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
549 extern char * mbssep (char **stringp, const char *delim);
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
550 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
551
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
552 #if @GNULIB_MBSTOK_R@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
553 /* 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
554 the character string DELIM.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
555 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
556 the next starting point. For example:
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
557 char s[] = "-abc-=-def";
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
558 char *sp;
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
559 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
560 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
561 x = mbstok_r(NULL, "=", &sp); // x = NULL
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
562 // s = "abc\0-def\0"
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
563
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
564 Caveat: It modifies the original string.
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
565 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
566 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
567
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
568 See also mbssep(). */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
569 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
570 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
571
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
572 /* 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
573 #if @GNULIB_STRERROR@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
574 # if @REPLACE_STRERROR@
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
575 # undef strerror
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
576 # define strerror rpl_strerror
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
577 extern char *strerror (int);
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
578 # endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
579 #elif defined GNULIB_POSIXCHECK
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
580 # undef strerror
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
581 # define strerror(e) \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
582 (GL_LINK_WARNING ("strerror is unportable - " \
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
583 "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
584 strerror (e))
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
585 #endif
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
586
9616
878f41b0e41e New module 'strsignal'.
Colin Watson <cjwatson@debian.org>
parents: 9613
diff changeset
587 #if @GNULIB_STRSIGNAL@
9622
7b32838d1079 Replace strsignal if it does not work fine.
Bruno Haible <bruno@clisp.org>
parents: 9616
diff changeset
588 # if @REPLACE_STRSIGNAL@
7b32838d1079 Replace strsignal if it does not work fine.
Bruno Haible <bruno@clisp.org>
parents: 9616
diff changeset
589 # define strsignal rpl_strsignal
7b32838d1079 Replace strsignal if it does not work fine.
Bruno Haible <bruno@clisp.org>
parents: 9616
diff changeset
590 # endif
7b32838d1079 Replace strsignal if it does not work fine.
Bruno Haible <bruno@clisp.org>
parents: 9616
diff changeset
591 # if ! @HAVE_DECL_STRSIGNAL@ || @REPLACE_STRSIGNAL@
9616
878f41b0e41e New module 'strsignal'.
Colin Watson <cjwatson@debian.org>
parents: 9613
diff changeset
592 extern char *strsignal (int __sig);
878f41b0e41e New module 'strsignal'.
Colin Watson <cjwatson@debian.org>
parents: 9613
diff changeset
593 # endif
878f41b0e41e New module 'strsignal'.
Colin Watson <cjwatson@debian.org>
parents: 9613
diff changeset
594 #elif defined GNULIB_POSIXCHECK
878f41b0e41e New module 'strsignal'.
Colin Watson <cjwatson@debian.org>
parents: 9613
diff changeset
595 # undef strsignal
878f41b0e41e New module 'strsignal'.
Colin Watson <cjwatson@debian.org>
parents: 9613
diff changeset
596 # define strsignal(a) \
878f41b0e41e New module 'strsignal'.
Colin Watson <cjwatson@debian.org>
parents: 9613
diff changeset
597 (GL_LINK_WARNING ("strsignal is unportable - " \
878f41b0e41e New module 'strsignal'.
Colin Watson <cjwatson@debian.org>
parents: 9613
diff changeset
598 "use gnulib module strsignal for portability"), \
878f41b0e41e New module 'strsignal'.
Colin Watson <cjwatson@debian.org>
parents: 9613
diff changeset
599 strsignal (a))
878f41b0e41e New module 'strsignal'.
Colin Watson <cjwatson@debian.org>
parents: 9613
diff changeset
600 #endif
878f41b0e41e New module 'strsignal'.
Colin Watson <cjwatson@debian.org>
parents: 9613
diff changeset
601
10345
8d80c477e0ad strverscmp: migrate from "strverscmp.h" to <string.h>
Eric Blake <ebb9@byu.net>
parents: 9999
diff changeset
602 #if @GNULIB_STRVERSCMP@
8d80c477e0ad strverscmp: migrate from "strverscmp.h" to <string.h>
Eric Blake <ebb9@byu.net>
parents: 9999
diff changeset
603 # if !@HAVE_STRVERSCMP@
8d80c477e0ad strverscmp: migrate from "strverscmp.h" to <string.h>
Eric Blake <ebb9@byu.net>
parents: 9999
diff changeset
604 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
605 # endif
8d80c477e0ad strverscmp: migrate from "strverscmp.h" to <string.h>
Eric Blake <ebb9@byu.net>
parents: 9999
diff changeset
606 #elif defined GNULIB_POSIXCHECK
8d80c477e0ad strverscmp: migrate from "strverscmp.h" to <string.h>
Eric Blake <ebb9@byu.net>
parents: 9999
diff changeset
607 # undef strverscmp
8d80c477e0ad strverscmp: migrate from "strverscmp.h" to <string.h>
Eric Blake <ebb9@byu.net>
parents: 9999
diff changeset
608 # define strverscmp(a, b) \
8d80c477e0ad strverscmp: migrate from "strverscmp.h" to <string.h>
Eric Blake <ebb9@byu.net>
parents: 9999
diff changeset
609 (GL_LINK_WARNING ("strverscmp is unportable - " \
8d80c477e0ad strverscmp: migrate from "strverscmp.h" to <string.h>
Eric Blake <ebb9@byu.net>
parents: 9999
diff changeset
610 "use gnulib module strverscmp for portability"), \
8d80c477e0ad strverscmp: migrate from "strverscmp.h" to <string.h>
Eric Blake <ebb9@byu.net>
parents: 9999
diff changeset
611 strverscmp (a, b))
8d80c477e0ad strverscmp: migrate from "strverscmp.h" to <string.h>
Eric Blake <ebb9@byu.net>
parents: 9999
diff changeset
612 #endif
8d80c477e0ad strverscmp: migrate from "strverscmp.h" to <string.h>
Eric Blake <ebb9@byu.net>
parents: 9999
diff changeset
613
9264
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
614
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
615 #ifdef __cplusplus
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 #endif
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 /* _GL_STRING_H */
a1355710e330 Rename string_.h to string.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
620 #endif /* _GL_STRING_H */