548e2c20bb
stdout onto each file in turn, then writing through fileno(stdout), use open() and close() like any sensible program. This saves a lot of system calls, removes a dependency on the particular behaviour of BSD freopen(), and allows us to detect and report errors from close().