modernc.org/cc@v1.0.1/v2/headers/linux_amd64/usr/include/strings.h (about) 1 /* Copyright (C) 1991-2015 Free Software Foundation, Inc. 2 This file is part of the GNU C Library. 3 4 The GNU C Library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Lesser General Public 6 License as published by the Free Software Foundation; either 7 version 2.1 of the License, or (at your option) any later version. 8 9 The GNU C Library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Lesser General Public License for more details. 13 14 You should have received a copy of the GNU Lesser General Public 15 License along with the GNU C Library; if not, see 16 <http://www.gnu.org/licenses/>. */ 17 18 #ifndef _STRINGS_H 19 #define _STRINGS_H 1 20 21 /* We don't need and should not read this file if <string.h> was already 22 read. The one exception being that if __USE_MISC isn't defined, then 23 these aren't defined in string.h, so we need to define them here. */ 24 #if !defined _STRING_H || !defined __USE_MISC 25 26 # include <features.h> 27 # define __need_size_t 28 # include <stddef.h> 29 30 /* Tell the caller that we provide correct C++ prototypes. */ 31 # if defined __cplusplus && __GNUC_PREREQ (4, 4) 32 # define __CORRECT_ISO_CPP_STRINGS_H_PROTO 33 # endif 34 35 __BEGIN_DECLS 36 # if defined __USE_MISC || !defined __USE_XOPEN2K8 37 /* Compare N bytes of S1 and S2 (same as memcmp). */ 38 extern int bcmp(const void *__s1, const void *__s2, size_t __n) 39 __THROW __attribute_pure__; 40 41 /* Copy N bytes of SRC to DEST (like memmove, but args reversed). */ 42 extern void bcopy(const void *__src, void *__dest, size_t __n) __THROW; 43 44 /* Set N bytes of S to 0. */ 45 extern void bzero(void *__s, size_t __n) __THROW; 46 47 /* Find the first occurrence of C in S (same as strchr). */ 48 # ifdef __CORRECT_ISO_CPP_STRINGS_H_PROTO 49 extern "C++" { 50 extern char *index(char *__s, int __c) 51 __THROW __asm("index") __attribute_pure__ __nonnull((1)); 52 extern const char *index(const char *__s, int __c) 53 __THROW __asm("index") __attribute_pure__ __nonnull((1)); 54 55 # if defined __OPTIMIZE__ && !defined __CORRECT_ISO_CPP_STRING_H_PROTO 56 __extern_always_inline char *index(char *__s, int __c) __THROW 57 { 58 return __builtin_index(__s, __c); 59 } __extern_always_inline const char *index(const char *__s, int __c) __THROW { 60 return __builtin_index(__s, __c); 61 } 62 # endif 63 } 64 # else 65 extern char *index(const char *__s, int __c) 66 __THROW __attribute_pure__ __nonnull((1)); 67 # endif 68 69 /* Find the last occurrence of C in S (same as strrchr). */ 70 # ifdef __CORRECT_ISO_CPP_STRINGS_H_PROTO 71 extern "C++" { 72 extern char *rindex(char *__s, int __c) 73 __THROW __asm("rindex") __attribute_pure__ __nonnull((1)); 74 extern const char *rindex(const char *__s, int __c) 75 __THROW __asm("rindex") __attribute_pure__ __nonnull((1)); 76 77 # if defined __OPTIMIZE__ && !defined __CORRECT_ISO_CPP_STRING_H_PROTO 78 __extern_always_inline char *rindex(char *__s, int __c) __THROW 79 { 80 return __builtin_rindex(__s, __c); 81 } __extern_always_inline const char *rindex(const char *__s, int __c) __THROW { 82 return __builtin_rindex(__s, __c); 83 } 84 # endif 85 } 86 # else 87 extern char *rindex(const char *__s, int __c) 88 __THROW __attribute_pure__ __nonnull((1)); 89 # endif 90 # endif 91 92 #if defined __USE_MISC || !defined __USE_XOPEN2K8 || defined __USE_XOPEN2K8XSI 93 /* Return the position of the first bit set in I, or 0 if none are set. 94 The least-significant bit is position 1, the most-significant 32. */ 95 extern int ffs(int __i) 96 __THROW __attribute__ ((const)); 97 #endif 98 99 /* Compare S1 and S2, ignoring case. */ 100 extern int strcasecmp(const char *__s1, const char *__s2) 101 __THROW __attribute_pure__; 102 103 /* Compare no more than N chars of S1 and S2, ignoring case. */ 104 extern int strncasecmp(const char *__s1, const char *__s2, size_t __n) 105 __THROW __attribute_pure__; 106 107 #ifdef __USE_XOPEN2K8 108 /* The following functions are equivalent to the both above but they 109 take the locale they use for the collation as an extra argument. 110 This is not standardsized but something like will come. */ 111 # include <xlocale.h> 112 113 /* Again versions of a few functions which use the given locale instead 114 of the global one. */ 115 extern int strcasecmp_l(const char *__s1, const char *__s2, __locale_t __loc) 116 __THROW __attribute_pure__ __nonnull((1, 2, 3)); 117 118 extern int strncasecmp_l(const char *__s1, const char *__s2, size_t __n, __locale_t __loc) 119 __THROW __attribute_pure__ __nonnull((1, 2, 4)); 120 #endif 121 122 __END_DECLS 123 #endif /* string.h */ 124 #endif /* strings.h */