summaryrefslogtreecommitdiff
path: root/src/user/init
diff options
context:
space:
mode:
authorBenji Dial <benji6283@gmail.com>2020-09-13 03:19:57 -0400
committerBenji Dial <benji6283@gmail.com>2020-09-13 03:19:57 -0400
commit1e4a254674f668839e5de273916024c16814b045 (patch)
tree6774f4d4398a29c4aafb4120070975d864ffcde4 /src/user/init
parentb8284137d4e0eec11c78bc14047243fce6a51373 (diff)
downloadportland-os-1e4a254674f668839e5de273916024c16814b045.tar.gz
(basic, not much tested) keyboard, better panic
Diffstat (limited to 'src/user/init')
-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");
}