summaryrefslogtreecommitdiff
path: root/userspace/foolshell.c
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2018-08-18 13:23:53 +0200
committerMiguel <m.i@gmx.at>2018-08-18 13:23:53 +0200
commit7b0d88b2dff9b635d9ff69f6d51b6832c1ca4c40 (patch)
tree22c452e9c7ad586136721e776e0b67b23fb33119 /userspace/foolshell.c
parent17fd357bad5f6c3362cfdab1d807aa463c69a4e9 (diff)
cleaning up syscalls and playing with new pipes
Diffstat (limited to 'userspace/foolshell.c')
-rw-r--r--userspace/foolshell.c21
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);