summaryrefslogtreecommitdiffstats
path: root/zcmp.cc
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-08 04:18:52 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-08 04:18:52 +0000
commit6a83373eb86eec673be2d24fe840a9bce97fcaaa (patch)
tree5af649b83e4681c1da7b99fb6f15025d6e04c7a2 /zcmp.cc
parentAdding upstream version 0.8. (diff)
downloadzutils-6a83373eb86eec673be2d24fe840a9bce97fcaaa.tar.xz
zutils-6a83373eb86eec673be2d24fe840a9bce97fcaaa.zip
Adding upstream version 0.9~rc1.upstream/0.9_rc1
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'zcmp.cc')
-rw-r--r--zcmp.cc20
1 files changed, 6 insertions, 14 deletions
diff --git a/zcmp.cc b/zcmp.cc
index caa7852..a2779b9 100644
--- a/zcmp.cc
+++ b/zcmp.cc
@@ -20,7 +20,6 @@
#include <cctype>
#include <cerrno>
#include <climits>
-#include <csignal>
#include <cstdio>
#include <cstdlib>
#include <cstring>
@@ -166,9 +165,8 @@ long long getnum( const char * const ptr, const char ** const tailp = 0,
int open_instream( const std::string & input_filename ) throw()
{
int infd = open( input_filename.c_str(), O_RDONLY | o_binary );
- if( infd < 0 && verbosity >= 0 )
- std::fprintf( stderr, "%s: Can't open input file `%s': %s.\n",
- util_name, input_filename.c_str(), std::strerror( errno ) );
+ if( infd < 0 )
+ show_error2( "Can't open input file", input_filename.c_str() );
return infd;
}
@@ -293,9 +291,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 )
{
- if( verbosity >= 0 )
- std::fprintf( stderr, "%s: Error reading file `%s': %s.\n",
- util_name, filenames[i].c_str(), std::strerror( errno ) );
+ show_error2( "Error reading file", filenames[i].c_str() );
return 2;
}
}
@@ -467,9 +463,7 @@ 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] ) )
{
- if( verbosity >= 0 )
- std::fprintf( stderr, "%s: Can't skip initial bytes from file `%s': %s.\n",
- util_name, filenames[i].c_str(), std::strerror( errno ) );
+ show_error2( "Can't skip initial bytes from file", filenames[i].c_str() );
return 2;
}
@@ -483,12 +477,10 @@ int main( const int argc, const char * const argv[] )
for( int i = 0; i < 2; ++i )
{
if( close( infd[i] ) != 0 )
- { show_error( "Can't close output of data feeder", errno ); retval = 2; }
+ { show_close_error( "data feeder" ); retval = 2; }
if( filenames[i] != "-" && close( old_infd[i] ) != 0 )
{
- if( verbosity >= 0 )
- std::fprintf( stderr, "%s: Can't close input file `%s': %s.\n",
- util_name, filenames[i].c_str(), std::strerror( errno ) );
+ show_error2( "Can't close input file", filenames[i].c_str() );
retval = 2;
}
}