diff options
Diffstat (limited to 'src/user/init/init.c')
-rw-r--r-- | src/user/init/init.c | 29 |
1 files changed, 13 insertions, 16 deletions
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 <knob/user.h> #include <knob/file.h> #include <knob/task.h> #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."); } |