summaryrefslogtreecommitdiff
path: root/src/user/init/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/user/init/main.c')
-rw-r--r--src/user/init/main.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/user/init/main.c b/src/user/init/main.c
index 002fd92..9a411e7 100644
--- a/src/user/init/main.c
+++ b/src/user/init/main.c
@@ -1,16 +1,29 @@
-#include <pland.h>
-#include <canyo/file.h>
+#include <knob/user.h>
+#include <knob/file.h>
+#include <knob/heap.h>
void main() {
- fs_handle f = fs_open("sys/startup.rc");
+ tell_user_sz("\n\nThis is a userland program.\n");
+
+ tell_user_sz("Opening sd0:TEST.TXT.\n");
+ struct file *f = open_file("sd0:TEST.TXT");
if (!f) {
- vga_printsz("Couldn't open sys/startup.rc\n");
+ tell_user_sz("Failed to open.\n");
return;
}
- uint8_t line_buffer[128];
- while (read_line(f, 128, line_buffer))
- plef_run(line_buffer);
+ tell_user_sz("Length: ");
+ uint32_t size = file_size(f);
+ tell_user_n(size);
+ tell_user_sz(" bytes\n\nContents:\n");
+
+ char *buf = get_block(size + 1);
+ read_from_file(f, size, buf);
+ buf[size] = '\0';
+
+ close_file(f);
+
+ tell_user_sz(buf);
- fs_close(f);
+ tell_user_sz("\n\nGoodbye!\n");
}