diff options
author | Marvin Borner | 2019-12-18 17:59:22 +0100 |
---|---|---|
committer | Marvin Borner | 2019-12-18 17:59:22 +0100 |
commit | 07530dd08e0b29573712b54543a7fc42672bb34b (patch) | |
tree | 3026395a952e66a489b3fcf24a89d64f2bb6198c /src/userspace/main.c | |
parent | 025709e8643eb24e3360e575564b34ebd8062fd7 (diff) |
Added very basic command support
Diffstat (limited to 'src/userspace/main.c')
-rw-r--r-- | src/userspace/main.c | 16 |
1 files changed, 13 insertions, 3 deletions
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 <syscall.h> -#include <graphics/graphics.h> #include <mlibc/stdio.h> +#include <mlibc/string.h> + +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 |