From d25834310293c8a30b4a31418ff4ffd8fad8ef24 Mon Sep 17 00:00:00 2001 From: Michal Idziorek Date: Tue, 21 Oct 2014 19:08:03 +0200 Subject: started implementing our first fool-shell. --- userspace/foolshell.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 userspace/foolshell.c (limited to 'userspace/foolshell.c') diff --git a/userspace/foolshell.c b/userspace/foolshell.c new file mode 100644 index 0000000..bc02102 --- /dev/null +++ b/userspace/foolshell.c @@ -0,0 +1,34 @@ +#include +#include "syscalls.c" + +void hello() { + puts( + "Welcome to FoolShell v0.1" + ); +} + +void prompt() { + printf( + "$ " + ); +} +int main(int argc, char **argv) +{ + syscalls_init(); + hello(); + + FILE *input; + input=fopen(1,"r"); + char *buf=malloc(256); + + while(1) + { + prompt(); + fgets(buf,255,input); + buf[strlen(buf)-1]=0; + puts(buf); + } + + + return 0; +} -- cgit v1.2.3