| 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 | #define LIBPOSIX_INTERNAL
|
|---|
| 37 |
|
|---|
| 38 | #include "string.h"
|
|---|
| 39 |
|
|---|
| 40 | #include <libc/assert.h>
|
|---|
| 41 |
|
|---|
| 42 | #include <str_error.h>
|
|---|
| 43 |
|
|---|
| 44 | /**
|
|---|
| 45 | *
|
|---|
| 46 | * @param dest
|
|---|
| 47 | * @param src
|
|---|
| 48 | * @return
|
|---|
| 49 | */
|
|---|
| 50 | char *posix_strcpy(char *dest, const char *src)
|
|---|
| 51 | {
|
|---|
| 52 | // TODO
|
|---|
| 53 | return 0;
|
|---|
| 54 | }
|
|---|
| 55 |
|
|---|
| 56 | /**
|
|---|
| 57 | *
|
|---|
| 58 | * @param dest
|
|---|
| 59 | * @param src
|
|---|
| 60 | * @param n
|
|---|
| 61 | * @return
|
|---|
| 62 | */
|
|---|
| 63 | char *posix_strncpy(char *dest, const char *src, size_t n)
|
|---|
| 64 | {
|
|---|
| 65 | // TODO
|
|---|
| 66 | return 0;
|
|---|
| 67 | }
|
|---|
| 68 |
|
|---|
| 69 | /**
|
|---|
| 70 | *
|
|---|
| 71 | * @param dest
|
|---|
| 72 | * @param src
|
|---|
| 73 | * @return
|
|---|
| 74 | */
|
|---|
| 75 | char *posix_strcat(char *dest, const char *src)
|
|---|
| 76 | {
|
|---|
| 77 | // TODO
|
|---|
| 78 | return 0;
|
|---|
| 79 | }
|
|---|
| 80 |
|
|---|
| 81 | /**
|
|---|
| 82 | *
|
|---|
| 83 | * @param dest
|
|---|
| 84 | * @param src
|
|---|
| 85 | * @param n
|
|---|
| 86 | * @return
|
|---|
| 87 | */
|
|---|
| 88 | char *posix_strncat(char *dest, const char *src, size_t n)
|
|---|
| 89 | {
|
|---|
| 90 | // TODO
|
|---|
| 91 | return 0;
|
|---|
| 92 | }
|
|---|
| 93 |
|
|---|
| 94 | /**
|
|---|
| 95 | *
|
|---|
| 96 | * @param dest
|
|---|
| 97 | * @param src
|
|---|
| 98 | * @param n
|
|---|
| 99 | * @return
|
|---|
| 100 | */
|
|---|
| 101 | void *posix_mempcpy(void *dest, const void *src, size_t n)
|
|---|
| 102 | {
|
|---|
| 103 | // TODO
|
|---|
| 104 | return 0;
|
|---|
| 105 | }
|
|---|
| 106 |
|
|---|
| 107 | /**
|
|---|
| 108 | *
|
|---|
| 109 | * @param s
|
|---|
| 110 | * @return
|
|---|
| 111 | */
|
|---|
| 112 | char *posix_strdup(const char *s)
|
|---|
| 113 | {
|
|---|
| 114 | // TODO
|
|---|
| 115 | return 0;
|
|---|
| 116 | }
|
|---|
| 117 |
|
|---|
| 118 | /**
|
|---|
| 119 | *
|
|---|
| 120 | * @param mem1
|
|---|
| 121 | * @param mem2
|
|---|
| 122 | * @param n
|
|---|
| 123 | * @return
|
|---|
| 124 | */
|
|---|
| 125 | int posix_memcmp(const void *mem1, const void *mem2, size_t n)
|
|---|
| 126 | {
|
|---|
| 127 | // TODO
|
|---|
| 128 | return 0;
|
|---|
| 129 | }
|
|---|
| 130 |
|
|---|
| 131 | /**
|
|---|
| 132 | *
|
|---|
| 133 | * @param s1
|
|---|
| 134 | * @param s2
|
|---|
| 135 | * @return
|
|---|
| 136 | */
|
|---|
| 137 | int posix_strcmp(const char *s1, const char *s2)
|
|---|
| 138 | {
|
|---|
| 139 | // TODO
|
|---|
| 140 | return 0;
|
|---|
| 141 | }
|
|---|
| 142 |
|
|---|
| 143 | /**
|
|---|
| 144 | *
|
|---|
| 145 | * @param s1
|
|---|
| 146 | * @param s2
|
|---|
| 147 | * @param n
|
|---|
| 148 | * @return
|
|---|
| 149 | */
|
|---|
| 150 | int posix_strncmp(const char *s1, const char *s2, size_t n)
|
|---|
| 151 | {
|
|---|
| 152 | // TODO
|
|---|
| 153 | return 0;
|
|---|
| 154 | }
|
|---|
| 155 |
|
|---|
| 156 | /**
|
|---|
| 157 | *
|
|---|
| 158 | * @param s1
|
|---|
| 159 | * @param s2
|
|---|
| 160 | * @return
|
|---|
| 161 | */
|
|---|
| 162 | int posix_strcasecmp(const char *s1, const char *s2)
|
|---|
| 163 | {
|
|---|
| 164 | // TODO
|
|---|
| 165 | return 0;
|
|---|
| 166 | }
|
|---|
| 167 |
|
|---|
| 168 | /**
|
|---|
| 169 | *
|
|---|
| 170 | * @param s1
|
|---|
| 171 | * @param s2
|
|---|
| 172 | * @param n
|
|---|
| 173 | * @return
|
|---|
| 174 | */
|
|---|
| 175 | int posix_strncasecmp(const char *s1, const char *s2, size_t n)
|
|---|
| 176 | {
|
|---|
| 177 | // TODO
|
|---|
| 178 | return 0;
|
|---|
| 179 | }
|
|---|
| 180 |
|
|---|
| 181 | /**
|
|---|
| 182 | *
|
|---|
| 183 | * @param mem
|
|---|
| 184 | * @param c
|
|---|
| 185 | * @param n
|
|---|
| 186 | * @return
|
|---|
| 187 | */
|
|---|
| 188 | void *posix_memchr(const void *mem, int c, size_t n)
|
|---|
| 189 | {
|
|---|
| 190 | // TODO
|
|---|
| 191 | return 0;
|
|---|
| 192 | }
|
|---|
| 193 |
|
|---|
| 194 | /**
|
|---|
| 195 | *
|
|---|
| 196 | * @param mem
|
|---|
| 197 | * @param c
|
|---|
| 198 | * @return
|
|---|
| 199 | */
|
|---|
| 200 | void *posix_rawmemchr(const void *mem, int c)
|
|---|
| 201 | {
|
|---|
| 202 | // TODO
|
|---|
| 203 | return 0;
|
|---|
| 204 | }
|
|---|
| 205 |
|
|---|
| 206 | /**
|
|---|
| 207 | *
|
|---|
| 208 | * @param s
|
|---|
| 209 | * @param c
|
|---|
| 210 | * @return
|
|---|
| 211 | */
|
|---|
| 212 | char *posix_strchr(const char *s, int c)
|
|---|
| 213 | {
|
|---|
| 214 | // TODO
|
|---|
| 215 | return 0;
|
|---|
| 216 | }
|
|---|
| 217 |
|
|---|
| 218 | /**
|
|---|
| 219 | *
|
|---|
| 220 | * @param s
|
|---|
| 221 | * @param c
|
|---|
| 222 | * @return
|
|---|
| 223 | */
|
|---|
| 224 | char *posix_strrchr(const char *s, int c)
|
|---|
| 225 | {
|
|---|
| 226 | // TODO
|
|---|
| 227 | return 0;
|
|---|
| 228 | }
|
|---|
| 229 |
|
|---|
| 230 | /**
|
|---|
| 231 | *
|
|---|
| 232 | * @param s1
|
|---|
| 233 | * @param s2
|
|---|
| 234 | * @return
|
|---|
| 235 | */
|
|---|
| 236 | char *posix_strpbrk(const char *s1, const char *s2)
|
|---|
| 237 | {
|
|---|
| 238 | // TODO
|
|---|
| 239 | return 0;
|
|---|
| 240 | }
|
|---|
| 241 |
|
|---|
| 242 | /**
|
|---|
| 243 | *
|
|---|
| 244 | * @param s1
|
|---|
| 245 | * @param s2
|
|---|
| 246 | * @return
|
|---|
| 247 | */
|
|---|
| 248 | size_t posix_strcspn(const char *s1, const char *s2)
|
|---|
| 249 | {
|
|---|
| 250 | // TODO
|
|---|
| 251 | return 0;
|
|---|
| 252 | }
|
|---|
| 253 |
|
|---|
| 254 | /**
|
|---|
| 255 | *
|
|---|
| 256 | * @param s1
|
|---|
| 257 | * @param s2
|
|---|
| 258 | * @return
|
|---|
| 259 | */
|
|---|
| 260 | size_t posix_strspn(const char *s1, const char *s2)
|
|---|
| 261 | {
|
|---|
| 262 | // TODO
|
|---|
| 263 | return 0;
|
|---|
| 264 | }
|
|---|
| 265 |
|
|---|
| 266 | /**
|
|---|
| 267 | *
|
|---|
| 268 | * @param s1
|
|---|
| 269 | * @param s2
|
|---|
| 270 | * @return
|
|---|
| 271 | */
|
|---|
| 272 | char *posix_strstr(const char *s1, const char *s2)
|
|---|
| 273 | {
|
|---|
| 274 | // TODO
|
|---|
| 275 | return 0;
|
|---|
| 276 | }
|
|---|
| 277 |
|
|---|
| 278 | /**
|
|---|
| 279 | *
|
|---|
| 280 | * @param s1
|
|---|
| 281 | * @param s2
|
|---|
| 282 | * @return
|
|---|
| 283 | */
|
|---|
| 284 | int posix_strcoll(const char *s1, const char *s2)
|
|---|
| 285 | {
|
|---|
| 286 | // TODO
|
|---|
| 287 | return 0;
|
|---|
| 288 | }
|
|---|
| 289 |
|
|---|
| 290 | /**
|
|---|
| 291 | *
|
|---|
| 292 | * @param s1
|
|---|
| 293 | * @param s2
|
|---|
| 294 | * @param n
|
|---|
| 295 | * @return
|
|---|
| 296 | */
|
|---|
| 297 | size_t posix_strxfrm(char *s1, const char *s2, size_t n)
|
|---|
| 298 | {
|
|---|
| 299 | // TODO
|
|---|
| 300 | return 0;
|
|---|
| 301 | }
|
|---|
| 302 |
|
|---|
| 303 | /**
|
|---|
| 304 | *
|
|---|
| 305 | * @param errnum
|
|---|
| 306 | * @return
|
|---|
| 307 | */
|
|---|
| 308 | char *posix_strerror(int errnum)
|
|---|
| 309 | {
|
|---|
| 310 | // TODO
|
|---|
| 311 | return 0;
|
|---|
| 312 | }
|
|---|
| 313 |
|
|---|
| 314 | /**
|
|---|
| 315 | *
|
|---|
| 316 | * @param s
|
|---|
| 317 | * @return
|
|---|
| 318 | */
|
|---|
| 319 | size_t posix_strlen(const char *s)
|
|---|
| 320 | {
|
|---|
| 321 | // TODO
|
|---|
| 322 | return 0;
|
|---|
| 323 | }
|
|---|
| 324 |
|
|---|
| 325 | /** @}
|
|---|
| 326 | */
|
|---|