Im mid way through writting my own c shell and having trouble with my redirecting,
i use strtok to spilt the input into 2 parts, argv0 being command and argv1 being cmd
i have this for redirecting so far
if(strcmp(cmd,">")==0)
{
strcpy(filename, command);
filein = open(filename, O_RDONLY);
dup2(filein,0);
close(filein);
break;
}
else if(strcmp(cmd,"<")==0)
{
strcpy(filename, command);
fileout = open(filename, O_WRONLY);
dup2(fileout,1);
close(fileout);
break;
}
any help?