Question: DO this in UNIX, C Programming III. Creating a History Feature The next task is to modify the shell interface program so that it provides

 DO this in UNIX, C Programming III. Creating a History FeatureThe next task is to modify the shell interface program so that

DO this in UNIX, C Programming

III. Creating a History Feature The next task is to modify the shell interface program so that it provides a history feature to allow a user to execute the most recent command by entering !!. For example, if a user enters the command ls -1, she can then execute that command again by entering !! at the prompt. Any command executed in this fashion should be echoed on the user's screen, and the command should also be placed in the history buffer as the next command. Your program should also manage basic error handling. If there is no recent command in the history, entering !! should result in a message No commands in history. #include #include #define MAX LINE 80 /* The maximum length command */ int main(void) char *args [MAX_LINE/2 + 1]; /* command line arguments */ int should run = 1; /* flag to determine when to exit program */ while (should run) { printf("osh>"); fflush(stdout); * * /** * After reading user input, the steps are: * (1) fork a child process using fork() * (2) the child process will invoke execvp () * (3) parent will invoke wait() unless command included & * * * * return 0; III. Creating a History Feature The next task is to modify the shell interface program so that it provides a history feature to allow a user to execute the most recent command by entering !!. For example, if a user enters the command ls -1, she can then execute that command again by entering !! at the prompt. Any command executed in this fashion should be echoed on the user's screen, and the command should also be placed in the history buffer as the next command. Your program should also manage basic error handling. If there is no recent command in the history, entering !! should result in a message No commands in history. #include #include #define MAX LINE 80 /* The maximum length command */ int main(void) char *args [MAX_LINE/2 + 1]; /* command line arguments */ int should run = 1; /* flag to determine when to exit program */ while (should run) { printf("osh>"); fflush(stdout); * * /** * After reading user input, the steps are: * (1) fork a child process using fork() * (2) the child process will invoke execvp () * (3) parent will invoke wait() unless command included & * * * * return 0

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!