From bd77381c27ef5b61bf1c123efef3895b98a7a615 Mon Sep 17 00:00:00 2001 From: James Barnett Date: Sun, 26 May 2019 19:28:27 +0100 Subject: Proxy keypress from kernel to focused program --- os/shell/shell.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 os/shell/shell.c (limited to 'os/shell/shell.c') diff --git a/os/shell/shell.c b/os/shell/shell.c new file mode 100644 index 0000000..933b19c --- /dev/null +++ b/os/shell/shell.c @@ -0,0 +1,23 @@ +#include "../../os/main.h" +#include "../../kernel/gpu/text_mode/display.h" + +void keypress_handler(unsigned char key) { + switch(key) + { + case '\b': + scrn_backspace(); + break; + case '\n': + scrn_newline(); + break; + default: + scrn_putchar(key); + } +} + +Program_t shell_run() { + Program_t this; + this.keypress_handler = keypress_handler; + this.name = "shell"; + return this; +} \ No newline at end of file -- cgit v1.2.3