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