diff options
Diffstat (limited to 'userspace/foolshell.c')
| -rw-r--r-- | userspace/foolshell.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/userspace/foolshell.c b/userspace/foolshell.c index a502f47..7247871 100644 --- a/userspace/foolshell.c +++ b/userspace/foolshell.c @@ -71,11 +71,27 @@ int main(int argc, char **argv) //char *buf=malloc(256); char *buf=calloc(sizeof(char),256); + printf("setvbuf returned %i\n",setvbuf(stdin,NULL,_IONBF,0)); + while(1) { prompt(); - fgets(buf,255,stdin); - buf[strlen(buf)-1]=0; // remove \n + int bl=0; + + while(1) + { + char c=fgetc(stdin); + putc(c,stdout); + if(c=='\n')break; + + + buf[bl]=c; + buf[bl+1]='\0'; + bl++; + } + + //fgets(buf,255,stdin); + //buf[strlen(buf)-1]=0; // remove \n process(buf); } @@ -125,7 +141,6 @@ char **tokenize(char *buf) int process(char *buf) { - char **token=tokenize(buf); char *command=token[0]; // puts(command); |
