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