zupdate.cc (zutils-1.9.tar.lz) | : | zupdate.cc (zutils-1.10.tar.lz) | ||
---|---|---|---|---|
/* Zupdate - recompress bzip2, gzip, xz files to lzip format | /* Zupdate - recompress bzip2, gzip, xz files to lzip format | |||
Copyright (C) 2013-2020 Antonio Diaz Diaz. | Copyright (C) 2013-2021 Antonio Diaz Diaz. | |||
This program is free software: you can redistribute it and/or modify | 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 | it under the terms of the GNU General Public License as published by | |||
the Free Software Foundation, either version 2 of the License, or | the Free Software Foundation, either version 2 of the License, or | |||
(at your option) any later version. | (at your option) any later version. | |||
This program is distributed in the hope that it will be useful, | This program is distributed in the hope that it will be useful, | |||
but WITHOUT ANY WARRANTY; without even the implied warranty of | but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
GNU General Public License for more details. | GNU General Public License for more details. | |||
skipping to change at line 69 | skipping to change at line 69 | |||
"long-term data archiving.\n" | "long-term data archiving.\n" | |||
"\nIf no files are specified, recursive searches examine the curr ent\n" | "\nIf no files are specified, recursive searches examine the curr ent\n" | |||
"working directory, and nonrecursive searches do nothing.\n" | "working directory, and nonrecursive searches do nothing.\n" | |||
"\nIf the lzip compressed version of a file already exists, the f ile is\n" | "\nIf the lzip compressed version of a file already exists, the f ile is\n" | |||
"skipped unless the option '--force' is given. In this case, if t he\n" | "skipped unless the option '--force' is given. In this case, if t he\n" | |||
"comparison with the existing lzip version fails, an error is ret urned\n" | "comparison with the existing lzip version fails, an error is ret urned\n" | |||
"and the original file is not deleted. The operation of zupdate i s meant\n" | "and the original file is not deleted. The operation of zupdate i s meant\n" | |||
"to be safe and not cause any data loss. Therefore, existing lzip \n" | "to be safe and not cause any data loss. Therefore, existing lzip \n" | |||
"compressed files are never overwritten nor deleted.\n" | "compressed files are never overwritten nor deleted.\n" | |||
"\nThe names of the original files must have one of the following extensions:\n" | "\nThe names of the original files must have one of the following extensions:\n" | |||
"'.bz2', '.gz', and '.xz' are recompressed to '.lz'.\n" | "'.bz2', '.gz', or '.xz', which are recompressed to '.lz';\n" | |||
"'.tbz', '.tbz2', '.tgz', and '.txz' are recompressed to '.tlz'.\ | "'.tbz', '.tbz2', '.tgz', or '.txz', which are recompressed to '. | |||
n" | tlz'.\n" | |||
"\nUsage: zupdate [options] [files]\n" | "\nUsage: zupdate [options] [files]\n" | |||
"\nExit status is 0 if all the compressed files were successfully recompressed\n" | "\nExit status is 0 if all the compressed files were successfully recompressed\n" | |||
"(if needed), compared, and deleted (if requested). Non-zero othe rwise.\n" | "(if needed), compared, and deleted (if requested). Non-zero othe rwise.\n" | |||
"\nOptions:\n" | "\nOptions:\n" | |||
" -h, --help display this help and exit\n" | " -h, --help display this help and exit\n" | |||
" -V, --version output version information and ex it\n" | " -V, --version output version information and ex it\n" | |||
" -f, --force don't skip a file even if the .lz exists\n" | " -f, --force don't skip a file even if the .lz exists\n" | |||
" -k, --keep keep (don't delete) input files\n " | " -k, --keep keep (don't delete) input files\n " | |||
" -l, --lzip-verbose pass one option -v to the lzip co mpressor\n" | " -l, --lzip-verbose pass one option -v to the lzip co mpressor\n" | |||
" -M, --format=<list> process only the formats in <list >\n" | " -M, --format=<list> process only the formats in <list >\n" | |||
skipping to change at line 279 | skipping to change at line 279 | |||
return 1; } // lzip < 1.11 | return 1; } // lzip < 1.11 | |||
set_permissions( rname.c_str(), in_stats ); | set_permissions( rname.c_str(), in_stats ); | |||
} | } | |||
{ | { | |||
if( lz_exists && verbosity >= 1 ) | if( lz_exists && verbosity >= 1 ) | |||
std::fprintf( stderr, "Comparing file '%s'\n", name.c_str() ); | std::fprintf( stderr, "Comparing file '%s'\n", name.c_str() ); | |||
std::string zcmp_command( invocation_name ); | std::string zcmp_command( invocation_name ); | |||
unsigned i = zcmp_command.size(); | unsigned i = zcmp_command.size(); | |||
while( i > 0 && zcmp_command[i-1] != '/' ) --i; | while( i > 0 && zcmp_command[i-1] != '/' ) --i; | |||
zcmp_command.resize( i ); zcmp_command.insert( 0U, 1, '\'' ); | zcmp_command.resize( i ); zcmp_command.insert( zcmp_command.begin(), '\'' ); | |||
zcmp_command += "zcmp' "; // '[dir/]zcmp' | zcmp_command += "zcmp' "; // '[dir/]zcmp' | |||
if( no_rcfile ) zcmp_command += "-N "; | if( no_rcfile ) zcmp_command += "-N "; | |||
if( verbosity < 0 ) zcmp_command += "-q "; | if( verbosity < 0 ) zcmp_command += "-q "; | |||
zcmp_command += '\''; zcmp_command += name; | zcmp_command += '\''; zcmp_command += name; | |||
zcmp_command += "' '"; zcmp_command += rname; zcmp_command += '\''; | zcmp_command += "' '"; zcmp_command += rname; zcmp_command += '\''; | |||
int status = std::system( zcmp_command.c_str() ); | int status = std::system( zcmp_command.c_str() ); | |||
if( status != 0 ) | if( status != 0 ) | |||
{ if( !lz_exists ) std::remove( rname.c_str() ); | { if( !lz_exists ) std::remove( rname.c_str() ); | |||
return cant_execute( zcmp_command, status ); } | return cant_execute( zcmp_command, status ); } | |||
} | } | |||
End of changes. 3 change blocks. | ||||
5 lines changed or deleted | 5 lines changed or added |