diff options
author | Lizzy Fleckenstein <lizzy@vlhl.dev> | 2023-12-19 02:17:26 +0100 |
---|---|---|
committer | Lizzy Fleckenstein <lizzy@vlhl.dev> | 2023-12-19 02:17:26 +0100 |
commit | 5d4670ce3e2f075eca07fc6ba8a2065db0e56df3 (patch) | |
tree | 39f6b8309c5a6ab72dee12939bc921e633b72b38 /stage3/shell.c | |
parent | 1e8c290a9937fb74ff7ec2b7ea288b2626ceba3c (diff) | |
download | cuddles-5d4670ce3e2f075eca07fc6ba8a2065db0e56df3.tar.xz |
remove shell_run_file
Diffstat (limited to 'stage3/shell.c')
-rw-r--r-- | stage3/shell.c | 39 |
1 files changed, 17 insertions, 22 deletions
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); - } -} |