On Wed, 29 Dec 2021 07:53:03 -0600, Scott Cheloha wrote: > uniq(1) defaults to using stdin and stdout, has exactly one input and > one output, and allows changing the input and/or output to a given > file. > > So, freopen(3) is the idiomatic thing to use here. It simplifies and > shortens the code. Then we don't need the file() function, we don't > need additional FILE pointers, and we can just use printf(3).
Looks good to me. I'd have kept the switch() and just done a fallthrough from argc 2 to 1 but that's just personal preference. Your way is probably more readable ;-) - todd