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