summaryrefslogtreecommitdiff
path: root/src/user/init/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/user/init/init.c')
-rw-r--r--src/user/init/init.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/user/init/init.c b/src/user/init/init.c
index b8536be..64c534e 100644
--- a/src/user/init/init.c
+++ b/src/user/init/init.c
@@ -2,13 +2,27 @@
#include <knob/file.h>
#include <knob/task.h>
+void start(const char *cmd) {
+ tell_user_sz(cmd);
+ tell_user_sz(": ");
+ tell_user_sz(
+ try_run_command(cmd)
+ ? "success\n"
+ : "failed\n"
+ );
+}
+
+#define STARTUP_FILE_PATH "SYS/STARTUP.RC"
+
void main() {
- struct file *f = open_file("SYS/STARTUP.RC");
+ struct file *f = open_file(STARTUP_FILE_PATH);
if (!f) {
- tell_user_sz("Could not open SYS/STARTUP.RC\n");
+ tell_user_sz("Could not open " STARTUP_FILE_PATH "\n");
return;
}
+ tell_user_sz("[init] Reading from " STARTUP_FILE_PATH ":\n");
+
char buf[1024];
char *bufp = buf;
while (read_from_file(f, 1, bufp)) {
@@ -16,7 +30,7 @@ void main() {
if (bufp == buf)
continue;
*bufp = '\0';
- try_run_command(buf);
+ start(buf);
bufp = buf;
}
else
@@ -24,8 +38,10 @@ void main() {
}
if (bufp != buf) {
*bufp = '\0';
- try_run_command(buf);
+ start(buf);
}
close_file(f);
+
+ tell_user_sz("[init] Done.\n");
}