Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function int run_program(char *file_path, char *argv[]) with the following features: Starts a program that may be specified by its full path and name

Write a function int run_program(char *file_path, char *argv[]) with the following features:

Starts a program that may be specified by its full path and name (i.e., /usr/bin/who) or only by its name if it is located in one of the directories contained in the PATH environment variable. Do not use system().

Passes the supplied arguments on to the new process.

Waits for the newly created process to exit.

Returns the special error value 127 to report an error condition and 0 to indicate success.

If file path is NULL, you should return the special error value. If argv is NULL, you should run the program without arguments. (Your program starter should not be terminated by an exception in either of the two cases.)

b. Modify the function to return the exit status of the previously started/exited process. Keep a return value of 127 to indicate error conditions in your own program.

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

Oracle RMAN For Absolute Beginners

Authors: Darl Kuhn

1st Edition

1484207637, 9781484207635

More Books

Students also viewed these Databases questions

Question

=+j Improve the effectiveness of global and virtual teams.

Answered: 1 week ago