1 #ifndef _STRING_H_ 2 #define _STRING_H_ 3 /* 4 ** Distributed under the terms of the OpenBeOS License. 5 */ 6 7 #include <sys/types.h> 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 14 /* memXXX() functions */ 15 extern void *memchr(const void *source, int value, size_t length); 16 extern int memcmp(const void *buffer1, const void *buffer2, size_t length); 17 extern void *memcpy(void *dest, const void *source, size_t length); 18 extern void *memmove(void *dest, const void *source, size_t length); 19 extern void *memset(void *dest, int value, size_t length); 20 21 /* string functions */ 22 extern char *strcpy(char *dest, const char *source); 23 extern char *strncpy(char *dest, const char *source, size_t length); 24 extern char *strcat(char *dest, const char *source); 25 extern char *strncat(char *dest, const char *source, size_t length); 26 27 extern size_t strlen(const char *string); 28 extern int strcmp(const char *string1, const char *string2); 29 extern int strncmp(const char *string1, const char *string2, size_t length); 30 31 extern char *strchr(const char *string, int character); 32 extern char *strrchr(const char *string, int character); 33 extern char *strstr(const char *string, const char *searchString); 34 35 extern char *strchrnul(const char *string, int character); 36 // this is a GNU extension 37 38 extern char *strpbrk(const char *string, const char *set); 39 extern char *strtok(char *string, const char *set); 40 extern char *strtok_r(char *string, const char *set, char **savePointer); 41 extern size_t strspn(const char *string, const char *set); 42 extern size_t strcspn(const char *string, const char *set); 43 44 extern int strcoll(const char *string1, const char *string2); 45 extern size_t strxfrm(char *string1, const char *string2, size_t length); 46 47 extern char *strerror(int errorCode); 48 extern int strerror_r(int errorCode, char *buffer, size_t bufferSize); 49 50 // ToDo: remove bzero(), bcopy() from here - we don't need those 51 // implementations anyway, since BeOS defines them as macros 52 // Of course, we could also just keep them (and bcmp() is missing) 53 //extern void *bcopy(void const *source, void *dest, size_t length); 54 //extern void bzero(void *buffer, size_t length); 55 #define bcopy(source, dest, length) memcpy(dest, source, length) 56 #define bzero(buffer, length) memset(buffer, 0, length) 57 58 /* non-standard string functions */ 59 extern int strcasecmp(const char *string1, const char *string2); 60 extern int strncasecmp(const char *string1, const char *string2, size_t length); 61 #define stricmp(a, b) strcasecmp(a, b) 62 //#define strnicmp(a, b, length) strncasecmp(a, b, length) 63 // ToDo: remove the function, and only have the macro 64 extern int strnicmp(const char *string1, const char *string2, size_t length); 65 66 extern char *strcasestr(const char *string, const char *searchString); 67 68 extern char *strdup(const char *string); 69 extern char *stpcpy(char *dest, const char *source); 70 extern const char *strtcopy(char *dest, const char *source); 71 72 extern size_t strlcat(char *dest, const char *source, size_t length); 73 extern size_t strlcpy(char *dest, const char *source, size_t length); 74 75 extern size_t strnlen(const char *string, size_t count); 76 77 //extern char *strlwr(char *string); 78 //extern char *strupr(char *string); 79 80 //extern char *strsep(char **stringPointer, const char *delimiter); 81 82 extern const char *strsignal(int signal); 83 84 #ifdef __cplusplus 85 } 86 #endif 87 88 #endif /* _STRING_H_ */ 89