xref: /illumos-gate/usr/src/head/strings.h (revision 5400c85432c0a689ecefb8c19b8f9861809ca093)
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 /*
23  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
24  *
25  * Copyright (c) 1995, 1996, by Sun Microsystems, Inc.
26  * All rights reserved.
27  */
28 
29 #ifndef	_STRINGS_H
30 #define	_STRINGS_H
31 
32 #include <sys/types.h>
33 #include <sys/feature_tests.h>
34 
35 #if !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__)
36 #include <string.h>
37 #endif
38 
39 #ifdef	__cplusplus
40 extern "C" {
41 #endif
42 
43 extern int bcmp(const void *, const void *, size_t);
44 extern void bcopy(const void *, void *, size_t);
45 extern void bzero(void *, size_t);
46 
47 extern char *index(const char *, int);
48 extern char *rindex(const char *, int);
49 
50 /*
51  * X/Open System Interfaces and Headers, Issue 4, Version 2, defines
52  * both <string.h> and <strings.h>.  The namespace requirements
53  * do not permit the visibility of anything other than what is
54  * specifically defined for each of these headers.  As a result,
55  * inclusion of <string.h> would result in declarations not allowed
56  * in <strings.h>.
57  *
58  * <strings.h> is not defined by ISO C.  In a strict ISO C environment,
59  * explicitly including this header is treated as a request for the
60  * interfaces it provides.  _STRICT_POSIX distinguishes that case from
61  * strict POSIX and XPG environments, where the requested edition
62  * determines which interfaces are visible.
63  */
64 #if !defined(_STRICT_POSIX) || defined(_XPG4_2)
65 extern int ffs(int);
66 extern int strcasecmp(const char *, const char *);
67 extern int strncasecmp(const char *, const char *, size_t);
68 #endif /* !_STRICT_POSIX || _XPG4_2 */
69 
70 #if !defined(_STRICT_POSIX) || defined(_XPG7)
71 #ifndef	_LOCALE_T
72 #define	_LOCALE_T
73 typedef struct _locale *locale_t;
74 #endif
75 extern int strcasecmp_l(const char *, const char *, locale_t);
76 extern int strncasecmp_l(const char *, const char *, size_t, locale_t);
77 #endif	/* !_STRICT_POSIX || _XPG7 */
78 
79 #if !defined(_STRICT_POSIX) || defined(_XPG8)
80 extern int ffsl(long);
81 extern int ffsll(long long);
82 #endif	/* !_STRICT_POSIX || _XPG8 */
83 
84 #ifdef	__cplusplus
85 }
86 #endif
87 
88 #endif	/* _STRINGS_H */
89