gzip: simplify by closing ourselves
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 20 Apr 2016 05:05:57 +0000 (22:05 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 20 Apr 2016 05:27:13 +0000 (22:27 -0700)
commitf879a0511c034a21b0e9a15caf866006f9d1bed5
tree2b4a022d6c2d44f4268319e6a7ecc27fb49cc614
parent3557cd57906915eb9c990b5f386e25c395592643
gzip: simplify by closing ourselves

This simplifies the previous fix, by avoiding the use of the
closein module.  That module was problematic, as gzip normally
does not use stdio for output and never uses it for input.
Also, it is a heavyweight module, as it drags many files into lib
(c-ctype.c, c-ctype.h, closein.c, closein.h, closeout.c, closeout.h,
close-stream.c, close-stream.h, config.charset, c-strcasecmp.c,
c-strcaseeq.h, c-strcase.h, c-strncasecmp.c, fpending.c, fpending.h,
freadahead.c, freadahead.h, localcharset.c, localcharset.h, mbrtowc.c,
mbsinit.c, quotearg.c, quotearg.h, quote.h, ref-add.sin, ref-del.sin,
streq.h, wctype-h.c, wctype.in.h) and into m4 (closein.m4, closeout.m4,
close-stream.m4, codeset.m4, configmake.m4, fpending.m4, freadahead.m4,
glibc21.m4, localcharset.m4, locale-fr.m4, locale-ja.m4, locale-zh.m4,
mbrtowc.m4, mbsinit.m4, mbstate_t.m4, quotearg.m4, wctype_h.m4),
and these files are thus no longer needed.
* bootstrap.conf (gnulib_modules): Remove closein.
* gzip.c: Don't include closein.h.
(stdin_was_read): New static var.
(main): Don't use close_stdin.
Invoke finish_out to exit after outputting via stdio's stdout.
Close stdin after reading it.
Restore previous way of closing stdout.
(treat_stdin): Record that stdin was read.
(finish_out): New function.
bootstrap.conf
gzip.c