summaryrefslogtreecommitdiff
path: root/src/user/test/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/user/test/main.c')
-rw-r--r--src/user/test/main.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/user/test/main.c b/src/user/test/main.c
index a7df667..e7a6b4f 100644
--- a/src/user/test/main.c
+++ b/src/user/test/main.c
@@ -93,9 +93,29 @@ int main() {
close(f);
}
- printk(" -> Now sleeping, forever and ever...\n");
- while(1) {
- thread_sleep(1000);
+ printk(" -> YOUR SHELL IS STARTING UP, SIR.\n");
+ f = open("/.ui/klog", 0);
+ if (f <= 0) {
+ printk(" -> Error #"); printk_int(f); printk(" - too bad. Exiting.\n");
+ } else {
+ char *s = "Hello, writing from your opened file!\n";
+ write(f, 0, strlen(s), s);
+ while (1) {
+ char *s = " > ";
+ write(f, 0, strlen(s), s);
+
+ char buffer[256];
+ int l = read(f, 0, 255, buffer);
+ buffer[l] = 0;
+ if (buffer[l-1] == '\n') {
+ char *s = "You said: ";
+ write(f, 0, strlen(s), s);
+ write(f, 0, l, buffer);
+ } else {
+ char *s = "oops\n";
+ write(f, 0, strlen(s), s);
+ }
+ }
}
return 0;