annotate lib/string.in.h @ 400:573ed4940625 3.0-beta1 3.0-beta1

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