| 1 | /*
|
|---|
| 2 | * Copyright (c) 2011 Petr Koupy
|
|---|
| 3 | * Copyright (c) 2011 Jiri Zarevucky
|
|---|
| 4 | * All rights reserved.
|
|---|
| 5 | *
|
|---|
| 6 | * Redistribution and use in source and binary forms, with or without
|
|---|
| 7 | * modification, are permitted provided that the following conditions
|
|---|
| 8 | * are met:
|
|---|
| 9 | *
|
|---|
| 10 | * - Redistributions of source code must retain the above copyright
|
|---|
| 11 | * notice, this list of conditions and the following disclaimer.
|
|---|
| 12 | * - Redistributions in binary form must reproduce the above copyright
|
|---|
| 13 | * notice, this list of conditions and the following disclaimer in the
|
|---|
| 14 | * documentation and/or other materials provided with the distribution.
|
|---|
| 15 | * - The name of the author may not be used to endorse or promote products
|
|---|
| 16 | * derived from this software without specific prior written permission.
|
|---|
| 17 | *
|
|---|
| 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|---|
| 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|---|
| 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|---|
| 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|---|
| 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|---|
| 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|---|
| 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|---|
| 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|---|
| 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|---|
| 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|---|
| 28 | */
|
|---|
| 29 |
|
|---|
| 30 | /** @addtogroup libposix
|
|---|
| 31 | * @{
|
|---|
| 32 | */
|
|---|
| 33 | /** @file
|
|---|
| 34 | */
|
|---|
| 35 |
|
|---|
| 36 | #include "string.h"
|
|---|
| 37 |
|
|---|
| 38 | #include <libc/assert.h>
|
|---|
| 39 |
|
|---|
| 40 | #include <str_error.h>
|
|---|
| 41 |
|
|---|
| 42 | #undef strcpy
|
|---|
| 43 | #undef strncpy
|
|---|
| 44 | #undef strcat
|
|---|
| 45 | #undef strncat
|
|---|
| 46 | #undef mempcpy
|
|---|
| 47 | #undef strdup
|
|---|
| 48 |
|
|---|
| 49 | #undef memcmp
|
|---|
| 50 | #undef strcmp
|
|---|
| 51 | #undef strncmp
|
|---|
| 52 | #undef strcasecmp
|
|---|
| 53 | #undef strncasecmp
|
|---|
| 54 |
|
|---|
| 55 | #undef memchr
|
|---|
| 56 | #undef rawmemchr
|
|---|
| 57 | #undef strchr
|
|---|
| 58 | #undef strrchr
|
|---|
| 59 | #undef strpbrk
|
|---|
| 60 | #undef strcspn
|
|---|
| 61 | #undef strspn
|
|---|
| 62 | #undef strstr
|
|---|
| 63 |
|
|---|
| 64 | #undef strcoll
|
|---|
| 65 | #undef strxfrm
|
|---|
| 66 |
|
|---|
| 67 | #undef strerror
|
|---|
| 68 |
|
|---|
| 69 | #undef strlen
|
|---|
| 70 |
|
|---|
| 71 | /**
|
|---|
| 72 | *
|
|---|
| 73 | * @param dest
|
|---|
| 74 | * @param src
|
|---|
| 75 | * @return
|
|---|
| 76 | */
|
|---|
| 77 | char *posix_strcpy(char *dest, const char *src)
|
|---|
| 78 | {
|
|---|
| 79 | // TODO
|
|---|
| 80 | return 0;
|
|---|
| 81 | }
|
|---|
| 82 |
|
|---|
| 83 | /**
|
|---|
| 84 | *
|
|---|
| 85 | * @param dest
|
|---|
| 86 | * @param src
|
|---|
| 87 | * @param n
|
|---|
| 88 | * @return
|
|---|
| 89 | */
|
|---|
| 90 | char *posix_strncpy(char *dest, const char *src, size_t n)
|
|---|
| 91 | {
|
|---|
| 92 | // TODO
|
|---|
| 93 | return 0;
|
|---|
| 94 | }
|
|---|
| 95 |
|
|---|
| 96 | /**
|
|---|
| 97 | *
|
|---|
| 98 | * @param dest
|
|---|
| 99 | * @param src
|
|---|
| 100 | * @return
|
|---|
| 101 | */
|
|---|
| 102 | char *posix_strcat(char *dest, const char *src)
|
|---|
| 103 | {
|
|---|
| 104 | // TODO
|
|---|
| 105 | return 0;
|
|---|
| 106 | }
|
|---|
| 107 |
|
|---|
| 108 | /**
|
|---|
| 109 | *
|
|---|
| 110 | * @param dest
|
|---|
| 111 | * @param src
|
|---|
| 112 | * @param n
|
|---|
| 113 | * @return
|
|---|
| 114 | */
|
|---|
| 115 | char *posix_strncat(char *dest, const char *src, size_t n)
|
|---|
| 116 | {
|
|---|
| 117 | // TODO
|
|---|
| 118 | return 0;
|
|---|
| 119 | }
|
|---|
| 120 |
|
|---|
| 121 | /**
|
|---|
| 122 | *
|
|---|
| 123 | * @param dest
|
|---|
| 124 | * @param src
|
|---|
| 125 | * @param n
|
|---|
| 126 | * @return
|
|---|
| 127 | */
|
|---|
| 128 | void *posix_mempcpy(void *dest, const void *src, size_t n)
|
|---|
| 129 | {
|
|---|
| 130 | // TODO
|
|---|
| 131 | return 0;
|
|---|
| 132 | }
|
|---|
| 133 |
|
|---|
| 134 | /**
|
|---|
| 135 | *
|
|---|
| 136 | * @param s
|
|---|
| 137 | * @return
|
|---|
| 138 | */
|
|---|
| 139 | char *posix_strdup(const char *s)
|
|---|
| 140 | {
|
|---|
| 141 | // TODO
|
|---|
| 142 | return 0;
|
|---|
| 143 | }
|
|---|
| 144 |
|
|---|
| 145 | /**
|
|---|
| 146 | *
|
|---|
| 147 | * @param mem1
|
|---|
| 148 | * @param mem2
|
|---|
| 149 | * @param n
|
|---|
| 150 | * @return
|
|---|
| 151 | */
|
|---|
| 152 | int posix_memcmp(const void *mem1, const void *mem2, size_t n)
|
|---|
| 153 | {
|
|---|
| 154 | // TODO
|
|---|
| 155 | return 0;
|
|---|
| 156 | }
|
|---|
| 157 |
|
|---|
| 158 | /**
|
|---|
| 159 | *
|
|---|
| 160 | * @param s1
|
|---|
| 161 | * @param s2
|
|---|
| 162 | * @return
|
|---|
| 163 | */
|
|---|
| 164 | int posix_strcmp(const char *s1, const char *s2)
|
|---|
| 165 | {
|
|---|
| 166 | // TODO
|
|---|
| 167 | return 0;
|
|---|
| 168 | }
|
|---|
| 169 |
|
|---|
| 170 | /**
|
|---|
| 171 | *
|
|---|
| 172 | * @param s1
|
|---|
| 173 | * @param s2
|
|---|
| 174 | * @param n
|
|---|
| 175 | * @return
|
|---|
| 176 | */
|
|---|
| 177 | int posix_strncmp(const char *s1, const char *s2, size_t n)
|
|---|
| 178 | {
|
|---|
| 179 | // TODO
|
|---|
| 180 | return 0;
|
|---|
| 181 | }
|
|---|
| 182 |
|
|---|
| 183 | /**
|
|---|
| 184 | *
|
|---|
| 185 | * @param s1
|
|---|
| 186 | * @param s2
|
|---|
| 187 | * @return
|
|---|
| 188 | */
|
|---|
| 189 | int posix_strcasecmp(const char *s1, const char *s2)
|
|---|
| 190 | {
|
|---|
| 191 | // TODO
|
|---|
| 192 | return 0;
|
|---|
| 193 | }
|
|---|
| 194 |
|
|---|
| 195 | /**
|
|---|
| 196 | *
|
|---|
| 197 | * @param s1
|
|---|
| 198 | * @param s2
|
|---|
| 199 | * @param n
|
|---|
| 200 | * @return
|
|---|
| 201 | */
|
|---|
| 202 | int posix_strncasecmp(const char *s1, const char *s2, size_t n)
|
|---|
| 203 | {
|
|---|
| 204 | // TODO
|
|---|
| 205 | return 0;
|
|---|
| 206 | }
|
|---|
| 207 |
|
|---|
| 208 | /**
|
|---|
| 209 | *
|
|---|
| 210 | * @param mem
|
|---|
| 211 | * @param c
|
|---|
| 212 | * @param n
|
|---|
| 213 | * @return
|
|---|
| 214 | */
|
|---|
| 215 | void *posix_memchr(const void *mem, int c, size_t n)
|
|---|
| 216 | {
|
|---|
| 217 | // TODO
|
|---|
| 218 | return 0;
|
|---|
| 219 | }
|
|---|
| 220 |
|
|---|
| 221 | /**
|
|---|
| 222 | *
|
|---|
| 223 | * @param mem
|
|---|
| 224 | * @param c
|
|---|
| 225 | * @return
|
|---|
| 226 | */
|
|---|
| 227 | void *posix_rawmemchr(const void *mem, int c)
|
|---|
| 228 | {
|
|---|
| 229 | // TODO
|
|---|
| 230 | return 0;
|
|---|
| 231 | }
|
|---|
| 232 |
|
|---|
| 233 | /**
|
|---|
| 234 | *
|
|---|
| 235 | * @param s
|
|---|
| 236 | * @param c
|
|---|
| 237 | * @return
|
|---|
| 238 | */
|
|---|
| 239 | char *posix_strchr(const char *s, int c)
|
|---|
| 240 | {
|
|---|
| 241 | // TODO
|
|---|
| 242 | return 0;
|
|---|
| 243 | }
|
|---|
| 244 |
|
|---|
| 245 | /**
|
|---|
| 246 | *
|
|---|
| 247 | * @param s
|
|---|
| 248 | * @param c
|
|---|
| 249 | * @return
|
|---|
| 250 | */
|
|---|
| 251 | char *posix_strrchr(const char *s, int c)
|
|---|
| 252 | {
|
|---|
| 253 | // TODO
|
|---|
| 254 | return 0;
|
|---|
| 255 | }
|
|---|
| 256 |
|
|---|
| 257 | /**
|
|---|
| 258 | *
|
|---|
| 259 | * @param s1
|
|---|
| 260 | * @param s2
|
|---|
| 261 | * @return
|
|---|
| 262 | */
|
|---|
| 263 | char *posix_strpbrk(const char *s1, const char *s2)
|
|---|
| 264 | {
|
|---|
| 265 | // TODO
|
|---|
| 266 | return 0;
|
|---|
| 267 | }
|
|---|
| 268 |
|
|---|
| 269 | /**
|
|---|
| 270 | *
|
|---|
| 271 | * @param s1
|
|---|
| 272 | * @param s2
|
|---|
| 273 | * @return
|
|---|
| 274 | */
|
|---|
| 275 | size_t posix_strcspn(const char *s1, const char *s2)
|
|---|
| 276 | {
|
|---|
| 277 | // TODO
|
|---|
| 278 | return 0;
|
|---|
| 279 | }
|
|---|
| 280 |
|
|---|
| 281 | /**
|
|---|
| 282 | *
|
|---|
| 283 | * @param s1
|
|---|
| 284 | * @param s2
|
|---|
| 285 | * @return
|
|---|
| 286 | */
|
|---|
| 287 | size_t posix_strspn(const char *s1, const char *s2)
|
|---|
| 288 | {
|
|---|
| 289 | // TODO
|
|---|
| 290 | return 0;
|
|---|
| 291 | }
|
|---|
| 292 |
|
|---|
| 293 | /**
|
|---|
| 294 | *
|
|---|
| 295 | * @param s1
|
|---|
| 296 | * @param s2
|
|---|
| 297 | * @return
|
|---|
| 298 | */
|
|---|
| 299 | char *posix_strstr(const char *s1, const char *s2)
|
|---|
| 300 | {
|
|---|
| 301 | // TODO
|
|---|
| 302 | return 0;
|
|---|
| 303 | }
|
|---|
| 304 |
|
|---|
| 305 | /**
|
|---|
| 306 | *
|
|---|
| 307 | * @param s1
|
|---|
| 308 | * @param s2
|
|---|
| 309 | * @return
|
|---|
| 310 | */
|
|---|
| 311 | int posix_strcoll(const char *s1, const char *s2)
|
|---|
| 312 | {
|
|---|
| 313 | // TODO
|
|---|
| 314 | return 0;
|
|---|
| 315 | }
|
|---|
| 316 |
|
|---|
| 317 | /**
|
|---|
| 318 | *
|
|---|
| 319 | * @param s1
|
|---|
| 320 | * @param s2
|
|---|
| 321 | * @param n
|
|---|
| 322 | * @return
|
|---|
| 323 | */
|
|---|
| 324 | size_t posix_strxfrm(char *s1, const char *s2, size_t n)
|
|---|
| 325 | {
|
|---|
| 326 | // TODO
|
|---|
| 327 | return 0;
|
|---|
| 328 | }
|
|---|
| 329 |
|
|---|
| 330 | /**
|
|---|
| 331 | *
|
|---|
| 332 | * @param errnum
|
|---|
| 333 | * @return
|
|---|
| 334 | */
|
|---|
| 335 | char *posix_strerror(int errnum)
|
|---|
| 336 | {
|
|---|
| 337 | // TODO
|
|---|
| 338 | return 0;
|
|---|
| 339 | }
|
|---|
| 340 |
|
|---|
| 341 | /**
|
|---|
| 342 | *
|
|---|
| 343 | * @param s
|
|---|
| 344 | * @return
|
|---|
| 345 | */
|
|---|
| 346 | size_t posix_strlen(const char *s)
|
|---|
| 347 | {
|
|---|
| 348 | // TODO
|
|---|
| 349 | return 0;
|
|---|
| 350 | }
|
|---|
| 351 |
|
|---|
| 352 | /** @}
|
|---|
| 353 | */
|
|---|