Exercise 4.1 from The Linux Programming Interface by Michael Kerrisk. This exercise was to implement a simplified version of the UNIX tee command.