diff options
-rw-r--r-- | stage3/main.c | 2 | ||||
-rw-r--r-- | stage3/shell.c | 39 | ||||
-rw-r--r-- | stage3/shell.h | 1 |
3 files changed, 18 insertions, 24 deletions
diff --git a/stage3/main.c b/stage3/main.c index 30f1bbd..03a1db5 100644 --- a/stage3/main.c +++ b/stage3/main.c @@ -107,7 +107,7 @@ void kmain() ata_init(); ps2_init(); - shell_run_file(S("init")); + shell_run_cmd(S("run init")); thread *keyboard_thread = thread_create(S("keyboard"), &keyboard_handler); irq_services[1] = keyboard_thread; diff --git a/stage3/shell.c b/stage3/shell.c index f8d5ada..9cfe833 100644 --- a/stage3/shell.c +++ b/stage3/shell.c @@ -92,7 +92,23 @@ static void cmd_lspci(str arg) static void cmd_run(str arg) { - shell_run_file(arg); + str f = fs_read(arg); + + if (f.data == nil) { + print(S("run: file not found: ")); + print(arg); + print(S("\n")); + } else { + str iter = f; + for (;;) { + str cmd = str_split_walk(&iter, S("\n")); + if (cmd.data == nil) + break; + shell_run_cmd(cmd); + } + + free(f.data); + } } extern char keymap[256]; @@ -149,24 +165,3 @@ void shell_run_cmd(str cmd) print(prog); print(S("\n")); } - -void shell_run_file(str filename) -{ - str f = fs_read(filename); - - if (f.data == nil) { - print(S("shell: file not found: ")); - print(filename); - print(S("\n")); - } else { - str iter = f; - for (;;) { - str cmd = str_split_walk(&iter, S("\n")); - if (cmd.data == nil) - break; - shell_run_cmd(cmd); - } - - free(f.data); - } -} diff --git a/stage3/shell.h b/stage3/shell.h index 2336d21..d8d2450 100644 --- a/stage3/shell.h +++ b/stage3/shell.h @@ -4,6 +4,5 @@ #include "def.h" void shell_run_cmd(str arg); -void shell_run_file(str arg); #endif |