From 5a7a494ba28f0dfaa5792f70585ca4dfe3c3051a Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 8 Dec 2022 16:52:49 +0100 Subject: Merging upstream version 1.12~rc1. Signed-off-by: Daniel Baumann --- zcat.cc | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'zcat.cc') diff --git a/zcat.cc b/zcat.cc index 02473f0..2a72364 100644 --- a/zcat.cc +++ b/zcat.cc @@ -115,7 +115,7 @@ void show_help() " -M, --format= process only the formats in \n" " -n, --number number all output lines\n" " -N, --no-rcfile don't read runtime configuration file\n" - " -O, --force-format= force the format given (bz2, gz, lz, xz, zst)\n" + " -O, --force-format= force the input format\n" " -q, --quiet suppress all messages\n" " -r, --recursive operate recursively on directories\n" " -R, --dereference-recursive recursively follow symbolic links\n" @@ -128,7 +128,9 @@ void show_help() " --gz= set compressor and options for gzip format\n" " --lz= set compressor and options for lzip format\n" " --xz= set compressor and options for xz format\n" - " --zst= set compressor and options for zstd format\n" ); + " --zst= set compressor and options for zstd format\n" + "\nValid formats for options '-M' and '-O' are 'bz2', 'gz', 'lz', 'xz', 'zst',\n" + "and 'un' for uncompressed.\n" ); show_help_addr(); } @@ -235,10 +237,10 @@ bool cat( int infd, const int format_index, const std::string & input_filename, enum { buffer_size = 4096, outbuf_size = (5 * buffer_size) + 256 + 1 }; // input buffer with space for sentinel newline at the end uint8_t * const inbuf = new uint8_t[buffer_size+1]; - // output buffer with space for character quoting, 255-digit line number, - // worst case flushing respect to inbuf, and a canary byte. + /* output buffer with space for character quoting, 255-digit line number, + worst case flushing respect to inbuf, and a canary byte. */ uint8_t * const outbuf = new uint8_t[outbuf_size]; - outbuf[outbuf_size-1] = 0; + outbuf[outbuf_size-1] = 0; // canary byte; quoting does not print 0 Children children; bool error = false; @@ -258,7 +260,7 @@ bool cat( int infd, const int format_index, const std::string & input_filename, int main( const int argc, const char * const argv[] ) { enum { verbose_opt = 256, bz2_opt, gz_opt, lz_opt, xz_opt, zst_opt }; - int format_index = -1; + int format_index = -1; // undefined int recursive = 0; // 1 = '-r', 2 = '-R' std::list< std::string > filenames; Cat_options cat_options; @@ -338,11 +340,11 @@ int main( const int argc, const char * const argv[] ) case 'v': cat_options.show_nonprinting = true; break; case 'V': show_version(); return 0; case verbose_opt: if( verbosity < 4 ) ++verbosity; break; - case bz2_opt: parse_compressor( arg, fmt_bz2, 1 ); break; - case gz_opt: parse_compressor( arg, fmt_gz, 1 ); break; - case lz_opt: parse_compressor( arg, fmt_lz, 1 ); break; - case xz_opt: parse_compressor( arg, fmt_xz, 1 ); break; - case zst_opt: parse_compressor( arg, fmt_zst, 1 ); break; + case bz2_opt: parse_compressor( arg, pn, fmt_bz2, 1 ); break; + case gz_opt: parse_compressor( arg, pn, fmt_gz, 1 ); break; + case lz_opt: parse_compressor( arg, pn, fmt_lz, 1 ); break; + case xz_opt: parse_compressor( arg, pn, fmt_xz, 1 ); break; + case zst_opt: parse_compressor( arg, pn, fmt_zst, 1 ); break; default : internal_error( "uncaught option." ); } } // end process options -- cgit v1.2.3