diff options
Diffstat (limited to 'userspace/foolshell.c')
| -rw-r--r-- | userspace/foolshell.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/userspace/foolshell.c b/userspace/foolshell.c index 3fe7353..77c78dd 100644 --- a/userspace/foolshell.c +++ b/userspace/foolshell.c @@ -1,8 +1,11 @@ #include <stdio.h> +#include <assert.h> #include <string.h> #include "syscalls.c" #include "../fs/fs.h" +char **environ; + void hello() { puts( "Welcome to FoolShell v0.1" @@ -17,7 +20,6 @@ void prompt() { int main(int argc, char **argv) { - syscalls_init(); hello(); FILE *input; @@ -86,7 +88,7 @@ int process(char *buf) if(!strcmp(command,"help")) { - puts("foolshell: supported built-in commands: 'help', 'echo [string]', 'ls [inode_nr]', exec [inode_nr],'malloc [bytes]', 'free [address]'"); + puts("foolshell: supported built-in commands: 'help', 'echo [string]', 'ls [inode_nr]', exec [inode_nr],'malloc [bytes]', 'free [address]', 'getenv [var]'"); } else if(!strcmp(command,"ls")) { @@ -121,11 +123,23 @@ int process(char *buf) free(atoi(token[1])); printf("foolshell: called free(%08x).\n",atoi(token[1])); } + else if(!strcmp(command,"getenv")) + { + printf("foolshell: %s = %s \n",token[1],getenv(token[1])); + } + else if(!strcmp(command,"putenv")) + { + char buf[256]; + sprintf(buf,"%s=%s",token[1],token[2]); + putenv(buf); + printf("foolshell: %s = %s \n",token[1],getenv(token[1])); + } else { puts("foolshell: command not found"); } + // } |
