From 1acde03a7c0f85aca9919e374e3df6cee6f0bd08 Mon Sep 17 00:00:00 2001 From: Michal Idziorek Date: Thu, 20 Nov 2014 04:51:23 +0100 Subject: workin on syscall interface etc.. --- userspace/foolshell.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'userspace/foolshell.c') 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 +#include #include #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"); } + // } -- cgit v1.2.3