From c33bc6864a3291dc72b2da071e52e481573f5459 Mon Sep 17 00:00:00 2001 From: marvinborner Date: Wed, 18 Sep 2019 11:03:36 +0200 Subject: Added missing components --- src/graphics/vga.c | 3 ++- src/lib/lib.h | 8 ++++++++ src/lib/string.c | 14 ++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 src/lib/lib.h create mode 100644 src/lib/string.c (limited to 'src') diff --git a/src/graphics/vga.c b/src/graphics/vga.c index 603a579..5fb205b 100644 --- a/src/graphics/vga.c +++ b/src/graphics/vga.c @@ -2,6 +2,7 @@ #include #include "../io/io.h" #include "../lib/lib.h" +#include "../commands/command.h" // Hardware text mode color constants enum vga_color { @@ -109,7 +110,7 @@ void terminal_put_char(char c) { } else if (c == '\r') { terminal_column = 0; } else if (c == '\n') { - exec_command(line); + exec_command(terminal_get_line()); terminal_column = 0; terminal_row++; terminal_scroll(); diff --git a/src/lib/lib.h b/src/lib/lib.h new file mode 100644 index 0000000..aa5d3bc --- /dev/null +++ b/src/lib/lib.h @@ -0,0 +1,8 @@ +#ifndef MELVIX_LIB_H +#define MELVIX_LIB_H + +size_t strlen(const char *str); + +size_t strcmp(const char *s1, const char *s2); + +#endif diff --git a/src/lib/string.c b/src/lib/string.c new file mode 100644 index 0000000..a4be160 --- /dev/null +++ b/src/lib/string.c @@ -0,0 +1,14 @@ +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) { + while (*s1 && (*s1 == *s2)) { + s1++; + s2++; + } + return *(const unsigned char*)s1 - *(const unsigned char*)s2; +} -- cgit v1.2.3