C:fgets
lastmod 2020-03-22created 2020-03-221 edits
STDIN and PIPE
When you need to support both standard input (STDIN) and input passed through a PIPE at the same time, use fgets.
The point is: When you press CTRL+D, you signal EOF on stdin of the parent. So the parent leaves this loop
since fgets() returns NULL on EOF.