   C Problem
  This program works like this, the user will enter a command "ls | sort", the program spilts up the arguements that this argList[0] = 'ls'argList[1] = '|'argList[2] = 'sort'Then It forks,pipes, then child process will do the first command the 'ls', and then writes the results to the stdin. Once that is done, the parent process is supposed to run the 'sort' command with the arguement of the stdin. But I am not sure how to do this, any tips????#include <stdio.h>#include <unistd.h>#include <sys/stat.h> #include <signal.h> #include <string.h> #define READ 0#define WRITE1#define false 0#define true1int readArgs(const char *line, char *argList[]);int findPipe(char *input);void parent(int *fd, char *argList[]);void child(int *fd, char *argList[]);void sig_usr(int signo); int main(int argc, char *argv[]){   pid_t pid;   char line[255];char *argList[20];int pipeFound;   int fd[2];//This tests to make sure the user is alot to use the shellstruct stat buf;if(stat("/bin/sh", &buf) != -1){if(! S_IXOTH & buf.st_mode){perror("\n*** Permission To Use This Shell Has Not Been Granted ***\n");exit(1);}}signal(SIGUSR1, sig_usr);//This is a loop that will only end when the user types in 'exit'while(1){//Prints the text and reads in 255 characters  printf("--->");  fgets(line, 255, stdin);   line[strlen(line)-1] = '\0';  // trim off newline   if ( strlen(line) == 0 ) // if no input   continue;//Exits if the user entered 'exit'   if ( strcmp(line, "exit") == 0)   break;int foundPipe = findPipe(line);if(foundPipe)//found{if( (pid = fork()) == -1 )//first fork{  perror("Can not fork");  exit(1);   }pipe(fd);readArgs(line, argList);argList[1] = '\0';if(pid > 0) //root parent{wait(pid, 0, 0);parent(fd, argList);}else //child{child (fd, argList);kill(pid, SIGUSR1);pause();}}else //not found{if((pid = fork()) == -1){  perror("Can not fork");  exit(1);   }if( pid > 0  )waitpid(pid, 0, 0);else{readArgs(line, argList);printf("\n");if(system(argList[0])== -1)exit(2);printf("\n");}}//end if    }//end while }//end mainvoid parent(int *fd, char *argList[]){char result[1024];printf("\nParent\n");dup2(fd[READ], 0);read(fd[READ], result, sizeof(result));if( system(argList[2]) == -1)exit(2);printf("\n%s\n", result);}void child(int *fd, char *argList[]){dup2(fd[WRITE], 1);printf("\n");if( system(argList[0]) == -1)exit(2);printf("\n");}void sig_usr(int signo) { signal(SIGUSR1, sig_usr);} int findPipe(char *input){int i = 0;for(i = 0; i < 100; i++){if(input == '|')return true;}return false;}int readArgs(const char *line, char *argList[]){   static int yes=0;   int i=0, found=0, offset = 0;   char name[50];   while(yes && argList != NULL)free(argList[i++]);   i=0;  // reset i to ZERO   while(sscanf(line+offset, "%s", name)==1){argList = (char *) malloc(strlen(name)+1);strcpy(argList[i++], name);    while(line[offset]==' ') offset++;  //skip blanksoffset += strlen(name);   }  if(!strcmp(argList[i-1], "|")){argList[i-1] = NULL;found = 1;   }   else{    if(argList[i-1][strlen(argList[i-1])-1]=='|'){    argList[i-1][strlen(argList[i-1])-1]='\0';    found = 1;}argList = NULL;   }yes=1;   return(found); }//end readArgs