Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

can you please create the shell and test it to make sure there's no error. please avoide chat gpt because of the last time it

can you please create the shell and test it to make sure there's no error. please avoide chat gpt because of the last time it was wrong. image text in transcribed
------------------
The is the code from the commandServer2.c file.
image text in transcribed
image text in transcribed
image text in transcribed
2. Create a command shell based on commandServer2.c that recognizes the following commands and calls appropriately named stub routines for each of them. Hand in a separate listing and set of tests that shows that the appropriate routine is called. Create the stubs in a separate file that is included with your main and interpret routine. DO NOT IMPLEMENT THE FUNCTIONALITY OF ANY OF THESE METHODS AT THIS STAGE. The only thing a stub routine should do is return a string "This functionName is not yet implemented" in order to identify which function was called. (4) Use a lookup table to find each command. If the command isn't in the list respond with "commandname not found"). a. export varzvalue unset var b. chdir dirname (3) c. access file1 file 2 file3 ...... (2) d. chmod octalpermission file1 file2 file3 .... (3). e. path file1 file2 file3 .... (3) f. touch m time1 -a time2 file1 file2 file3... (3). g. In -5 -f file1 file2 (3) //Examples of stub routines - the purpose here is to test command and control char "sample (char "cmd, char "remainingTokens []) f int count =; static char msg[1ee]; for (int i=0; remainingTokens [1];i++){ if (access (remainingTokens [i],R,OK)=m ) countt+; 3 sprintf(msg, "\%d files are readably by mel", count); return msg; 3 char "sample2(char * cmd, char * remainingtokens[]) \{ int arge; //this is the number of remaining tokens //Write a loop to count them! // while ( (flag=getopt(argc, remainingtokens, "a:b:c")) I=1) f case 'a': //capture the flag break; case " b ": // capture the flag break; case ' c ': // capture the flag break; 2 //Depending on what my flags have been set to, perform what's needed. 3 char " displayUsers () return "Command 'displayUsers' was received"; 3

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

SQL Server T-SQL Recipes

Authors: David Dye, Jason Brimhall

4th Edition

1484200616, 9781484200612

More Books

Students also viewed these Databases questions