in reply to Forked pipe open...or do???

The key point, which Skeeve has alluded to, is that this form of open returns the same value as fork, that is to say, it returns twice: once in the child with the value 0, and again in the parent with the PID of the child. So the part in the do is executed in the child process, and the parent process skips the do and executes the rest of the program.

This is a confusing and unreliable way of writing the code; it handles errors incorrectly, and uses an idiom normally reserved for error handling in a surprising way. When you feel you understand it well, you might want to rewrite it in a more straightforward and robust way.