Merging upstream version 1.5.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
3a44ca3665
commit
060bb99151
30 changed files with 328 additions and 279 deletions
14
zdiff.cc
14
zdiff.cc
|
@ -1,5 +1,5 @@
|
|||
/* Zdiff - decompress and compare two files line by line
|
||||
Copyright (C) 2010-2015 Antonio Diaz Diaz.
|
||||
Copyright (C) 2010-2016 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
|
||||
|
@ -48,7 +48,7 @@ std::string fifonames[2]; // names of the two fifos passed to diff
|
|||
|
||||
void show_help()
|
||||
{
|
||||
std::printf( "Zdiff compares two files (\"-\" means standard input), and if they\n"
|
||||
std::printf( "Zdiff compares two files ('-' means standard input), and if they\n"
|
||||
"differ, shows the differences line by line. If any given file is\n"
|
||||
"compressed, its decompressed content is used. Zdiff is a front end to\n"
|
||||
"the diff program and has the limitation that messages from diff refer to\n"
|
||||
|
@ -123,12 +123,14 @@ bool set_fifonames( const std::string filenames[2] )
|
|||
if( p ) { fifonames[0] = p; fifonames[0] += '/'; }
|
||||
else fifonames[0] = "/tmp/";
|
||||
int n = getpid();
|
||||
const unsigned pos = fifonames[0].size();
|
||||
unsigned pos = fifonames[0].size();
|
||||
do fifonames[0].insert( pos, 1, codes[n % num_codes] );
|
||||
while( n /= num_codes );
|
||||
pos = fifonames[0].size();
|
||||
fifonames[1] = fifonames[0];
|
||||
fifonames[0] += '_'; fifonames[0] += my_basename( filenames[0].c_str() );
|
||||
fifonames[1] += '-'; fifonames[1] += my_basename( filenames[1].c_str() );
|
||||
fifonames[1] += '_'; fifonames[1] += my_basename( filenames[1].c_str() );
|
||||
if( fifonames[1] == fifonames[0] ) fifonames[1][pos] = '-';
|
||||
|
||||
for( int i = 0; i < 2; ++i )
|
||||
if( mkfifo( fifonames[i].c_str(), S_IRUSR | S_IWUSR ) != 0 )
|
||||
|
@ -180,7 +182,7 @@ bool set_data_feeder( const std::string & fifoname, const int infd,
|
|||
if( outfd < 0 )
|
||||
{
|
||||
if( verbosity >= 0 )
|
||||
std::fprintf( stderr, "%s: Can't open FIFO '%s' for writing: %s.\n",
|
||||
std::fprintf( stderr, "%s: Can't open FIFO '%s' for writing: %s\n",
|
||||
program_name, fifoname.c_str(), std::strerror( errno ) );
|
||||
_exit( 2 );
|
||||
}
|
||||
|
@ -219,7 +221,7 @@ bool set_data_feeder( const std::string & fifoname, const int infd,
|
|||
if( outfd < 0 )
|
||||
{
|
||||
if( verbosity >= 0 )
|
||||
std::fprintf( stderr, "%s: Can't open FIFO '%s' for writing: %s.\n",
|
||||
std::fprintf( stderr, "%s: Can't open FIFO '%s' for writing: %s\n",
|
||||
program_name, fifoname.c_str(), std::strerror( errno ) );
|
||||
_exit( 2 );
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue