xref: /haiku/headers/private/fs_shell/fssh_string.h (revision cbe0a0c436162d78cc3f92a305b64918c839d079)
1 /*
2  * Copyright 2004-2007, Haiku Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _FSSH_STRING_H
6 #define _FSSH_STRING_H
7 
8 
9 #include "fssh_defs.h"
10 
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 
17 /* memXXX() functions */
18 extern void		*fssh_memchr(const void *source, int value, fssh_size_t length);
19 extern int		fssh_memcmp(const void *buffer1, const void *buffer2,
20 						fssh_size_t length);
21 extern void		*fssh_memcpy(void *dest, const void *source,
22 						fssh_size_t length);
23 extern void		*fssh_memccpy(void *dest, const void *source, int stopByte,
24 						fssh_size_t length);
25 extern void		*fssh_memmove(void *dest, const void *source,
26 						fssh_size_t length);
27 extern void		*fssh_memset(void *dest, int value, fssh_size_t length);
28 
29 /* string functions */
30 extern char		*fssh_strcpy(char *dest, const char *source);
31 extern char		*fssh_strncpy(char *dest, const char *source,
32 						fssh_size_t length);
33 extern char		*fssh_strcat(char *dest, const char *source);
34 extern char		*fssh_strncat(char *dest, const char *source,
35 						fssh_size_t length);
36 
37 extern fssh_size_t	fssh_strlen(const char *string);
38 extern int		fssh_strcmp(const char *string1, const char *string2);
39 extern int		fssh_strncmp(const char *string1, const char *string2,
40 						fssh_size_t length);
41 
42 extern char		*fssh_strchr(const char *string, int character);
43 extern char		*fssh_strrchr(const char *string, int character);
44 extern char		*fssh_strstr(const char *string, const char *searchString);
45 
46 extern char		*fssh_strchrnul(const char *string, int character);
47 	// this is a GNU extension
48 
49 extern char		*fssh_strpbrk(const char *string, const char *set);
50 extern char		*fssh_strtok(char *string, const char *set);
51 extern char		*fssh_strtok_r(char *string, const char *set,
52 						char **savePointer);
53 extern fssh_size_t	fssh_strspn(const char *string, const char *set);
54 extern fssh_size_t	fssh_strcspn(const char *string, const char *set);
55 
56 extern int		fssh_strcoll(const char *string1, const char *string2);
57 extern fssh_size_t	fssh_strxfrm(char *string1, const char *string2,
58 						fssh_size_t length);
59 
60 extern char		*fssh_strerror(int errorCode);
61 extern int		fssh_strerror_r(int errorCode, char *buffer,
62 						fssh_size_t bufferSize);
63 
64 /* non-standard string functions */
65 extern int		fssh_strcasecmp(const char *string1, const char *string2);
66 extern int		fssh_strncasecmp(const char *string1, const char *string2,
67 						fssh_size_t length);
68 
69 extern char		*fssh_strcasestr(const char *string, const char *searchString);
70 
71 extern char		*fssh_strdup(const char *string);
72 extern char		*fssh_stpcpy(char *dest, const char *source);
73 extern const char *fssh_strtcopy(char *dest, const char *source);
74 
75 extern fssh_size_t	fssh_strlcat(char *dest, const char *source,
76 						fssh_size_t length);
77 extern fssh_size_t	fssh_strlcpy(char *dest, const char *source,
78 						fssh_size_t length);
79 
80 extern fssh_size_t	fssh_strnlen(const char *string, fssh_size_t count);
81 
82 extern int fssh_ffs(int i);
83 extern char 		*fssh_index(const char *s, int c);
84 extern char 		*fssh_rindex(char const *s, int c);
85 
86 
87 #ifdef __cplusplus
88 }
89 #endif
90 
91 #endif  /* _FSSH_STRING_H */
92