3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
24 */
25
26 /* Copyright (c) 1988 AT&T */
27 /* All Rights Reserved */
28
29 #ifndef _STRING_H
30 #define _STRING_H
31
32 #include <iso/string_iso.h>
33
34 /*
35 * Allow global visibility for symbols defined in
36 * C++ "std" namespace in <iso/string_iso.h>.
37 */
38 #if __cplusplus >= 199711L
39 using std::size_t;
40 using std::memchr;
41 using std::memcmp;
42 using std::memcpy;
69
70 #if defined(__EXTENSIONS__) || \
71 (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
72 defined(_XPG6) || defined(_REENTRANT)
73 extern int strerror_r(int, char *, size_t);
74 #endif
75
76 #if defined(__EXTENSIONS__) || \
77 (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
78 (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_REENTRANT)
79 extern char *strtok_r(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD,
80 char **_RESTRICT_KYWD);
81 #endif
82
83 #if defined(__EXTENSIONS__) || !defined(_STRICT_STDC) || \
84 defined(__XOPEN_OR_POSIX)
85 extern void *memccpy(void *_RESTRICT_KYWD, const void *_RESTRICT_KYWD,
86 int, size_t);
87 #endif
88
89 #if defined(__EXTENSIONS__) || \
90 (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))
91 /* || defined(_XPG7) */
92 extern int strcasecmp(const char *, const char *);
93 extern int strncasecmp(const char *, const char *, size_t);
94 extern char *stpcpy(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD);
95 extern char *stpncpy(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t);
96 extern char *strndup(const char *, size_t);
97 extern size_t strnlen(const char *, size_t);
98 extern char *strsignal(int);
99 #endif
100
101 #if defined(__EXTENSIONS__) || \
102 (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))
103 extern int uucopy(const void *_RESTRICT_KYWD, void *_RESTRICT_KYWD, size_t);
104 extern int uucopystr(const void *_RESTRICT_KYWD, void *_RESTRICT_KYWD, size_t);
105 extern int ffs(int);
106 extern int ffsl(long);
107 extern int ffsll(long long);
108 extern int fls(int);
109 extern int flsl(long);
110 extern int flsll(long long);
111 extern void *memmem(const void *, size_t, const void *, size_t);
112 extern char *strcasestr(const char *, const char *);
113 extern char *strnstr(const char *, const char *, size_t);
114 extern size_t strlcpy(char *, const char *, size_t);
115 extern size_t strlcat(char *, const char *, size_t);
116 extern char *strsep(char **stringp, const char *delim);
117 extern char *strchrnul(const char *, int);
118 #endif /* defined(__EXTENSIONS__)... */
119
120 #if defined(__EXTENSIONS__) || \
121 (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
122 defined(_XPG4_2)
123 extern char *strdup(const char *);
124 #endif
125
126 #if defined(__EXTENSIONS__) || \
127 (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))
128 #if defined(__GNUC__)
129
130 /*
131 * gcc provides this inlining facility but Studio C does not.
132 * We should use it exclusively once Studio C also provides it.
133 */
134 extern void *__builtin_alloca(size_t);
135
136 #define strdupa(s) \
137 (__extension__( \
177 #endif /* __GNUC__ */
178 #endif /* __EXTENSIONS__ ... */
179
180 #else /* __STDC__ */
181
182 #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \
183 defined(_XPG6) || defined(_REENTRANT)
184 extern int strerror_r();
185 #endif
186
187 #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \
188 (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_REENTRANT)
189 extern char *strtok_r();
190 #endif
191
192 #if defined(__EXTENSIONS__) || !defined(_STRICT_STDC) || \
193 defined(__XOPEN_OR_POSIX)
194 extern void *memccpy();
195 #endif
196
197 #if defined(__EXTENSIONS__) || \
198 (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))
199 /* || defined(_XPG7) */
200 extern int strcasecmp();
201 extern int strncasecmp();
202 extern char *stpcpy();
203 extern char *stpncpy();
204 extern char *strndup();
205 extern size_t strnlen();
206 extern char *strsignal();
207 #endif
208
209 #if defined(__EXTENSIONS__) || \
210 (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))
211 extern int uucopy();
212 extern int uucopystr();
213 extern int ffs();
214 extern int ffsl();
215 extern int ffsll();
216 extern int fls();
217 extern int flsl();
218 extern int flsll();
219 extern char *strcasestr();
220 extern char *strnstr();
221 extern size_t strlcpy();
222 extern size_t strlcat();
223 extern char *strsep();
224 extern char *strchrnul();
225 #endif /* defined(__EXTENSIONS__) ... */
226
227 #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)
228 extern char *strdup();
229 #endif
230
231 #endif /* __STDC__ */
232
233 #ifdef __cplusplus
234 }
235 #endif
236
237 #endif /* _STRING_H */
|
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
24 * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
25 */
26
27 /* Copyright (c) 1988 AT&T */
28 /* All Rights Reserved */
29
30 #ifndef _STRING_H
31 #define _STRING_H
32
33 #include <iso/string_iso.h>
34
35 /*
36 * Allow global visibility for symbols defined in
37 * C++ "std" namespace in <iso/string_iso.h>.
38 */
39 #if __cplusplus >= 199711L
40 using std::size_t;
41 using std::memchr;
42 using std::memcmp;
43 using std::memcpy;
70
71 #if defined(__EXTENSIONS__) || \
72 (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
73 defined(_XPG6) || defined(_REENTRANT)
74 extern int strerror_r(int, char *, size_t);
75 #endif
76
77 #if defined(__EXTENSIONS__) || \
78 (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
79 (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_REENTRANT)
80 extern char *strtok_r(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD,
81 char **_RESTRICT_KYWD);
82 #endif
83
84 #if defined(__EXTENSIONS__) || !defined(_STRICT_STDC) || \
85 defined(__XOPEN_OR_POSIX)
86 extern void *memccpy(void *_RESTRICT_KYWD, const void *_RESTRICT_KYWD,
87 int, size_t);
88 #endif
89
90 #if !defined(_STRICT_SYMBOLS) || defined(_XPG7)
91
92 extern char *stpcpy(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD);
93 extern char *stpncpy(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t);
94 extern char *strndup(const char *, size_t);
95 extern size_t strnlen(const char *, size_t);
96 extern char *strsignal(int);
97
98 #ifndef _LOCALE_T
99 #define _LOCALE_T
100 typedef struct locale *locale_t;
101 #endif
102
103 extern int strcoll_l(const char *, const char *, locale_t);
104 extern size_t strxfrm_l(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD,
105 size_t, locale_t);
106 extern int strcasecmp_l(const char *, const char *, locale_t);
107 extern int strncasecmp_l(const char *, const char *, size_t, locale_t);
108
109 #endif /* defined(_STRICT_SYMBOLS) || defined(_XPG7) */
110
111 #if !defined(_STRICT_SYMBOLS)
112
113 /* Note that some of these are also declared in strings.h for XPG4_2+ */
114 extern int uucopy(const void *_RESTRICT_KYWD, void *_RESTRICT_KYWD, size_t);
115 extern int uucopystr(const void *_RESTRICT_KYWD, void *_RESTRICT_KYWD, size_t);
116 extern int ffs(int);
117 extern int ffsl(long);
118 extern int ffsll(long long);
119 extern int fls(int);
120 extern int flsl(long);
121 extern int flsll(long long);
122 extern void *memmem(const void *, size_t, const void *, size_t);
123 extern char *strcasestr(const char *, const char *);
124 extern char *strnstr(const char *, const char *, size_t);
125 extern size_t strlcpy(char *, const char *, size_t);
126 extern size_t strlcat(char *, const char *, size_t);
127 extern char *strsep(char **stringp, const char *delim);
128 extern char *strchrnul(const char *, int);
129 extern char *strcasestr_l(const char *, const char *, locale_t);
130 extern int strcasecmp(const char *, const char *);
131 extern int strncasecmp(const char *, const char *, size_t);
132 #endif /* defined(__EXTENSIONS__)... */
133
134 #if defined(__EXTENSIONS__) || \
135 (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
136 defined(_XPG4_2)
137 extern char *strdup(const char *);
138 #endif
139
140 #if defined(__EXTENSIONS__) || \
141 (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))
142 #if defined(__GNUC__)
143
144 /*
145 * gcc provides this inlining facility but Studio C does not.
146 * We should use it exclusively once Studio C also provides it.
147 */
148 extern void *__builtin_alloca(size_t);
149
150 #define strdupa(s) \
151 (__extension__( \
191 #endif /* __GNUC__ */
192 #endif /* __EXTENSIONS__ ... */
193
194 #else /* __STDC__ */
195
196 #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \
197 defined(_XPG6) || defined(_REENTRANT)
198 extern int strerror_r();
199 #endif
200
201 #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \
202 (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_REENTRANT)
203 extern char *strtok_r();
204 #endif
205
206 #if defined(__EXTENSIONS__) || !defined(_STRICT_STDC) || \
207 defined(__XOPEN_OR_POSIX)
208 extern void *memccpy();
209 #endif
210
211 #if defined(_XPG7) || !defined(_STRICT_SYMBOLS)
212 extern int strcasecmp();
213 extern int strncasecmp();
214 extern int strcasecmp_l();
215 extern int strncasecmp_l();
216 extern char *stpcpy();
217 extern char *stpncpy();
218 extern char *strndup();
219 extern size_t strnlen();
220 extern char *strsignal();
221 #endif
222
223 #if !defined(_STRICT_SYMBOLS)
224 extern int uucopy();
225 extern int uucopystr();
226 extern int ffs();
227 extern int ffsl();
228 extern int ffsll();
229 extern int fls();
230 extern int flsl();
231 extern int flsll();
232 extern char *strcasestr();
233 extern char *strcasestr_l();
234 extern char *strnstr();
235 extern size_t strlcpy();
236 extern size_t strlcat();
237 extern char *strsep();
238 extern char *strchrnul();
239 #endif /* _STRICT_SYMBOLS */
240
241 #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)
242 extern char *strdup();
243 #endif
244
245 #if defined(_XPG7) || !defined(_STRICT_SYMBOLS)
246 extern size_t strcoll_l();
247 extern size_t strxfrm_l();
248 #endif
249
250 #endif /* __STDC__ */
251
252 #ifdef __cplusplus
253 }
254 #endif
255
256 #endif /* _STRING_H */
|