2004-11-03 17:45:47 +03:00
|
|
|
/*
|
|
|
|
* Copyright 2004, Haiku Inc. All Rights Reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2002-09-17 18:51:59 +04:00
|
|
|
#ifndef _STRING_H_
|
|
|
|
#define _STRING_H_
|
2004-11-03 17:45:47 +03:00
|
|
|
|
2002-09-17 18:51:59 +04:00
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
2004-11-03 17:45:47 +03:00
|
|
|
|
2002-09-17 18:51:59 +04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/* memXXX() functions */
|
|
|
|
extern void *memchr(const void *source, int value, size_t length);
|
|
|
|
extern int memcmp(const void *buffer1, const void *buffer2, size_t length);
|
|
|
|
extern void *memcpy(void *dest, const void *source, size_t length);
|
2005-10-31 15:18:55 +03:00
|
|
|
extern void *memccpy(void *dest, const void *source, int stopByte, size_t length);
|
2002-09-17 18:51:59 +04:00
|
|
|
extern void *memmove(void *dest, const void *source, size_t length);
|
|
|
|
extern void *memset(void *dest, int value, size_t length);
|
|
|
|
|
|
|
|
/* string functions */
|
|
|
|
extern char *strcpy(char *dest, const char *source);
|
|
|
|
extern char *strncpy(char *dest, const char *source, size_t length);
|
|
|
|
extern char *strcat(char *dest, const char *source);
|
|
|
|
extern char *strncat(char *dest, const char *source, size_t length);
|
|
|
|
|
|
|
|
extern size_t strlen(const char *string);
|
|
|
|
extern int strcmp(const char *string1, const char *string2);
|
|
|
|
extern int strncmp(const char *string1, const char *string2, size_t length);
|
|
|
|
|
|
|
|
extern char *strchr(const char *string, int character);
|
|
|
|
extern char *strrchr(const char *string, int character);
|
|
|
|
extern char *strstr(const char *string, const char *searchString);
|
|
|
|
|
2003-05-03 20:06:48 +04:00
|
|
|
extern char *strchrnul(const char *string, int character);
|
|
|
|
// this is a GNU extension
|
|
|
|
|
2002-09-17 18:51:59 +04:00
|
|
|
extern char *strpbrk(const char *string, const char *set);
|
|
|
|
extern char *strtok(char *string, const char *set);
|
|
|
|
extern char *strtok_r(char *string, const char *set, char **savePointer);
|
|
|
|
extern size_t strspn(const char *string, const char *set);
|
|
|
|
extern size_t strcspn(const char *string, const char *set);
|
|
|
|
|
|
|
|
extern int strcoll(const char *string1, const char *string2);
|
|
|
|
extern size_t strxfrm(char *string1, const char *string2, size_t length);
|
|
|
|
|
2002-11-01 05:58:34 +03:00
|
|
|
extern char *strerror(int errorCode);
|
2003-11-06 02:52:25 +03:00
|
|
|
extern int strerror_r(int errorCode, char *buffer, size_t bufferSize);
|
2002-09-17 18:51:59 +04:00
|
|
|
|
|
|
|
/* non-standard string functions */
|
|
|
|
extern int strcasecmp(const char *string1, const char *string2);
|
|
|
|
extern int strncasecmp(const char *string1, const char *string2, size_t length);
|
|
|
|
|
|
|
|
extern char *strcasestr(const char *string, const char *searchString);
|
|
|
|
|
|
|
|
extern char *strdup(const char *string);
|
|
|
|
extern char *stpcpy(char *dest, const char *source);
|
|
|
|
extern const char *strtcopy(char *dest, const char *source);
|
|
|
|
|
|
|
|
extern size_t strlcat(char *dest, const char *source, size_t length);
|
|
|
|
extern size_t strlcpy(char *dest, const char *source, size_t length);
|
|
|
|
|
|
|
|
extern size_t strnlen(const char *string, size_t count);
|
|
|
|
|
|
|
|
//extern char *strlwr(char *string);
|
|
|
|
//extern char *strupr(char *string);
|
|
|
|
|
|
|
|
//extern char *strsep(char **stringPointer, const char *delimiter);
|
|
|
|
|
2003-08-15 13:03:54 +04:00
|
|
|
extern const char *strsignal(int signal);
|
2002-09-17 18:51:59 +04:00
|
|
|
|
2004-11-03 17:45:47 +03:00
|
|
|
/* legacy compatibility -- might be removed one day */
|
|
|
|
#define bcmp(a, b, length) memcmp((a), (b), (length))
|
2008-03-22 21:13:42 +03:00
|
|
|
#define bcopy(source, dest, length) memmove((dest), (source), (length))
|
2004-11-03 17:45:47 +03:00
|
|
|
#define bzero(buffer, length) memset((buffer), 0, (length))
|
|
|
|
|
2005-03-08 01:02:50 +03:00
|
|
|
extern int ffs(int i);
|
2005-10-12 17:05:03 +04:00
|
|
|
extern char *index(const char *s, int c);
|
|
|
|
extern char *rindex(char const *s, int c);
|
2005-03-08 01:02:50 +03:00
|
|
|
|
2002-09-17 18:51:59 +04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* _STRING_H_ */
|