1
0
Fork 0

Merging upstream version 1.3~rc1.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-17 22:09:19 +01:00
parent 8fa7ed8e82
commit a37b755c15
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
13 changed files with 168 additions and 120 deletions

23
main.c
View file

@ -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;