Merging upstream version 1.6.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
b821a3696e
commit
e9522df0a4
30 changed files with 436 additions and 473 deletions
27
zdiff.cc
27
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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue