Fall 16 CST8234 – C Programming Lab 07: doit (Solution)

$ 24.99
Category:

Description

doit is an sh-compatible command language interpreter that executes commands read from the standard input. Your program should read a command from the standard input and then fork a child to execute the command the user asked for. The only build-in command your program should support is q, use to quit your program.
Sample Execution:
root@luna:CST8234# ./doit doit# ls
MakeArg.c 01_exec.c 01_fork.c 02_fork.c 03_fork.c 04_fork.c doit# pwd
Sat Nov 21 14:10:31 EST 2015 doit# q
You can use the function MakeArg( ), posted with this lab, to convert a string into a vector of strings and then use the execvp() function.
Your program should loop forever, present a prompt to the user and read a string, if the string is the letter q, your program should terminate. If not, it should fork a new process and wait until it finishes executing. The child, should convert the string into an array of strings, call the execvp( ). When the child finishes, the parent presents the prompt again to the user.
07_CST8234_doit – 1/1

Reviews

There are no reviews yet.

Be the first to review “Fall 16 CST8234 – C Programming Lab 07: doit (Solution)”

Your email address will not be published. Required fields are marked *