Question: hi can someone help me ammed this code so that it does the following instead? The following are the major tasks you need to perform:

hi can someone help me ammed this code so that it does the following instead?  hi can someone help me ammed this code so that it
does the following instead? The following are the major tasks you need

The following are the major tasks you need to perform: 1. The first program is called simple_shell and it is included in the file named simple shell.cpp. The program reads a shell command from the user and executes it using the system call execvp. The program is designed to execute one command and then exits. What you need to do is to make the program run forever using an infinite loop, until a termination condition is triggered. Within the loop the program should execute in the following sequence: 1. Read command from user. [Already provided] 2. Cut up the command into argument list. [Already Provided] 3. If the command is equivalent to "exit" break the loop and exit; you can use strcasecmp to check that. Else fork a new child to execute the command and wait for the child until it finishes 4. 5. The child should use execvp. [Already provided] 6. Repeat the sequence again. include include include include ) fgets (command, 1000,stdin)i if (command[ strlen (command)-11 n) command[strlen( command)-1) 10' int arg count getArgumentsCount (command) i arg (char*) calloc (arg count+1,sizeof(char)) argarg count] NULL: setArguments (command, arg) if ( execvp (argt0]1,arg) 0 perror("exeevp") free (arg)i return 12

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!