diff options
author | Daniel Baumann <mail@daniel-baumann.ch> | 2016-05-20 06:48:30 +0000 |
---|---|---|
committer | Daniel Baumann <mail@daniel-baumann.ch> | 2016-05-20 06:49:00 +0000 |
commit | 4d364776fc785a234cebba08bc93cd06202103dd (patch) | |
tree | 90476b30bb959b780c85efc2ab546a5b5e970f2c /ztest.cc | |
parent | Releasing debian version 1.4-2. (diff) | |
download | zutils-4d364776fc785a234cebba08bc93cd06202103dd.tar.xz zutils-4d364776fc785a234cebba08bc93cd06202103dd.zip |
Merging upstream version 1.5.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'ztest.cc')
-rw-r--r-- | ztest.cc | 18 |
1 files changed, 12 insertions, 6 deletions
@@ -1,5 +1,5 @@ /* Ztest - verify integrity of compressed files - Copyright (C) 2010-2015 Antonio Diaz Diaz. + Copyright (C) 2010-2016 Antonio Diaz Diaz. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -51,9 +51,10 @@ namespace { void show_help() { std::printf( "Ztest verifies the integrity of the specified compressed files.\n" - "Uncompressed files are ignored. If no files are specified, the integrity\n" - "of compressed data read from standard input is verified. Data read from\n" - "standard input must be all in the same compression format.\n" + "Uncompressed files are ignored. If no files are specified, or if a file\n" + "is specified as '-', the integrity of compressed data read from standard\n" + "input is verified. Data read from standard input must be all in the same\n" + "compression format.\n" "\nThe supported formats are bzip2, gzip, lzip and xz.\n" "\nNote that some xz files lack integrity information, and therefore can't\n" "be verified as reliably as the other formats can.\n" @@ -270,13 +271,18 @@ int main( const int argc, const char * const argv[] ) for( ; argind < parser.arguments(); ++argind ) filenames.push_back( parser.argument( argind ) ); - if( filenames.empty() ) filenames.push_back("-"); + if( filenames.empty() ) filenames.push_back( "-" ); int retval = 0; bool error = false; + bool stdin_used = false; while( next_filename( filenames, input_filename, error, recursive ) ) { - if( input_filename.empty() ) infd = STDIN_FILENO; + if( input_filename.empty() ) + { + if( stdin_used ) continue; else stdin_used = true; + infd = STDIN_FILENO; + } else { infd = open_instream( input_filename ); |