summaryrefslogtreecommitdiff
path: root/userspace/foolshell.c
diff options
context:
space:
mode:
authorMichal Idziorek <m.i@gmx.at>2014-11-20 20:24:18 +0100
committerMichal Idziorek <m.i@gmx.at>2014-11-20 20:24:18 +0100
commit1a6da07e9a6ef7661a58cb6ce22b2874370d6c0d (patch)
tree9d13767cfce0fc0c9f78aed42385533673065e98 /userspace/foolshell.c
parent1acde03a7c0f85aca9919e374e3df6cee6f0bd08 (diff)
experimenting wih userspace and syscalls
Diffstat (limited to 'userspace/foolshell.c')
-rw-r--r--userspace/foolshell.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/userspace/foolshell.c b/userspace/foolshell.c
index 77c78dd..36912c8 100644
--- a/userspace/foolshell.c
+++ b/userspace/foolshell.c
@@ -4,8 +4,6 @@
#include "syscalls.c"
#include "../fs/fs.h"
-char **environ;
-
void hello() {
puts(
"Welcome to FoolShell v0.1"
@@ -23,7 +21,7 @@ int main(int argc, char **argv)
hello();
FILE *input;
- input=fopen(1,"r");
+ input=fopen("input.txt","r");
char *buf=malloc(256);
while(1)
@@ -88,7 +86,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]', 'getenv [var]'");
+ puts("foolshell: supported built-in commands: 'help', 'echo [string]', 'ls [inode_nr]', exec [inode_nr],'malloc [bytes]', 'free [address]', 'getenv [var]', 'putenv [var] [val]'");
}
else if(!strcmp(command,"ls"))
{
@@ -116,12 +114,12 @@ int process(char *buf)
else if(!strcmp(command,"malloc"))
{
uint8_t *mall=malloc(atoi(token[1]));
- printf("foolshell: allocated %d bytes at 0x%8x (%i).\n",atoi(token[1]),mall,mall);
+ printf("foolshell: allocated %d bytes at 0x%08X (%i).\n",atoi(token[1]),mall,mall);
}
else if(!strcmp(command,"free"))
{
free(atoi(token[1]));
- printf("foolshell: called free(%08x).\n",atoi(token[1]));
+ printf("foolshell: called free(0x%08X).\n",atoi(token[1]));
}
else if(!strcmp(command,"getenv"))
{