Forking a piped sub processes
===

What is the best technique to fork a pipe-lined sub processes?

My current program needs to run another processes that is actually a couple of commands linked by pipes. I do not need to know the output of the commands just if they fail or succeed so I am using fork/exec.

The equivalent on the command line would be

     /path/to/A arg1 arg2 | /path/to/B argB1 | /path/to/C

Note: Using a script is not practical as it A/B/C may change in the future.

The two techniques I though of are:

1. Recursive fork. Connect the parent (input to its parent) output available for child in next fork.

2. Create all pipes at top level.  
   Then use a loop to fork all children that can then connect the pipes appropriately.

