Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

SHELL.CPP I need to implement the display prompt and the read-in command methods. How would I go about doing that. This is what I have

SHELL.CPP

I need to implement the display prompt and the read-in command methods. How would I go about doing that. This is what I have so far please see my code below.

The program below is written in C++

image text in transcribed

#include #include #include #include //implement display prompt here void prompt({ //create initial display screen //implement read in prompt here int main() { //two arrays that hold the command //one array of pointers to hold parameters char cmd[100], command [100], *parameters [20]; //environment - assumption all variables are in /bin char *env[]={(cahr *) "PATH=/bin",0}; //while loop - aka driver while(1) { //display prompt prompt(); //read in from command line read(command, parameters); //fork() is used to run in parallel creating child copies if(fork(!=0) wait(NULL); else{ //copy bin directory strcpy(cmd, "/bin/"); //concatenate what the user enters strcat(cmd, command); //execute command execve(cmd, parameters, env); }//end else //terminate when user enters exit if(strcmp(comm d, "exit")==0) }//end while loop }//end main #include #include #include #include //implement display prompt here void prompt({ //create initial display screen //implement read in prompt here int main() { //two arrays that hold the command //one array of pointers to hold parameters char cmd[100], command [100], *parameters [20]; //environment - assumption all variables are in /bin char *env[]={(cahr *) "PATH=/bin",0}; //while loop - aka driver while(1) { //display prompt prompt(); //read in from command line read(command, parameters); //fork() is used to run in parallel creating child copies if(fork(!=0) wait(NULL); else{ //copy bin directory strcpy(cmd, "/bin/"); //concatenate what the user enters strcat(cmd, command); //execute command execve(cmd, parameters, env); }//end else //terminate when user enters exit if(strcmp(comm d, "exit")==0) }//end while loop }//end main

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_2

Step: 3

blur-text-image_3

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

Flash XML Applications Use AS2 And AS3 To Create Photo Galleries Menus And Databases

Authors: Joachim Schnier

1st Edition

0240809173, 978-0240809175

More Books

Students explore these related Databases questions

Question

What are Decision Trees?

Answered: 3 weeks ago

Question

What is meant by the Term Glass Ceiling?

Answered: 3 weeks ago