summaryrefslogtreecommitdiffstats
path: root/zcmp.cc
diff options
context:
space:
mode:
Diffstat (limited to '')
-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;
}
}