summaryrefslogtreecommitdiffstats
path: root/zcmp.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2019-01-04 11:13:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2019-01-04 11:13:03 +0000
commit74f3e49ba198016d7d078fbaf4954323f2cb3a15 (patch)
tree3be3ee4bf92eb1d9c3576e6019aa0010015c0161 /zcmp.cc
parentReleasing debian version 1.7-8. (diff)
downloadzutils-74f3e49ba198016d7d078fbaf4954323f2cb3a15.tar.xz
zutils-74f3e49ba198016d7d078fbaf4954323f2cb3a15.zip
Merging upstream version 1.8.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--zcmp.cc15
1 files changed, 9 insertions, 6 deletions
diff --git a/zcmp.cc b/zcmp.cc
index 534e0c6..2408ca0 100644
--- a/zcmp.cc
+++ b/zcmp.cc
@@ -1,5 +1,5 @@
/* Zcmp - decompress and compare two files byte by byte
- Copyright (C) 2010-2018 Antonio Diaz Diaz.
+ Copyright (C) 2010-2019 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
@@ -55,7 +55,7 @@ void show_help()
"are numbered starting with 1. If any given file is compressed, its\n"
"decompressed content is used. Compressed files are decompressed on the\n"
"fly; no temporary files are created.\n"
- "\nThe supported formats are bzip2, gzip, lzip and xz.\n"
+ "\nThe formats supported are bzip2, gzip, lzip and xz.\n"
"\nUsage: zcmp [options] file1 [file2]\n"
"\nZcmp compares file1 to file2. If file2 is omitted zcmp tries the\n"
"following:\n"
@@ -243,7 +243,7 @@ int cmp( const long long max_size, const int infd[2],
rd[i] = readblock( infd[i], buffer[i], size );
if( rd[i] != size && errno )
{
- show_error2( "Error reading file", filenames[i].c_str() );
+ show_file_error( filenames[i].c_str(), "Read error", errno );
return 2;
}
}
@@ -274,6 +274,7 @@ int cmp( const long long max_size, const int infd[2],
filenames[0].c_str(), filenames[1].c_str(),
byte_number, line_number, c0, buf0, c1, buf1 );
}
+ std::fflush( stdout );
return 1;
}
else // verbosity > 0 ; show all differences
@@ -296,6 +297,7 @@ int cmp( const long long max_size, const int infd[2],
}
}
}
+ std::fflush( stdout );
}
}
@@ -435,7 +437,8 @@ int main( const int argc, const char * const argv[] )
for( int i = 0; i < 2; ++i )
if( !skip_ignore_initial( ignore_initial[i], infd[i] ) )
{
- show_error2( "Can't skip initial bytes from file", filenames[i].c_str() );
+ show_file_error( filenames[i].c_str(),
+ "Read error skipping initial bytes", errno );
return 2;
}
@@ -450,13 +453,13 @@ int main( const int argc, const char * const argv[] )
{ show_close_error(); retval = 2; }
if( filenames[i] != "-" && close( old_infd[i] ) != 0 )
{
- show_error2( "Can't close input file", filenames[i].c_str() );
+ show_file_error( filenames[i].c_str(), "Error closing input file", errno );
retval = 2;
}
}
if( std::fclose( stdout ) != 0 )
{
- show_error( "Can't close stdout", errno );
+ show_error( "Error closing stdout", errno );
retval = 2;
}