From bce944d1498eaa3b6940ee234c863b3548a66b37 Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Sun, 24 Jan 2021 12:00:11 -0500 Subject: graphics! --- src/user/init/init.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) (limited to 'src/user/init') diff --git a/src/user/init/init.c b/src/user/init/init.c index fb231e0..860c45f 100644 --- a/src/user/init/init.c +++ b/src/user/init/init.c @@ -1,32 +1,29 @@ -#include #include #include #define STARTUP_FILE_PATH "sys/startup.rc" +#define CMD_BUF_LEN 1024 + +char cmdbuf[CMD_BUF_LEN]; void main() { struct file *f = open_file(STARTUP_FILE_PATH); if (!f) { - tell_user_sz("Could not open " STARTUP_FILE_PATH ".\n"); + _system_log("Could not open " STARTUP_FILE_PATH ".\n"); return; } - tell_user_sz("[init] Reading from " STARTUP_FILE_PATH ".\n"); - - char cmdbuf[128]; - while (read_line_from_file(f, cmdbuf, 127)) { - tell_user_sz("[init] Starting "); - tell_user_sz(cmdbuf); - tell_user_sz(": "); - if (run_command(cmdbuf)) { - tell_user_sz("Succeded.\n"); - yield_task(); - } - else - tell_user_sz("Failed.\n"); + while (read_line_from_file(f, cmdbuf, CMD_BUF_LEN - 1)) { + if (cmdbuf[0] == '#') + continue; + //syslogf(run_command(cmdbuf) + // ? "[init] Started %s." + // : "[init] Could not run %s." + //, cmdbuf); + run_command(cmdbuf, 0); } close_file(f); - tell_user_sz("[init] Done starting programs.\n"); + _system_log("Done starting startup tasks."); } -- cgit v1.2.3