diff options
author | Daniel Baumann <mail@daniel-baumann.ch> | 2015-11-08 04:30:18 +0000 |
---|---|---|
committer | Daniel Baumann <mail@daniel-baumann.ch> | 2015-11-08 04:30:18 +0000 |
commit | e2010b31ef4137540c264f2fb69f8f2660a6f7fc (patch) | |
tree | f6dc13301edd0ff87720cbb52123d6b0832b293b /zdiff.cc | |
parent | Adding upstream version 1.2~pre2. (diff) | |
download | zutils-e2010b31ef4137540c264f2fb69f8f2660a6f7fc.tar.xz zutils-e2010b31ef4137540c264f2fb69f8f2660a6f7fc.zip |
Adding upstream version 1.2~pre3.upstream/1.2_pre3
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to '')
-rw-r--r-- | zdiff.cc | 21 |
1 files changed, 8 insertions, 13 deletions
@@ -36,12 +36,8 @@ #endif #include "arg_parser.h" -#include "zutils.h" #include "rc.h" - -#if CHAR_BIT != 8 -#error "Environments where CHAR_BIT != 8 are not supported." -#endif +#include "zutils.h" namespace { @@ -50,7 +46,6 @@ std::string fifonames[2]; // names of the two fifos passed to diff #include "zcmpdiff.cc" - void show_help() { std::printf( "Zdiff compares two files (\"-\" means standard input), and if they\n" @@ -177,7 +172,7 @@ bool set_data_feeder( const std::string & fifoname, const int infd, !feed_data( infd, fda[1], magic_data, magic_size ) ) _exit( 2 ); if( close( fda[1] ) != 0 ) - { show_close_error( "data feeder" ); _exit( 2 ); } + { show_close_error(); _exit( 2 ); } _exit( 0 ); } if( pid < 0 ) // parent @@ -186,12 +181,12 @@ bool set_data_feeder( const std::string & fifoname, const int infd, const pid_t pid2 = fork(); if( pid2 == 0 ) // child 2 (compressor) { - const int outfd = open( fifoname.c_str(), O_WRONLY | o_binary ); + const int outfd = open( fifoname.c_str(), O_WRONLY | O_BINARY ); if( outfd < 0 ) { if( verbosity >= 0 ) std::fprintf( stderr, "%s: Can't open FIFO '%s' for writing: %s.\n", - util_name, fifoname.c_str(), std::strerror( errno ) ); + program_name, fifoname.c_str(), std::strerror( errno ) ); _exit( 2 ); } if( dup2( fda[0], STDIN_FILENO ) >= 0 && @@ -225,18 +220,18 @@ bool set_data_feeder( const std::string & fifoname, const int infd, const pid_t pid = fork(); if( pid == 0 ) // child (feeder) { - const int outfd = open( fifoname.c_str(), O_WRONLY | o_binary ); + const int outfd = open( fifoname.c_str(), O_WRONLY | O_BINARY ); if( outfd < 0 ) { if( verbosity >= 0 ) std::fprintf( stderr, "%s: Can't open FIFO '%s' for writing: %s.\n", - util_name, fifoname.c_str(), std::strerror( errno ) ); + program_name, fifoname.c_str(), std::strerror( errno ) ); _exit( 2 ); } if( !feed_data( infd, outfd, magic_data, magic_size ) ) _exit( 2 ); if( close( outfd ) != 0 ) - { show_close_error( "data feeder" ); _exit( 2 ); } + { show_close_error(); _exit( 2 ); } _exit( 0 ); } if( pid < 0 ) // parent @@ -272,7 +267,7 @@ int main( const int argc, const char * const argv[] ) std::vector< const char * > diff_args; // args to diff, maybe empty int format_types[2] = { -1, -1 }; invocation_name = argv[0]; - util_name = "zdiff"; + program_name = "zdiff"; const Arg_parser::Option options[] = { |