xref: /illumos-gate/usr/src/head/string.h (revision 628e3cbed6489fa1db545d8524a06cd6535af456)
1 /*
2  * CDDL HEADER START
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 /*	Copyright (c) 1988 AT&T	*/
22 /*	  All Rights Reserved  	*/
23 
24 
25 /*
26  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
27  * Use is subject to license terms.
28  */
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;
44 using std::memmove;
45 using std::memset;
46 using std::strcat;
47 using std::strchr;
48 using std::strcmp;
49 using std::strcoll;
50 using std::strcpy;
51 using std::strcspn;
52 using std::strerror;
53 using std::strlen;
54 using std::strncat;
55 using std::strncmp;
56 using std::strncpy;
57 using std::strpbrk;
58 using std::strrchr;
59 using std::strspn;
60 using std::strstr;
61 using std::strtok;
62 using std::strxfrm;
63 #endif
64 
65 #ifdef	__cplusplus
66 extern "C" {
67 #endif
68 
69 #if defined(__STDC__)
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(__EXTENSIONS__) || \
91 	(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))
92 extern int uucopy(const void *_RESTRICT_KYWD, void *_RESTRICT_KYWD, size_t);
93 extern int uucopystr(const void *_RESTRICT_KYWD, void *_RESTRICT_KYWD, size_t);
94 extern char *strsignal(int);
95 extern size_t strnlen(const char *, size_t);
96 extern int ffs(int);
97 extern int strcasecmp(const char *, const char *);
98 extern int strncasecmp(const char *, const char *, size_t);
99 extern size_t strlcpy(char *, const char *, size_t);
100 extern size_t strlcat(char *, const char *, size_t);
101 extern char *strsep(char **stringp, const char *delim);
102 #endif /* defined(__EXTENSIONS__)... */
103 
104 #if defined(__EXTENSIONS__) || \
105 	(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
106 	defined(_XPG4_2)
107 extern char *strdup(const char *);
108 #endif
109 
110 #else	/* __STDC__ */
111 
112 #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \
113 	defined(_XPG6) || defined(_REENTRANT)
114 extern int strerror_r();
115 #endif
116 
117 #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \
118 	(_POSIX_C_SOURCE - 0 >= 199506L) || defined(_REENTRANT)
119 extern char *strtok_r();
120 #endif
121 
122 #if defined(__EXTENSIONS__) || !defined(_STRICT_STDC) || \
123 	defined(__XOPEN_OR_POSIX)
124 extern void *memccpy();
125 #endif
126 
127 #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX)
128 extern int uucopy();
129 extern int uucopystr();
130 extern char *strsignal();
131 extern size_t strnlen();
132 extern int ffs();
133 extern int strcasecmp();
134 extern int strncasecmp();
135 extern size_t strlcpy();
136 extern size_t strlcat();
137 extern char *strsep();
138 #endif /* defined(__EXTENSIONS__) ... */
139 
140 #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)
141 extern char *strdup();
142 #endif
143 
144 #endif	/* __STDC__ */
145 
146 #ifdef	__cplusplus
147 }
148 #endif
149 
150 #endif	/* _STRING_H */
151