diff options
author | Marvin Borner | 2019-11-23 00:36:28 +0100 |
---|---|---|
committer | Marvin Borner | 2019-11-23 00:36:28 +0100 |
commit | 45d9495e77dba212551ae9bc8e09b51e9ed6d324 (patch) | |
tree | 1e8ead9a55b41fa009c28823ca7a9ac0b1b5b2fe /src/kernel/lib/string.c | |
parent | 4b178c0feb4c415be36be0e4c0def8c447ed42af (diff) |
Tried implementing memory based paging...
Also did many other fixes/improvements.
While I think I did most things correct,
the ACPI doesn't work anymore (triple fault) and
the resolution detection fails with 0x2... :c
Diffstat (limited to 'src/kernel/lib/string.c')
-rw-r--r-- | src/kernel/lib/string.c | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/src/kernel/lib/string.c b/src/kernel/lib/string.c deleted file mode 100644 index 12b4b06..0000000 --- a/src/kernel/lib/string.c +++ /dev/null @@ -1,52 +0,0 @@ -#include <stddef.h> -#include <kernel/io/io.h> - -size_t strlen(const char *str) { - size_t len = 0; - while (str[len]) - len++; - return len; -} - -size_t strcmp(const char *s1, const char *s2) { - size_t s_a = strlen(s1); - for (size_t i = 0; i < s_a; i++) - if (s1[i] != s2[i]) - return 1; - return 0; -} - -void strcat(char *dest, const char *src) { - size_t s_dest = strlen(dest); - size_t s_orig = strlen(src); - - for (size_t i = 0; i < s_orig; i++) dest[s_dest + i] = src[i]; - dest[s_dest + s_orig] = 0; -} - -void strcpy(char *dest, const char *src) { - size_t s_orig = strlen(src); - - for (size_t i = 0; i < s_orig; i++) dest[i] = src[i]; - dest[s_orig] = 0; -} - -char *itoa(int i, char b[]) { - char const digit[] = "0123456789"; - char *p = b; - if (i < 0) { - *p++ = '-'; - i *= -1; - } - int shifter = i; - do { - ++p; - shifter = shifter / 10; - } while (shifter); - *p = '\0'; - do { - *--p = digit[i % 10]; - i = i / 10; - } while (i); - return b; -}
\ No newline at end of file |