diff options
| author | Michal Idziorek <m.i@gmx.at> | 2015-05-23 23:44:44 +0200 |
|---|---|---|
| committer | Michal Idziorek <m.i@gmx.at> | 2015-05-23 23:44:44 +0200 |
| commit | 98eb242e282650e9c6645dd2e5290e144b105bb4 (patch) | |
| tree | 69963b6d1d5f51d8eaa5552f402ed34e0bd58241 /userspace | |
| parent | dadd5202a3ccfd8c03fb9eb60e6a15b0fb987672 (diff) | |
improved params and environment passing and started snake-game :)
Diffstat (limited to 'userspace')
| -rw-r--r-- | userspace/Makefile | 3 | ||||
| -rw-r--r-- | userspace/foolshell.c | 21 | ||||
| -rw-r--r-- | userspace/init.c | 2 | ||||
| -rw-r--r-- | userspace/snake.c | 11 |
4 files changed, 27 insertions, 10 deletions
diff --git a/userspace/Makefile b/userspace/Makefile index 48d9b1f..801326b 100644 --- a/userspace/Makefile +++ b/userspace/Makefile @@ -13,7 +13,7 @@ LDFLAGS=-lfool #CFLAGS+=$(SYSROOT)/usr/lib/crt0.o -PROGS=foolshell ls simple brainfuck add checker clear task1 task2 init cat +PROGS=foolshell ls simple brainfuck add checker clear task1 task2 init cat snake include ../Makefile.common @@ -40,6 +40,7 @@ ext2.img: $(PROGS) ../mp/mp.bin rm mnt -rf brainfuck: brainfuck.o +snake: snake.o foolshell: foolshell.o simple: simple.o add: add.o diff --git a/userspace/foolshell.c b/userspace/foolshell.c index 2abb549..0ec7e88 100644 --- a/userspace/foolshell.c +++ b/userspace/foolshell.c @@ -4,6 +4,7 @@ #include <string.h> extern char **environ; + // void hello() { @@ -13,7 +14,7 @@ void hello() puts( "\033c" - "\033[37;44m" + "\033[36m" " ______ __ ____ _____ \n" " / ____/___ ____ / / / __ \\/ ___/ \n" @@ -21,10 +22,11 @@ void hello() " / __/ / /_/ / /_/ / / / /_/ /___/ / \n" " /_/ \\____/\\____/_/ \\____//____/ \n" " \n" - "\033[37;43m" + + "\033[37;44m" " \n" - " Welcome to FoolShell v0.7 (Compiled on " __DATE__ " at " __TIME__ "\n" + " Welcome to FoolShell v0.8 (Compiled on " __DATE__ " at " __TIME__")\n" " ------------------------------------------------------------------\n\n" " Please type 'help' anytime, to show shell \"built-ins\". You can execute \n" " user programms that are in your $PATH directory by simply typing \n" @@ -41,15 +43,20 @@ void hello() void prompt() { - printf("%s%s",getenv("PWD"),getenv("PS1")); + printf("\033[36mfool\033[37m@\033[32mhill\033[33m:%s%s\033[37m",getenv("PWD"),getenv("PS1")); } + int main(int argc, char **argv) { - +/* + printf("argv= 0x%08x \n",argv); + printf("environ= 0x%08x \n",environ); +*/ bool silent=false; for(int i=0;i<argc;i++) { +// printf("%i:%s\n",i+1,argv[i]); if(!strcmp(argv[i],"--silent"))silent=true; } @@ -57,8 +64,6 @@ int main(int argc, char **argv) char *buf=malloc(256); - - while(1) { prompt(); @@ -227,7 +232,7 @@ int process(char *buf) int pid=fork(); if(pid!=0) { - printf("new task pid: %i \n",pid); + // printf("new task pid: %i \n",pid); } if(pid==0) { diff --git a/userspace/init.c b/userspace/init.c index 5d3658c..73848f5 100644 --- a/userspace/init.c +++ b/userspace/init.c @@ -13,7 +13,7 @@ int main(int argc, char **argv) if(pid==0) { char *argv[]={"/bin/foolshell",0}; - char *env[]={"PS1=$","PWD=/home/miguel","PATH=/bin","TERM=xterm",0}; + char *env[]={"PS1=\033[34m$\033[37m","PWD=/home/miguel","PATH=/bin","TERM=linux",0}; execve("/bin/foolshell",argv,env); // replace process with our foolshell :) puts("FATAL ERROR: Something terrible happened. Unable to Execute SHELL!"); while(1);// hang diff --git a/userspace/snake.c b/userspace/snake.c new file mode 100644 index 0000000..afc6bf8 --- /dev/null +++ b/userspace/snake.c @@ -0,0 +1,11 @@ +#include <stdio.h> + +int main() +{ + printf("Hello I am FoolSnake 0.1\n"); + + while(1) + { + printf("%c",getc(stdin)); + } +} |
