summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 05:00:36 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 05:00:36 +0000
commite83684e70d693debd8ec1beee56507507ccd1ec9 (patch)
tree48dc884a806159505f99cf332f0476477f350db7 /main.c
parentAdding upstream version 1.2. (diff)
downloadlunzip-e83684e70d693debd8ec1beee56507507ccd1ec9.tar.xz
lunzip-e83684e70d693debd8ec1beee56507507ccd1ec9.zip
Adding upstream version 1.3~rc1.upstream/1.3_rc1
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'main.c')
-rw-r--r--main.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/main.c b/main.c
index 9ba2280..75c4ea9 100644
--- a/main.c
+++ b/main.c
@@ -15,7 +15,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
- Return values: 0 for a normal exit, 1 for environmental problems
+ Exit status: 0 for a normal exit, 1 for environmental problems
(file not found, invalid flags, I/O errors, etc), 2 to indicate a
corrupt or invalid input file, 3 for an internal consistency error
(eg, bug) which caused lunzip to panic.
@@ -51,7 +51,7 @@
#endif
#include "carg_parser.h"
-#include "lunzip.h"
+#include "lzip.h"
#include "decoder.h"
#if CHAR_BIT != 8
@@ -101,6 +101,10 @@ static void show_help( void )
" -v, --verbose be verbose (a 2nd -v gives more)\n"
"If no file names are given, lunzip decompresses from standard input to\n"
"standard output.\n"
+ "\nExit status: 0 for a normal exit, 1 for environmental problems (file\n"
+ "not found, invalid flags, I/O errors, etc), 2 to indicate a corrupt or\n"
+ "invalid input file, 3 for an internal consistency error (eg, bug) which\n"
+ "caused lunzip to panic.\n"
"\nReport bugs to lzip-bug@nongnu.org\n"
"Lunzip home page: http://www.nongnu.org/lzip/lunzip.html\n" );
}
@@ -129,8 +133,9 @@ void show_header( const File_header header )
for( i = 0; i < 8 && ( num > 9999 || ( exact && num >= factor ) ); ++i )
{ num /= factor; if( num % factor != 0 ) exact = false;
p = prefix[i]; np = ""; }
- fprintf( stderr, "version %d, dictionary size %s%4u %sB. ",
- Fh_version( header ), np, num, p );
+ if( verbosity >= 4 )
+ fprintf( stderr, "version %d, ", Fh_version( header ) );
+ fprintf( stderr, "dictionary size %s%4u %sB. ", np, num, p );
}
@@ -326,7 +331,7 @@ static int decompress( const int infd, struct Pretty_print * const pp,
retval = 2; break; }
if( verbosity >= 2 || ( verbosity == 1 && first_member ) )
- { Pp_show_msg( pp, 0 ); if( verbosity >= 2 ) show_header( header ); }
+ { Pp_show_msg( pp, 0 ); if( verbosity >= 3 ) show_header( header ); }
if( !LZd_init( &decoder, header, &rdec, outfd ) )
{
@@ -350,13 +355,11 @@ static int decompress( const int infd, struct Pretty_print * const pp,
retval = 2; break;
}
if( verbosity >= 2 )
- { if( testing ) fprintf( stderr, "ok\n" );
- else fprintf( stderr, "done\n" ); Pp_reset( pp ); }
+ { fprintf( stderr, testing ? "ok\n" : "done\n" ); Pp_reset( pp ); }
}
Rd_free( &rdec );
if( verbosity == 1 && retval == 0 )
- { if( testing ) fprintf( stderr, "ok\n" );
- else fprintf( stderr, "done\n" ); }
+ fprintf( stderr, testing ? "ok\n" : "done\n" );
return retval;
}
@@ -448,6 +451,7 @@ int main( const int argc, const char * const argv[] )
{ 'f', "force", ap_no },
{ 'h', "help", ap_no },
{ 'k', "keep", ap_no },
+ { 'n', "threads", ap_yes },
{ 'o', "output", ap_yes },
{ 'q', "quiet", ap_no },
{ 't', "test", ap_no },
@@ -477,6 +481,7 @@ int main( const int argc, const char * const argv[] )
case 'f': force = true; break;
case 'h': show_help(); return 0;
case 'k': keep_input_files = true; break;
+ case 'n': break;
case 'o': default_output_filename = arg; break;
case 'q': verbosity = -1; break;
case 't': testing = true; break;