1 /* 2 * Copyright 2014 Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _STRINGS_H_ 6 #define _STRINGS_H_ 7 8 9 #include <locale_t.h> 10 #include <sys/types.h> 11 12 13 #ifdef __cplusplus 14 extern "C" { 15 #endif 16 17 static __inline__ int ffs(int i) { return __builtin_ffs(i); } 18 19 extern int strcasecmp(const char *string1, const char *string2); 20 extern int strncasecmp(const char *string1, const char *string2, 21 size_t length); 22 23 extern int strcasecmp_l(const char *string1, const char *string2, locale_t locale); 24 extern int strncasecmp_l(const char *string1, const char *string2, 25 size_t length, locale_t locale); 26 27 /* legacy compatibility -- might be removed one day */ 28 #define bcmp(a, b, length) memcmp((a), (b), (length)) 29 #define bcopy(source, dest, length) memmove((dest), (source), (length)) 30 #define bzero(buffer, length) memset((buffer), 0, (length)) 31 32 extern char *index(const char *s, int c); 33 extern char *rindex(char const *s, int c); 34 35 #ifdef __cplusplus 36 } 37 #endif 38 39 #endif /* _STRINGS_H_ */ 40