subject

Shell. c below is a stripped down shell program. It will run a Unix command without any arguments. Copyand save the program as shell. c. Modify the program so that it can execute any shell command. It shouldbe able to take at least 2 arguments. Usually, you need to parse the command line you enter. Using execvpinstead of execlp will probably help. It should work on any UNIX command consisting of 0-2 argumentsafter the command entered by the user, and be error free. The following are a few test cases that the usercould enter.$ cp file1 file2$ ls -l$ whochar *strtok(char *str, const char *delim)is a useful function for parsing the input string. Youcan see below how it used "\n" as a delimiter to get everything before that character. You can specify " " asa delimiter to split the string into arguments. The first time you use it, give it a string as the first parameterto tokenize. This will return the first token. You can then use it subsequent times with NULL as the firstparameter and it will return subsequent tokens in order. After the last token was returned, it returns NULL. For example if you wrote:charinput [ ] = " Hello World ! " ;strtok ( input , " " ) ;strtok (NULL, " " ) ;strtok (NULL, " " ) ;...the first call would return "Hello". The second call would return "World!". And the third call wouldreturn NULL.

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 09:00, mimithurmond03
Which is the highest level of the hierarchy of needs model? a. humanity b. intrapersonal c. team d. interpersonal
Answers: 1
image
Computers and Technology, 24.06.2019 21:30, breannaasmith1122
Along what line of action can the camera move to follow the movement of actors for screen direction? a. along a 90-degree arcb. along a 120-degree arcc. along a 180-degree arcd. along a 360-degree arc
Answers: 1
image
Computers and Technology, 25.06.2019 06:20, joe7977
If you want to change the speed of a layer's horizontal scrolling, what should you change? a. the x coefficient b. the y coefficient c. the virtual width d. the order of the game's layers select the best answer from the choices provided
Answers: 2
image
Computers and Technology, 25.06.2019 07:00, denisefaircloth73
Amisfire code is a type diagnostic trouble code (dtc).
Answers: 1
You know the right answer?
Shell. c below is a stripped down shell program. It will run a Unix command without any arguments. C...

Questions in other subjects:

Konu
English, 16.04.2020 22:32
Konu
Mathematics, 16.04.2020 22:33
Konu
History, 16.04.2020 22:33