Question: I could use some help with making this program. Please please use the strucure at the bottom so that I can understand the program better.
I could use some help with making this program. Please please use the strucure at the bottom so that I can understand the program better. also please include the coding pieces listed below in order to get the program to work. The goal is to create a C program that repeatedly enters user input (interpreted as a shell command). The program should parse the command line to determine if it contains input/output redirection. For input from a file it is " ". Then the command line should be executed in a forked child process by using an "exec" call. The program should provide a shell prompt that contains the current working directory followed by a " & ". If the current working directory changes, the prompt should be updated. Some pieces of code that should be used in the program are: - malloc and realloc - getenv - strdup - execvp for exec function - errno and strerror - \#define DEBUG //Functions de implement: char* CommandPrompt 0 ; // Display current working directory and return user input struct ShellCommand ParseCommandl ine(char* input): // Process the user input (As a shell command) void ExecuteCommand(struct ShellCommand command); //Execute a shell command int main0 //MAIN \{ char* input; struct ShellCommand command; I/ repeatedly prompt the ner for imput for (i) \{ input = CommandPrompt 0 1/ parse the command line command = ParscCommandLinc(input); I/ excuile the command ExecuteCommand(command); cxit(0)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
