aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/graphics/vga.c3
-rw-r--r--src/lib/lib.h8
-rw-r--r--src/lib/string.c14
3 files changed, 24 insertions, 1 deletions
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 <stdint.h>
#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;
+}