From 642b5fb0007b64c77d186fcb018d571152ee1d47 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Mon, 14 Aug 2023 18:51:07 +0200 Subject: reorganization: first steps --- src/user/app/vterm/vterm.c | 72 ---------------------------------------------- 1 file changed, 72 deletions(-) delete mode 100644 src/user/app/vterm/vterm.c (limited to 'src/user/app/vterm/vterm.c') diff --git a/src/user/app/vterm/vterm.c b/src/user/app/vterm/vterm.c deleted file mode 100644 index f365f6b..0000000 --- a/src/user/app/vterm/vterm.c +++ /dev/null @@ -1,72 +0,0 @@ -#include "vterm.h" -#include -#include -#include -#include -#include -#include -#include - -struct point cursor = {0}; - -void in_char(char c) { - switch (c) { - case '\n': - cursor.x = 0; - cursor.y++; - break; - case '\b': - if (cursor.x > 0) cursor.x--; - break; - case '\t': - /* rounds down to nearest multiple of 8 and adds 8 - = adding 1 and rounding up to the nearest multiple of 8 */ - cursor.x = (cursor.x & ~7) + 8; - break; - default: - font_blit(c, cursor.x, cursor.y); - cursor.x++; - } - - if (cursor.x * font.w >= fb.width) { - cursor.x = 0; - cursor.y++; - } - while ((cursor.y + 1) * font.h >= fb.height) scroll(); -} - -int main(void) { - if (fb_setup(&fb, "/kdev/video/") < 0) { - eprintf("fb_setup error"); - return 1; - } - font_load("/init/usr/share/fonts/spleen/spleen-8x16.psfu"); - - static char buf[512]; - struct ufs_request res; - while (!c0_fs_wait(buf, sizeof buf, &res)) { - switch (res.op) { - case VFSOP_OPEN: - // TODO check path - c0_fs_respond(NULL, 0, 0); - break; - - case VFSOP_WRITE: - if (res.flags) { - c0_fs_respond(NULL, -1, 0); - } else { - for (size_t i = 0; i < res.len; i++) - in_char(buf[i]); - dirty_flush(&dirty, &fb); - c0_fs_respond(NULL, res.len, 0); - } - break; - - default: - c0_fs_respond(NULL, -1, 0); - break; - } - } - - return 1; -} -- cgit v1.2.3