Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedimage text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Data Mining

Authors: Pang Ning Tan, Michael Steinbach, Vipin Kumar

1st Edition

321321367, 978-0321321367

More Books

Students also viewed these Databases questions