summaryrefslogtreecommitdiff
path: root/userspace/shell.c
diff options
context:
space:
mode:
Diffstat (limited to 'userspace/shell.c')
-rw-r--r--userspace/shell.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/userspace/shell.c b/userspace/shell.c
index ae39c1a..06a03d2 100644
--- a/userspace/shell.c
+++ b/userspace/shell.c
@@ -1,7 +1,7 @@
#include <stdio.h>
#include <stdint.h>
-#include <assert.h>
#include <string.h>
+
#include "../fs/fs.h"
void hello() {
@@ -18,16 +18,15 @@ void prompt() {
int main(int argc, char **argv)
{
-// hello();
- FILE *input;
- input=fopen("input.txt","r");
+// hello();
+
char *buf=malloc(256);
while(1)
{
prompt();
- fgets(buf,255,input);
+ fgets(buf,255,stdin);
buf[strlen(buf)-1]=0; // remove \n
process(buf);
}
@@ -65,10 +64,12 @@ char **tokenize(char *buf)
i++;
}
token[c][t]=0;
+
// printf("token %i : <%s>\n",c, token[c]);
c++;
+ token[c]=NULL;
}
@@ -103,7 +104,7 @@ int process(char *buf)
}
else if(!strcmp(command,"exec"))
{
- execve(atoi(token[1]),0,0);
+ execve(atoi(token[1]),token,0);
}
else if(!strcmp(command,"echo"))