summaryrefslogtreecommitdiffstats
path: root/ztest.cc
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ztest.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/ztest.cc b/ztest.cc
index a4ee1aa..600d32e 100644
--- a/ztest.cc
+++ b/ztest.cc
@@ -1,5 +1,5 @@
/* Ztest - verify integrity of compressed files
- Copyright (C) 2010-2014 Antonio Diaz Diaz.
+ Copyright (C) 2010-2015 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
@@ -64,8 +64,9 @@ void show_help()
"\nOptions:\n"
" -h, --help display this help and exit\n"
" -V, --version output version information and exit\n"
- " --format=<fmt> force given format (bz2, gz, lz, xz)\n"
+ " -M, --format=<list> exclude formats not in <list>\n"
" -N, --no-rcfile don't read runtime configuration file\n"
+ " -O, --force-format=<fmt> force given format (bz2, gz, lz, xz)\n"
" -q, --quiet suppress all messages\n"
" -r, --recursive operate recursively on directories\n"
" -v, --verbose be verbose (a 2nd -v gives more)\n"
@@ -77,7 +78,7 @@ void show_help()
}
-int open_instream( std::string & input_filename )
+int open_instream( const std::string & input_filename )
{
const int infd = open( input_filename.c_str(), O_RDONLY | O_BINARY );
if( infd < 0 )
@@ -204,7 +205,7 @@ int ztest_file( const int infd, int format_index,
int main( const int argc, const char * const argv[] )
{
- enum { format_opt = 256, bz2_opt, gz_opt, lz_opt, xz_opt };
+ enum { bz2_opt = 256, gz_opt, lz_opt, xz_opt };
int infd = -1;
int format_index = -1;
bool recursive = false;
@@ -217,12 +218,13 @@ int main( const int argc, const char * const argv[] )
const Arg_parser::Option options[] =
{
{ 'h', "help", Arg_parser::no },
+ { 'M', "format", Arg_parser::yes },
{ 'N', "no-rcfile", Arg_parser::no },
+ { 'O', "force-format", Arg_parser::yes },
{ 'q', "quiet", Arg_parser::no },
{ 'r', "recursive", Arg_parser::no },
{ 'v', "verbose", Arg_parser::no },
{ 'V', "version", Arg_parser::no },
- { format_opt, "format", Arg_parser::yes },
{ bz2_opt, "bz2", Arg_parser::yes },
{ gz_opt, "gz", Arg_parser::yes },
{ lz_opt, "lz", Arg_parser::yes },
@@ -240,17 +242,18 @@ int main( const int argc, const char * const argv[] )
{
const int code = parser.code( argind );
if( !code ) break; // no more options
- const char * const arg = parser.argument( argind ).c_str();
+ const std::string & arg = parser.argument( argind );
switch( code )
{
case 'h': show_help(); return 0;
+ case 'M': parse_format_list( arg ); break;
case 'N': break;
+ case 'O': format_index = parse_format_type( arg ); break;
case 'q': verbosity = -1; ztest_args.push_back( "-q" ); break;
case 'r': recursive = true; break;
case 'v': if( verbosity < 4 ) ++verbosity;
ztest_args.push_back( "-v" ); break;
case 'V': show_version(); return 0;
- case format_opt: format_index = parse_format_type( arg ); break;
case bz2_opt: parse_compressor( arg, fmt_bz2, 1 ); break;
case gz_opt: parse_compressor( arg, fmt_gz, 1 ); break;
case lz_opt: parse_compressor( arg, fmt_lz, 1 ); break;