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 (c) 1995, 1996, by Sun Microsystems, Inc. 24 * All rights reserved. 25 */ 26 /* 27 * Copyright 2013 Garrett D'Amore <garrett@damore.org> 28 */ 29 30 #ifndef _STRINGS_H 31 #define _STRINGS_H 32 33 #include <sys/types.h> 34 #include <sys/feature_tests.h> 35 36 #if !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) 37 #include <string.h> 38 #endif 39 40 #ifdef __cplusplus 41 extern "C" { 42 #endif 43 44 #if defined(__STDC__) 45 46 extern int bcmp(const void *, const void *, size_t); 47 extern void bcopy(const void *, void *, size_t); 48 extern void bzero(void *, size_t); 49 50 extern char *index(const char *, int); 51 extern char *rindex(const char *, int); 52 53 /* 54 * X/Open System Interfaces and Headers, Issue 4, Version 2, defines 55 * both <string.h> and <strings.h>. The namespace requirements 56 * do not permit the visibility of anything other than what is 57 * specifically defined for each of these headers. As a result, 58 * inclusion of <string.h> would result in declarations not allowed 59 * in <strings.h>, and making the following prototypes visible for 60 * anything other than X/Open UNIX Extension would result in 61 * conflicts with what is now in <string.h>. 62 */ 63 #if defined(_XPG4_2) && !defined(__EXTENSIONS__) 64 extern int ffs(int); 65 extern int strcasecmp(const char *, const char *); 66 extern int strncasecmp(const char *, const char *, size_t); 67 #if defined(_XPG7) 68 #ifndef _LOCALE_T 69 #define _LOCALE_T 70 typedef struct locale *locale_t; 71 #endif 72 extern int strcasecmp_l(const char *, const char *, locale_t); 73 extern int strncasecmp_l(const char *, const char *, size_t, locale_t); 74 #endif /* defined(_XPG7) */ 75 #endif /* defined(_XPG4_2) && !defined(__EXTENSIONS__) */ 76 77 #else 78 79 extern int bcmp(); 80 extern void bcopy(); 81 extern void bzero(); 82 83 extern char *index(); 84 extern char *rindex(); 85 86 #if defined(_XPG4_2) && !defined(__EXTENSIONS__) 87 extern int ffs(); 88 extern int strcasecmp(); 89 extern int strncasecmp(); 90 #if defined(_XPG7) 91 extern int strcasecmp_l(); 92 extern int strncasecmp_l(); 93 #endif 94 #endif /* defined(_XPG4_2) && !defined(__EXTENSIONS__) */ 95 96 #endif /* __STDC__ */ 97 98 #ifdef __cplusplus 99 } 100 #endif 101 102 #endif /* _STRINGS_H */