From 1e4a254674f668839e5de273916024c16814b045 Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Sun, 13 Sep 2020 03:19:57 -0400 Subject: (basic, not much tested) keyboard, better panic --- src/user/init/init.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'src/user/init') diff --git a/src/user/init/init.c b/src/user/init/init.c index b8536be..64c534e 100644 --- a/src/user/init/init.c +++ b/src/user/init/init.c @@ -2,13 +2,27 @@ #include #include +void start(const char *cmd) { + tell_user_sz(cmd); + tell_user_sz(": "); + tell_user_sz( + try_run_command(cmd) + ? "success\n" + : "failed\n" + ); +} + +#define STARTUP_FILE_PATH "SYS/STARTUP.RC" + void main() { - struct file *f = open_file("SYS/STARTUP.RC"); + struct file *f = open_file(STARTUP_FILE_PATH); if (!f) { - tell_user_sz("Could not open SYS/STARTUP.RC\n"); + tell_user_sz("Could not open " STARTUP_FILE_PATH "\n"); return; } + tell_user_sz("[init] Reading from " STARTUP_FILE_PATH ":\n"); + char buf[1024]; char *bufp = buf; while (read_from_file(f, 1, bufp)) { @@ -16,7 +30,7 @@ void main() { if (bufp == buf) continue; *bufp = '\0'; - try_run_command(buf); + start(buf); bufp = buf; } else @@ -24,8 +38,10 @@ void main() { } if (bufp != buf) { *bufp = '\0'; - try_run_command(buf); + start(buf); } close_file(f); + + tell_user_sz("[init] Done.\n"); } -- cgit v1.2.3