gzip: fix exit status on broken pipe
Fix gzip to behave like cat etc. when outputting to a broken pipe:
i.e., exit with nonzero status if SIGPIPE is ignored, and be
terminated by SIGPIPE otherwise.
* NEWS: Mention this.
* gzip.c: Do not install signal handlers unless creating an output
file, for which signal handlers are needed. This avoids gzip
having to deal with signal handlers when outputting to stdout.
(exiting_signal): Remove. All uses removed.
(main): Do not install signal handlers at first.
(create_outfile): Instead, install them only when needed.
(finish_up_gzip): New function, which generalizes abort_gzip.
(abort_gzip): Use it.
* tests/pipe-output: New test.
* tests/Makefile.am (TESTS): Add it.
* util.c (EPIPE): Default to 0.
(write_error): Just warn if it is a pipe error, and suppress that
warning if quiet. In any event exit with status 2 (warning),
not status 1 (error).
* zgrep.in: Treat gzip status 141 like status 2;
it is a broken pipe either way.