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