Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for (pipeFlag; pipeFlag > 0; pipeFlag--){
- pipeIndex = pipeFlag%2;
- filedes[pipeIndex][0]=0;
- filedes[pipeIndex][1]=0;
- pipe(filedes[pipeIndex]);
- CHK( childpid = fork());
- if (childpid == 0){
- outputFlag = 0;
- dup2(filedes[pipeIndex][1], STDOUT_FILENO);
- if(pipeAmpFlag != 0){
- dup2(filedes[pipeIndex][1], STDERR_FILENO);
- pipeAmpFlag = 0;
- }
- close(filedes[pipeIndex][0]);
- close(filedes[pipeIndex][1]);
- pipeLocation -=2;
- while(newargv[pipeLocation] != 0 && pipeLocation >= 0)
- pipeLocation--;
- pipeLocation++;
- }else{
- inputFlag = 0;
- dup2(filedes[pipeIndex][0], STDIN_FILENO);
- close(filedes[pipeIndex][0]);
- close(filedes[pipeIndex][1]);
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement