Files
cleonos/cleonos/c/apps/shell_main.c

24 lines
715 B
C
Raw Normal View History

2026-04-12 22:04:25 +08:00
#include "shell/shell_internal.h"
2026-04-11 14:18:59 +08:00
2026-04-10 21:16:22 +08:00
int cleonos_app_main(void) {
2026-04-12 22:04:25 +08:00
ush_state sh;
char line[USH_LINE_MAX];
2026-04-11 14:18:59 +08:00
2026-04-12 22:04:25 +08:00
ush_init_state(&sh);
2026-04-13 22:37:39 +08:00
ush_writeln("\x1B[92m[USER][SHELL]\x1B[0m interactive framework online");
2026-04-10 21:16:22 +08:00
if (ush_run_script_file(&sh, "/shell/init.cmd") == 0 && ush_run_script_file(&sh, "/shell/INIT.CMD") == 0 &&
2026-04-13 22:37:39 +08:00
ush_run_script_file(&sh, "/SHELL/INIT.CMD") == 0) {
ush_writeln("\x1B[33m[USER][SHELL]\x1B[0m init script not found, continue interactive mode");
2026-04-10 21:16:22 +08:00
}
2026-04-11 14:18:59 +08:00
for (;;) {
2026-04-12 22:04:25 +08:00
ush_read_line(&sh, line, (u64)sizeof(line));
ush_execute_line(&sh, line);
2026-04-13 19:08:35 +08:00
if (sh.exit_requested != 0) {
return (int)(sh.exit_code & 0x7FFFFFFFULL);
}
2026-04-11 14:18:59 +08:00
}
2026-04-13 22:37:39 +08:00
}