C code to read from file or stdin and print to stdout