CeDOS - src/libcedos/string.c

src/libcedos/string.c (view raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "string.h"
#include <stdint.h>

void *memset(void *str, int c, size_t n) {
    uint8_t *dest = str;
    for (int i = 0; i < n; i++) {
        dest[i] = c;
    }
}

char * strcpy ( char * destination, const char * source ) {
    int i = 0;

    while (source[i]) {
        destination[i] = source[i];
        i++;
    }
}