Merging upstream version 1.15.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
ba8e0a83c7
commit
60d97c7cb2
24 changed files with 310 additions and 146 deletions
26
ztest.cc
26
ztest.cc
|
@ -46,6 +46,7 @@
|
|||
|
||||
namespace {
|
||||
|
||||
#include "exclude.cc"
|
||||
#include "recursive.cc"
|
||||
|
||||
void show_help()
|
||||
|
@ -84,6 +85,7 @@ void show_help()
|
|||
" -r, --recursive operate recursively on directories\n"
|
||||
" -R, --dereference-recursive recursively follow symbolic links\n"
|
||||
" -v, --verbose be verbose (a 2nd -v gives more)\n"
|
||||
" -x, --exclude=<pattern> exclude files matching a shell pattern\n"
|
||||
" --bz2=<command> set compressor and options for bzip2 format\n"
|
||||
" --gz=<command> set compressor and options for gzip format\n"
|
||||
" --lz=<command> set compressor and options for lzip format\n"
|
||||
|
@ -247,7 +249,6 @@ int ztest_file( const int infd, int format_index,
|
|||
|
||||
int main( const int argc, const char * const argv[] )
|
||||
{
|
||||
enum { bz2_opt = 256, gz_opt, lz_opt, xz_opt, zst_opt };
|
||||
int format_index = -1; // undefined
|
||||
int recursive = 0; // 1 = '-r', 2 = '-R'
|
||||
std::list< std::string > filenames;
|
||||
|
@ -255,6 +256,7 @@ int main( const int argc, const char * const argv[] )
|
|||
program_name = "ztest";
|
||||
invocation_name = ( argc > 0 ) ? argv[0] : program_name;
|
||||
|
||||
enum { opt_bz2 = 256, opt_gz, opt_lz, opt_xz, opt_zst };
|
||||
const Arg_parser::Option options[] =
|
||||
{
|
||||
{ 'h', "help", Arg_parser::no },
|
||||
|
@ -266,11 +268,12 @@ int main( const int argc, const char * const argv[] )
|
|||
{ 'R', "dereference-recursive", Arg_parser::no },
|
||||
{ 'v', "verbose", Arg_parser::no },
|
||||
{ 'V', "version", Arg_parser::no },
|
||||
{ bz2_opt, "bz2", Arg_parser::yes },
|
||||
{ gz_opt, "gz", Arg_parser::yes },
|
||||
{ lz_opt, "lz", Arg_parser::yes },
|
||||
{ xz_opt, "xz", Arg_parser::yes },
|
||||
{ zst_opt, "zst", Arg_parser::yes },
|
||||
{ 'x', "exclude", Arg_parser::yes },
|
||||
{ opt_bz2, "bz2", Arg_parser::yes },
|
||||
{ opt_gz, "gz", Arg_parser::yes },
|
||||
{ opt_lz, "lz", Arg_parser::yes },
|
||||
{ opt_xz, "xz", Arg_parser::yes },
|
||||
{ opt_zst, "zst", Arg_parser::yes },
|
||||
{ 0, 0, Arg_parser::no } };
|
||||
|
||||
const Arg_parser parser( argc, argv, options );
|
||||
|
@ -298,11 +301,12 @@ int main( const int argc, const char * const argv[] )
|
|||
case 'v': if( verbosity < 4 ) ++verbosity;
|
||||
ztest_args.push_back( "-v" ); break;
|
||||
case 'V': show_version(); return 0;
|
||||
case bz2_opt: parse_compressor( arg, pn, fmt_bz2, 1 ); break;
|
||||
case gz_opt: parse_compressor( arg, pn, fmt_gz, 1 ); break;
|
||||
case lz_opt: parse_compressor( arg, pn, fmt_lz, 1 ); break;
|
||||
case xz_opt: parse_compressor( arg, pn, fmt_xz, 1 ); break;
|
||||
case zst_opt: parse_compressor( arg, pn, fmt_zst, 1 ); break;
|
||||
case 'x': Exclude::add_pattern( arg ); break;
|
||||
case opt_bz2: parse_compressor( arg, pn, fmt_bz2, 1 ); break;
|
||||
case opt_gz: parse_compressor( arg, pn, fmt_gz, 1 ); break;
|
||||
case opt_lz: parse_compressor( arg, pn, fmt_lz, 1 ); break;
|
||||
case opt_xz: parse_compressor( arg, pn, fmt_xz, 1 ); break;
|
||||
case opt_zst: parse_compressor( arg, pn, fmt_zst, 1 ); break;
|
||||
default: internal_error( "uncaught option." );
|
||||
}
|
||||
} // end process options
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue