1 /* 2 * Copyright 2007, Ingo Weinhold, bonefish@cs.tu-berlin.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 #include "compatibility.h" 7 8 #include "fssh_string.h" 9 10 #include <string.h> 11 #include <strings.h> 12 13 14 void* 15 fssh_memchr(const void *source, int value, fssh_size_t length) 16 { 17 return memchr((void*)source, value, length); 18 } 19 20 21 int 22 fssh_memcmp(const void *buffer1, const void *buffer2, fssh_size_t length) 23 { 24 return memcmp(buffer1, buffer2, length); 25 } 26 27 28 void* 29 fssh_memcpy(void *dest, const void *source, fssh_size_t length) 30 { 31 return memcpy(dest, source, length); 32 } 33 34 35 #if 0 36 void* 37 fssh_memccpy(void *dest, const void *source, int stopByte, fssh_size_t length) 38 { 39 return memccpy(dest, source, stopByte, length); 40 } 41 #endif // 0 42 43 44 void* 45 fssh_memmove(void *dest, const void *source, fssh_size_t length) 46 { 47 return memmove(dest, source, length); 48 } 49 50 51 void* 52 fssh_memset(void *dest, int value, fssh_size_t length) 53 { 54 return memset(dest, value, length); 55 } 56 57 58 char* 59 fssh_strcpy(char *dest, const char *source) 60 { 61 return strcpy(dest, source); 62 } 63 64 65 char* 66 fssh_strncpy(char *dest, const char *source, fssh_size_t length) 67 { 68 return strncpy(dest, source, length); 69 } 70 71 72 char* 73 fssh_strcat(char *dest, const char *source) 74 { 75 return strcat(dest, source); 76 } 77 78 79 char* 80 fssh_strncat(char *dest, const char *source, fssh_size_t length) 81 { 82 return strncat(dest, source, length); 83 } 84 85 86 fssh_size_t 87 fssh_strlen(const char *string) 88 { 89 return strlen(string); 90 } 91 92 93 int 94 fssh_strcmp(const char *string1, const char *string2) 95 { 96 return strcmp(string1, string2); 97 } 98 99 100 int 101 fssh_strncmp(const char *string1, const char *string2, fssh_size_t length) 102 { 103 return strncmp(string1, string2, length); 104 } 105 106 107 char* 108 fssh_strchr(const char *string, int character) 109 { 110 return strchr((char*)string, character); 111 } 112 113 114 char* 115 fssh_strrchr(const char *string, int character) 116 { 117 return strrchr((char*)string, character); 118 } 119 120 121 char* 122 fssh_strstr(const char *string, const char *searchString) 123 { 124 return strstr((char*)string, searchString); 125 } 126 127 128 #if 0 129 char* 130 fssh_strchrnul(const char *string, int character) 131 { 132 } 133 #endif // 0 134 135 136 char* 137 fssh_strpbrk(const char *string, const char *set) 138 { 139 return strpbrk((char*)string, set); 140 } 141 142 143 char* 144 fssh_strtok(char *string, const char *set) 145 { 146 return strtok(string, set); 147 } 148 149 150 char* 151 fssh_strtok_r(char *string, const char *set, char **savePointer) 152 { 153 return strtok_r(string, set, savePointer); 154 } 155 156 157 fssh_size_t 158 fssh_strspn(const char *string, const char *set) 159 { 160 return strspn(string, set); 161 } 162 163 164 fssh_size_t 165 fssh_strcspn(const char *string, const char *set) 166 { 167 return strcspn(string, set); 168 } 169 170 171 int 172 fssh_strcoll(const char *string1, const char *string2) 173 { 174 return strcoll(string1, string2); 175 } 176 177 178 fssh_size_t 179 fssh_strxfrm(char *string1, const char *string2, fssh_size_t length) 180 { 181 return strxfrm(string1, string2, length); 182 } 183 184 185 char* 186 fssh_strerror(int errorCode) 187 { 188 return strerror(errorCode); 189 } 190 191 192 #if 0 193 int 194 fssh_strerror_r(int errorCode, char *buffer, fssh_size_t bufferSize) 195 { 196 return strerror_r(errorCode, buffer, bufferSize); 197 } 198 #endif // 0 199 200 201 int 202 fssh_strcasecmp(const char *string1, const char *string2) 203 { 204 return strcasecmp(string1, string2); 205 } 206 207 208 int 209 fssh_strncasecmp(const char *string1, const char *string2, fssh_size_t length) 210 { 211 return strncasecmp(string1, string2, length); 212 } 213 214 215 #if 0 216 char* 217 fssh_strcasestr(const char *string, const char *searchString) 218 { 219 return strcasestr(string, searchString); 220 } 221 #endif // 0 222 223 224 char* 225 fssh_strdup(const char *string) 226 { 227 if (!string) 228 return NULL; 229 return strdup(string); 230 } 231 232 233 char* 234 fssh_stpcpy(char *dest, const char *source) 235 { 236 return stpcpy(dest, source); 237 } 238 239 240 #if 0 241 const char * 242 fssh_strtcopy(char *dest, const char *source) 243 { 244 return strtcopy(dest, source); 245 } 246 #endif // 0 247 248 249 fssh_size_t 250 fssh_strlcat(char *dest, const char *source, fssh_size_t length) 251 { 252 return strlcat(dest, source, length); 253 } 254 255 256 fssh_size_t 257 fssh_strlcpy(char *dest, const char *source, fssh_size_t length) 258 { 259 return strlcpy(dest, source, length); 260 } 261 262 263 fssh_size_t 264 fssh_strnlen(const char *string, fssh_size_t count) 265 { 266 return strnlen(string, count); 267 } 268 269 270 int 271 fssh_ffs(int i) 272 { 273 return ffs(i); 274 } 275 276 277 #if 0 278 char* 279 fssh_index(const char *s, int c) 280 { 281 return index(s, c); 282 } 283 #endif // 0 284 285 286 #if 0 287 char* 288 fssh_rindex(char const *s, int c) 289 { 290 return rindex(s, c); 291 } 292 #endif // 0 293