summaryrefslogtreecommitdiff
path: root/userspace/foolshell.c
diff options
context:
space:
mode:
authorMichal Idziorek <m.i@gmx.at>2014-11-20 04:51:23 +0100
committerMichal Idziorek <m.i@gmx.at>2014-11-20 04:51:23 +0100
commit1acde03a7c0f85aca9919e374e3df6cee6f0bd08 (patch)
tree10ae84ce2693bad62e5c7376cd0c3c40a80c93df /userspace/foolshell.c
parentbcab3c0be8ff5fe1db1fac9e01973531cc29f554 (diff)
workin on syscall interface etc..
Diffstat (limited to 'userspace/foolshell.c')
-rw-r--r--userspace/foolshell.c18
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");
}
+
//
}