xref: /haiku/headers/posix/string.h (revision 344ded80d400028c8f561b4b876257b94c12db4a)
1 /*
2  * Copyright 2004-2012 Haiku, Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _STRING_H_
6 #define _STRING_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 
18 /* memXXX() functions */
19 extern void		*memchr(const void *source, int value, size_t length);
20 extern int		memcmp(const void *buffer1, const void *buffer2, size_t length);
21 extern void		*memcpy(void *dest, const void *source, size_t length);
22 extern void		*memccpy(void *dest, const void *source, int stopByte, size_t length);
23 extern void		*memmove(void *dest, const void *source, size_t length);
24 extern void		*memset(void *dest, int value, size_t length);
25 extern void 	*memmem(const void *source, size_t sourceLength,
26 	const void *search, size_t searchLength);
27 
28 #ifdef _DEFAULT_SOURCE
29 extern void		*memrchr(const void *source, int value, size_t length);
30 #endif
31 
32 /* string functions */
33 extern char		*strcpy(char *dest, const char *source);
34 extern char		*strncpy(char *dest, const char *source, size_t length);
35 extern char		*strcat(char *dest, const char *source);
36 extern char		*strncat(char *dest, const char *source, size_t length);
37 
38 extern size_t	strlen(const char *string);
39 extern int		strcmp(const char *string1, const char *string2);
40 extern int		strncmp(const char *string1, const char *string2, size_t length);
41 
42 extern char		*strchr(const char *string, int character);
43 extern char		*strrchr(const char *string, int character);
44 extern char		*strstr(const char *string, const char *searchString);
45 
46 #ifdef _DEFAULT_SOURCE
47 extern char		*strchrnul(const char *string, int character);
48 #endif
49 
50 extern char		*strpbrk(const char *string, const char *set);
51 extern char		*strtok(char *string, const char *set);
52 extern char		*strtok_r(char *string, const char *set, char **savePointer);
53 extern size_t	strspn(const char *string, const char *set);
54 extern size_t	strcspn(const char *string, const char *set);
55 
56 extern int		strcoll(const char *string1, const char *string2);
57 extern size_t	strxfrm(char *string1, const char *string2, size_t length);
58 
59 extern char		*strerror(int errorCode);
60 extern int		strerror_r(int errorCode, char *buffer, size_t bufferSize);
61 
62 extern char		*strcasestr(const char *string, const char *searchString);
63 
64 extern char		*strdup(const char *string);
65 extern char		*strndup(const char* string, size_t size);
66 extern char		*stpcpy(char *dest, const char *source);
67 extern char		*stpncpy(char *dest, const char *source, size_t size);
68 
69 extern size_t	strlcat(char *dest, const char *source, size_t length);
70 extern size_t	strlcpy(char *dest, const char *source, size_t length);
71 
72 extern size_t	strnlen(const char *string, size_t count);
73 
74 extern char		*strlwr(char *string);
75 extern char		*strupr(char *string);
76 
77 /* extern char		*strsep(char **stringPointer, const char *delimiter); */
78 
79 extern const char	*strsignal(int signum);
80 
81 /* locale versions of string functions */
82 extern int		strcoll_l(const char *string1, const char *string2, locale_t locale);
83 extern char		*strerror_l(int errorCode, locale_t locale);
84 extern size_t	strxfrm_l(char *string1, const char *string2, size_t length, locale_t locale);
85 
86 /* for compatibility, pull in functions declared in strings.h */
87 #include <strings.h>
88 
89 
90 #ifdef __cplusplus
91 }
92 #endif
93 
94 #endif  /* _STRING_H_ */
95