From 07530dd08e0b29573712b54543a7fc42672bb34b Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Wed, 18 Dec 2019 17:59:22 +0100 Subject: Added very basic command support --- src/userspace/main.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/userspace/main.c') diff --git a/src/userspace/main.c b/src/userspace/main.c index 0bea7fa..63ce8f4 100644 --- a/src/userspace/main.c +++ b/src/userspace/main.c @@ -1,6 +1,13 @@ #include -#include #include +#include + +int32_t starts_with(const char *a, const char *b) +{ + size_t length_pre = strlen(b); + size_t length_main = strlen(a); + return length_main < length_pre ? 0 : memcmp(b, a, length_pre) == 0; +} void user_main() { @@ -10,7 +17,10 @@ void user_main() // init_framebuffer(); while (1) { - char key = getch(); - writec(key); + char *input = readline(); + if (starts_with(input, "ls")) { + char test[] = "WOOOHOOO\n"; + syscall_write(test); + } }; } \ No newline at end of file -- cgit v1.2.3