xref: /titanic_54/usr/src/head/iso/string_iso.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*	Copyright (c) 1988 AT&T	*/
23*7c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
24*7c478bd9Sstevel@tonic-gate 
25*7c478bd9Sstevel@tonic-gate 
26*7c478bd9Sstevel@tonic-gate /*
27*7c478bd9Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
28*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
29*7c478bd9Sstevel@tonic-gate  */
30*7c478bd9Sstevel@tonic-gate 
31*7c478bd9Sstevel@tonic-gate /*
32*7c478bd9Sstevel@tonic-gate  * An application should not include this header directly.  Instead it
33*7c478bd9Sstevel@tonic-gate  * should be included only through the inclusion of other Sun headers.
34*7c478bd9Sstevel@tonic-gate  *
35*7c478bd9Sstevel@tonic-gate  * The contents of this header is limited to identifiers specified in the
36*7c478bd9Sstevel@tonic-gate  * C Standard.  Any new identifiers specified in future amendments to the
37*7c478bd9Sstevel@tonic-gate  * C Standard must be placed in this header.  If these new identifiers
38*7c478bd9Sstevel@tonic-gate  * are required to also be in the C++ Standard "std" namespace, then for
39*7c478bd9Sstevel@tonic-gate  * anything other than macro definitions, corresponding "using" directives
40*7c478bd9Sstevel@tonic-gate  * must also be added to <string.h>.
41*7c478bd9Sstevel@tonic-gate  */
42*7c478bd9Sstevel@tonic-gate 
43*7c478bd9Sstevel@tonic-gate #ifndef _ISO_STRING_ISO_H
44*7c478bd9Sstevel@tonic-gate #define	_ISO_STRING_ISO_H
45*7c478bd9Sstevel@tonic-gate 
46*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
47*7c478bd9Sstevel@tonic-gate 
48*7c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h>
49*7c478bd9Sstevel@tonic-gate 
50*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
51*7c478bd9Sstevel@tonic-gate extern "C" {
52*7c478bd9Sstevel@tonic-gate #endif
53*7c478bd9Sstevel@tonic-gate 
54*7c478bd9Sstevel@tonic-gate #if __cplusplus >= 199711L
55*7c478bd9Sstevel@tonic-gate namespace std {
56*7c478bd9Sstevel@tonic-gate #endif
57*7c478bd9Sstevel@tonic-gate 
58*7c478bd9Sstevel@tonic-gate #if !defined(_SIZE_T) || __cplusplus >= 199711L
59*7c478bd9Sstevel@tonic-gate #define	_SIZE_T
60*7c478bd9Sstevel@tonic-gate #if defined(_LP64) || defined(_I32LPx)
61*7c478bd9Sstevel@tonic-gate typedef unsigned long	size_t;		/* size of something in bytes */
62*7c478bd9Sstevel@tonic-gate #else
63*7c478bd9Sstevel@tonic-gate typedef unsigned int	size_t;		/* (historical version) */
64*7c478bd9Sstevel@tonic-gate #endif
65*7c478bd9Sstevel@tonic-gate #endif	/* !_SIZE_T */
66*7c478bd9Sstevel@tonic-gate 
67*7c478bd9Sstevel@tonic-gate #ifndef	NULL
68*7c478bd9Sstevel@tonic-gate #if defined(_LP64)
69*7c478bd9Sstevel@tonic-gate #define	NULL	0L
70*7c478bd9Sstevel@tonic-gate #else
71*7c478bd9Sstevel@tonic-gate #define	NULL	0
72*7c478bd9Sstevel@tonic-gate #endif
73*7c478bd9Sstevel@tonic-gate #endif
74*7c478bd9Sstevel@tonic-gate 
75*7c478bd9Sstevel@tonic-gate #if defined(__STDC__)
76*7c478bd9Sstevel@tonic-gate 
77*7c478bd9Sstevel@tonic-gate extern int memcmp(const void *, const void *, size_t);
78*7c478bd9Sstevel@tonic-gate extern void *memcpy(void *_RESTRICT_KYWD, const void *_RESTRICT_KYWD, size_t);
79*7c478bd9Sstevel@tonic-gate extern void *memmove(void *, const void *, size_t);
80*7c478bd9Sstevel@tonic-gate extern void *memset(void *, int, size_t);
81*7c478bd9Sstevel@tonic-gate extern char *strcat(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD);
82*7c478bd9Sstevel@tonic-gate extern int strcmp(const char *, const char *);
83*7c478bd9Sstevel@tonic-gate extern char *strcpy(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD);
84*7c478bd9Sstevel@tonic-gate extern int strcoll(const char *, const char *);
85*7c478bd9Sstevel@tonic-gate extern size_t strcspn(const char *, const char *);
86*7c478bd9Sstevel@tonic-gate extern char *strerror(int);
87*7c478bd9Sstevel@tonic-gate extern size_t strlen(const char *);
88*7c478bd9Sstevel@tonic-gate extern char *strncat(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t);
89*7c478bd9Sstevel@tonic-gate extern int strncmp(const char *, const char *, size_t);
90*7c478bd9Sstevel@tonic-gate extern char *strncpy(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t);
91*7c478bd9Sstevel@tonic-gate extern size_t strspn(const char *, const char *);
92*7c478bd9Sstevel@tonic-gate extern char *strtok(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD);
93*7c478bd9Sstevel@tonic-gate extern size_t strxfrm(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t);
94*7c478bd9Sstevel@tonic-gate 
95*7c478bd9Sstevel@tonic-gate /*
96*7c478bd9Sstevel@tonic-gate  * The C++ Standard (ISO/IEC 14882:1998) specifies that each of the
97*7c478bd9Sstevel@tonic-gate  * function signatures for the following functions be replaced by
98*7c478bd9Sstevel@tonic-gate  * two declarations, both of which have the same behavior.
99*7c478bd9Sstevel@tonic-gate  */
100*7c478bd9Sstevel@tonic-gate #if __cplusplus >= 199711L
101*7c478bd9Sstevel@tonic-gate extern const void *memchr(const void *, int, size_t);
102*7c478bd9Sstevel@tonic-gate #ifndef	_MEMCHR_INLINE
103*7c478bd9Sstevel@tonic-gate #define	_MEMCHR_INLINE
104*7c478bd9Sstevel@tonic-gate extern "C++" {
105*7c478bd9Sstevel@tonic-gate 	inline void *memchr(void * __s, int __c, size_t __n) {
106*7c478bd9Sstevel@tonic-gate 		return (void *)memchr((const void *)__s, __c, __n);
107*7c478bd9Sstevel@tonic-gate 	}
108*7c478bd9Sstevel@tonic-gate }
109*7c478bd9Sstevel@tonic-gate #endif  /* _MEMCHR_INLINE */
110*7c478bd9Sstevel@tonic-gate extern const char *strchr(const char *, int);
111*7c478bd9Sstevel@tonic-gate #ifndef _STRCHR_INLINE
112*7c478bd9Sstevel@tonic-gate #define	_STRCHR_INLINE
113*7c478bd9Sstevel@tonic-gate extern "C++" {
114*7c478bd9Sstevel@tonic-gate 	inline char *strchr(char *__s, int __c) {
115*7c478bd9Sstevel@tonic-gate 		return (char *)strchr((const char *)__s, __c);
116*7c478bd9Sstevel@tonic-gate 	}
117*7c478bd9Sstevel@tonic-gate }
118*7c478bd9Sstevel@tonic-gate #endif	/* _STRCHR_INLINE */
119*7c478bd9Sstevel@tonic-gate extern const char *strpbrk(const char *, const char *);
120*7c478bd9Sstevel@tonic-gate #ifndef _STRPBRK_INLINE
121*7c478bd9Sstevel@tonic-gate #define	_STRPBRK_INLINE
122*7c478bd9Sstevel@tonic-gate extern "C++" {
123*7c478bd9Sstevel@tonic-gate 	inline char *strpbrk(char *__s1, const char *__s2) {
124*7c478bd9Sstevel@tonic-gate 		return (char *)strpbrk((const char *)__s1, __s2);
125*7c478bd9Sstevel@tonic-gate 	}
126*7c478bd9Sstevel@tonic-gate }
127*7c478bd9Sstevel@tonic-gate #endif	/* _STRPBRK_INLINE */
128*7c478bd9Sstevel@tonic-gate extern const char *strrchr(const char *, int);
129*7c478bd9Sstevel@tonic-gate #ifndef _STRRCHR_INLINE
130*7c478bd9Sstevel@tonic-gate #define	_STRRCHR_INLINE
131*7c478bd9Sstevel@tonic-gate extern "C++" {
132*7c478bd9Sstevel@tonic-gate 	inline char *strrchr(char *__s, int __c) {
133*7c478bd9Sstevel@tonic-gate 		return (char *)strrchr((const char *)__s, __c);
134*7c478bd9Sstevel@tonic-gate 	}
135*7c478bd9Sstevel@tonic-gate }
136*7c478bd9Sstevel@tonic-gate #endif	/* _STRRCHR_INLINE */
137*7c478bd9Sstevel@tonic-gate extern const char *strstr(const char *, const char *);
138*7c478bd9Sstevel@tonic-gate #ifndef _STRSTR_INLINE
139*7c478bd9Sstevel@tonic-gate #define	_STRSTR_INLINE
140*7c478bd9Sstevel@tonic-gate extern "C++" {
141*7c478bd9Sstevel@tonic-gate 	inline char *strstr(char *__s1, const char *__s2) {
142*7c478bd9Sstevel@tonic-gate 		return (char *)strstr((const char *)__s1, __s2);
143*7c478bd9Sstevel@tonic-gate 	}
144*7c478bd9Sstevel@tonic-gate }
145*7c478bd9Sstevel@tonic-gate #endif	/* _STRSTR_INLINE */
146*7c478bd9Sstevel@tonic-gate #else /* __cplusplus >= 199711L */
147*7c478bd9Sstevel@tonic-gate extern void *memchr(const void *, int, size_t);
148*7c478bd9Sstevel@tonic-gate extern char *strchr(const char *, int);
149*7c478bd9Sstevel@tonic-gate extern char *strpbrk(const char *, const char *);
150*7c478bd9Sstevel@tonic-gate extern char *strrchr(const char *, int);
151*7c478bd9Sstevel@tonic-gate extern char *strstr(const char *, const char *);
152*7c478bd9Sstevel@tonic-gate #endif /* __cplusplus >= 199711L */
153*7c478bd9Sstevel@tonic-gate 
154*7c478bd9Sstevel@tonic-gate #else	/* __STDC__ */
155*7c478bd9Sstevel@tonic-gate 
156*7c478bd9Sstevel@tonic-gate extern void *memchr();
157*7c478bd9Sstevel@tonic-gate extern int memcmp();
158*7c478bd9Sstevel@tonic-gate extern void *memcpy();
159*7c478bd9Sstevel@tonic-gate extern void *memmove();
160*7c478bd9Sstevel@tonic-gate extern void *memset();
161*7c478bd9Sstevel@tonic-gate extern char *strcat();
162*7c478bd9Sstevel@tonic-gate extern char *strchr();
163*7c478bd9Sstevel@tonic-gate extern int strcmp();
164*7c478bd9Sstevel@tonic-gate extern int strcoll();
165*7c478bd9Sstevel@tonic-gate extern char *strcpy();
166*7c478bd9Sstevel@tonic-gate extern size_t strcspn();
167*7c478bd9Sstevel@tonic-gate extern char *strerror();
168*7c478bd9Sstevel@tonic-gate extern size_t strlen();
169*7c478bd9Sstevel@tonic-gate extern char *strncat();
170*7c478bd9Sstevel@tonic-gate extern int strncmp();
171*7c478bd9Sstevel@tonic-gate extern char *strncpy();
172*7c478bd9Sstevel@tonic-gate extern char *strpbrk();
173*7c478bd9Sstevel@tonic-gate extern char *strrchr();
174*7c478bd9Sstevel@tonic-gate extern size_t strspn();
175*7c478bd9Sstevel@tonic-gate extern char *strstr();
176*7c478bd9Sstevel@tonic-gate extern char *strtok();
177*7c478bd9Sstevel@tonic-gate extern size_t strxfrm();
178*7c478bd9Sstevel@tonic-gate 
179*7c478bd9Sstevel@tonic-gate #endif	/* __STDC__ */
180*7c478bd9Sstevel@tonic-gate 
181*7c478bd9Sstevel@tonic-gate #if __cplusplus >= 199711L
182*7c478bd9Sstevel@tonic-gate }
183*7c478bd9Sstevel@tonic-gate #endif /* end of namespace std */
184*7c478bd9Sstevel@tonic-gate 
185*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
186*7c478bd9Sstevel@tonic-gate }
187*7c478bd9Sstevel@tonic-gate #endif
188*7c478bd9Sstevel@tonic-gate 
189*7c478bd9Sstevel@tonic-gate #endif	/* _ISO_STRING_ISO_H */
190