1
0
Fork 0

Merging upstream version 1.9.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-24 05:59:37 +01:00
parent 3e7d50525b
commit 13941d3cbe
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
30 changed files with 1188 additions and 1060 deletions

View file

@ -1,18 +1,18 @@
/* Common code for zcmp and zdiff
Copyright (C) 2010-2019 Antonio Diaz Diaz.
/* Common code for zcmp and zdiff
Copyright (C) 2010-2020 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
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
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
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef O_BINARY
@ -38,10 +38,10 @@ int open_other_instream( std::string & name )
name += extension_to( eindex );
return open( name.c_str(), O_RDONLY | O_BINARY );
}
if( eindex < 0 )
if( eindex < 0 ) // search compressed version
for( int i = 0; i < num_formats; ++i )
if( enabled_format( format_order[i] ) )
{ // search compressed version
{
const std::string s( name + simple_extensions[format_order[i]] );
const int infd = open( s.c_str(), O_RDONLY | O_BINARY );
if( infd >= 0 ) { name = s; return infd; }
@ -63,7 +63,7 @@ void parse_format_types2( const std::string & arg, int format_types[2] )
bool check_identical( const char * const name1, const char * const name2 )
{
if( !std::strcmp( name1, name2 ) ) return true;
if( std::strcmp( name1, name2 ) == 0 ) return true;
struct stat stat1, stat2;
if( stat( name1, &stat1 ) || stat( name2, &stat2 ) ) return false;
return ( stat1.st_ino == stat2.st_ino && stat1.st_dev == stat2.st_dev );