Question: Assignment OS: The Shell or Command Line Interpreter is the fundamental User interface to an Operating System. Your third project is to write a simple

Assignment OS:

The Shell or Command Line Interpreter is the fundamental User interface to an Operating System. Your third project is to write a simple shell - myshell - that has the following properties: 1. The shell must support the following internal commands: a. clr - Clear the screen. b. dir - List the contents of directory . c. environ - List all the environment strings. d. run prog p1 p2 execs to prog passing the parameters p1 p2 e sleep Runs the program from assignment 1 e. quit - Quit the shell. 2. All other command line input is interpreted as program invocation, which should be done by the UNIX system() function

To start this the code:

** This program was compiled and run on alpha.fdu.edu ** but it should work on any UNIX system. ** ** To compile and run: ** >>cc exammpleshell.c -o ashell ** >>ashell ** OR ** >>cc exampleshell.c ** >>a.out */ #include #include #include

enum { MAXLINE = 200 };

/* ** This function ** processes the ** command. */ void processLine( const char * const s ) { /* ** Do not hesitate ** to declare lots of ** local variables. ** The optimizer ** removes them ** but can make the ** program more ** readable. */ const char * const stopStr = "quit"; const int sLen = strlen(stopStr); const int sVal = strncmp(s, stopStr, sLen);

/* ** Output command. */ printf("Command received = %s ", s);

/* ** If stop string entered, ** exit(0). */ if(!sVal) exit(0);

}

int main() {

char line[MAXLINE];

/* ** When a const ** is needed declare ** it as such. */ const char * const prompt = "id number> ";

/* ** Get a command line, parse it and process it. ** This program exits via an exit(0) in the ** processLine() function. */ while(1) { const int j = fputs(prompt, stdout); const char * const c = fgets(line, MAXLINE, stdin); processLine(line); } return 0;

}

i need to declare the 5 property in the question above.

thanks.

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!