summaryrefslogtreecommitdiffstats
path: root/zdiff.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2017-04-10 15:19:00 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2017-04-10 15:19:00 +0000
commit6e01d7d8f65270f174ed4f161a5292aa5b89be0c (patch)
treeb73c1aad1d4cf13aad03fb2764f8123f266d27b4 /zdiff.cc
parentReleasing debian version 1.5-5. (diff)
downloadzutils-6e01d7d8f65270f174ed4f161a5292aa5b89be0c.tar.xz
zutils-6e01d7d8f65270f174ed4f161a5292aa5b89be0c.zip
Merging upstream version 1.6.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--zdiff.cc27
1 files changed, 15 insertions, 12 deletions
diff --git a/zdiff.cc b/zdiff.cc
index 26a7365..735eb0b 100644
--- a/zdiff.cc
+++ b/zdiff.cc
@@ -1,5 +1,5 @@
/* Zdiff - decompress and compare two files line by line
- Copyright (C) 2010-2016 Antonio Diaz Diaz.
+ Copyright (C) 2010-2017 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,14 +55,14 @@ void show_help()
"temporary filenames instead of those specified.\n"
"\nThe supported formats are bzip2, gzip, lzip and xz.\n"
"\nUsage: zdiff [options] file1 [file2]\n"
- "\nCompares <file1> to <file2>. If <file2> is omitted zdiff tries the\n"
+ "\nZdiff compares file1 to file2. If file2 is omitted zdiff tries the\n"
"following:\n"
- "\n 1. If <file1> is compressed, compares its decompressed contents with\n"
- " the corresponding uncompressed file (the name of <file1> with the\n"
+ "\n 1. If file1 is compressed, compares its decompressed contents with\n"
+ " the corresponding uncompressed file (the name of file1 with the\n"
" extension removed).\n"
- "\n 2. If <file1> is uncompressed, compares it with the decompressed\n"
- " contents of <file1>.[lz|bz2|gz|xz] (the first one that is found).\n"
- "\n 3. If no suitable file is found, compares <file1> with data read from\n"
+ "\n 2. If file1 is uncompressed, compares it with the decompressed\n"
+ " contents of file1.[lz|bz2|gz|xz] (the first one that is found).\n"
+ "\n 3. If no suitable file is found, compares file1 with data read from\n"
" standard input.\n"
"\nExit status is 0 if inputs are identical, 1 if different, 2 if trouble.\n"
"\nOptions:\n"
@@ -148,7 +148,8 @@ bool set_fifonames( const std::string filenames[2] )
}
-bool set_data_feeder( const std::string & fifoname, const int infd,
+bool set_data_feeder( const std::string & filename,
+ const std::string & fifoname, const int infd,
Children & children, int format_index )
{
const uint8_t * magic_data = 0;
@@ -166,7 +167,7 @@ bool set_data_feeder( const std::string & fifoname, const int infd,
if( pid == 0 ) // child 1 (compressor feeder)
{
if( close( fda[0] ) != 0 ||
- !feed_data( infd, fda[1], magic_data, magic_size ) )
+ !feed_data( filename, infd, fda[1], magic_data, magic_size ) )
_exit( 2 );
if( close( fda[1] ) != 0 )
{ show_close_error(); _exit( 2 ); }
@@ -225,7 +226,7 @@ bool set_data_feeder( const std::string & fifoname, const int infd,
program_name, fifoname.c_str(), std::strerror( errno ) );
_exit( 2 );
}
- if( !feed_data( infd, outfd, magic_data, magic_size ) )
+ if( !feed_data( filename, infd, outfd, magic_data, magic_size ) )
_exit( 2 );
if( close( outfd ) != 0 )
{ show_close_error(); _exit( 2 ); }
@@ -386,8 +387,10 @@ int main( const int argc, const char * const argv[] )
if( !set_fifonames( filenames ) ) return 2;
Children children[2];
- if( !set_data_feeder( fifonames[0], infd[0], children[0], format_types[0] ) ||
- !set_data_feeder( fifonames[1], infd[1], children[1], format_types[1] ) )
+ if( !set_data_feeder( filenames[0], fifonames[0], infd[0], children[0],
+ format_types[0] ) ||
+ !set_data_feeder( filenames[1], fifonames[1], infd[1], children[1],
+ format_types[1] ) )
return 2;
const pid_t diff_pid = fork();