Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q4. Write a program in C/C++ that does the following a. Presents a user promptand reads a line from the terminal terminated by an end

image text in transcribed
Q4. Write a program in C/C++ that does the following a. Presents a user promptand reads a line from the terminal terminated by an end of line character Breaks the line into a series of strings ignoring white space (spaces and tabs) Considers the first string to be a command and the remainder to be the arguments for the commands b. c. d. If the command is 'exit' then your program stops e. If the command is 'run' then the second string is considered to be an executable file name, and the remaining strings are arguments to this executable file: Fork is used to create a new child process to execute the file Exec is used in the child process to replace the text segment with the code from the executable file and to pass the remaining parameters a. b. process ends and then retums to the f. Any other value of the first string should be ignored, and the prompt repeated. You will need to look up the fork and exec commands using man, and you will need to c. Your program waits until the child user prompt. decide which form of exec to use

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

Students also viewed these Databases questions

Question

Develop a program for effectively managing diversity. page 303

Answered: 1 week ago

Question

List the common methods used in selecting human resources. page 239

Answered: 1 week ago