This is the Project Question. I just want a help how to start! Thank you in advanced.


You are requested to develop a new UNIX command named “cone” to execute many sub-commands simultaneously. The set of sub-commands to be executed by cone will be provided as command-line arguments. For each command-line argument, cone will create a new process in order to execute the corresponding sub-command. For example, if we type at UNIX’s shell prompt
cone ls ps
cone will create two child processes such that the first child executes “ls” command and the second child executes “ps” command.

An option (-w) can be supplied to enforce cone command to suspend until all sub-commands have been terminated. In this case, a log file “.cone.log” will be generated describing the termination status for each child process. A typical log file might look as follows:

ps normal 0
mycode normal 2
prog abnormal 14

cone command should terminate with exit code 0 (zero) if all children processes are successfully forked (when –w option is not specified). Otherwise it should terminate with a non-zero value based on the following table:

Exit code Meaning
1 cone was executed without arguments
2 If cone command fails to fork a new process, the program should terminate directly with exit code 2.
3 A child process was terminated with exit code greater than zero.
4 A child process was terminated abnormally.

If a sub-command requires an option or options then the command name along with its options are surrounded by quotation mark. For example
cone "ls –l -a" "ps –l"

1. Be sure that only the parent process creates all other children processes.
2. If a command-line argument is surrounded by a quotation mark, it will be passed as a single argument.