Computers and Technology

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.

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 08:00, lindseyreneesmith7
Digital information is stored using a series of ones and zeros. computers are digital machines because they can only read information as on or off –1 or 0. this method of computation is known as the system
Answers: 1
image
Computers and Technology, 23.06.2019 08:30, mai1261
Helen's credit card has an apr of 15.32% and a grace period of 17 days and helen pays her balance in the full every month. if her last billing cycle ended on september 26, 2009, and she made her payment on october 11, 2009, did she owe any interest on her last statement's balance?
Answers: 3
image
Computers and Technology, 24.06.2019 10:00, zlittleton2008
Which feature of a blog to restore and retrieve older post
Answers: 3
image
Computers and Technology, 24.06.2019 15:30, sonyfan
What is the total number of time zones that can be configured to show by default in a calendar in outlook 2016?
Answers: 1
Do you know the correct 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
Spanish, 18.03.2021 04:10
Konu
Mathematics, 18.03.2021 04:10
Konu
Mathematics, 18.03.2021 04:10
Konu
English, 18.03.2021 04:10