summaryrefslogtreecommitdiff
path: root/userspace/shell.c
diff options
context:
space:
mode:
authorMichal Idziorek <m.i@gmx.at>2014-11-23 14:00:52 +0100
committerMichal Idziorek <m.i@gmx.at>2014-11-23 14:00:52 +0100
commit6a3ef39feb635f529da9e36975ba77a26c1ff3b4 (patch)
tree4a65630f27d0779a5bc3cce1927b13465d10b466 /userspace/shell.c
parent608e66827d8aee1e55424c667777fac017501def (diff)
passing argv and argc to main, and fixed ELF load.
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"))