summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-01-31 05:29:15 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-01-31 05:29:15 +0000
commit85374db944e19e1a6ad13d1696d357b7022d8d87 (patch)
treef909edd49006917e1d3cdae838ca56f5fa7fc9ff /main.c
parentAdding upstream version 1.14~rc1. (diff)
downloadlunzip-85374db944e19e1a6ad13d1696d357b7022d8d87.tar.xz
lunzip-85374db944e19e1a6ad13d1696d357b7022d8d87.zip
Adding upstream version 1.14.upstream/1.14upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--main.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/main.c b/main.c
index 6949e1d..059d716 100644
--- a/main.c
+++ b/main.c
@@ -1,5 +1,5 @@
/* Lunzip - Decompressor for the lzip format
- Copyright (C) 2010-2023 Antonio Diaz Diaz.
+ Copyright (C) 2010-2024 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
@@ -76,7 +76,7 @@
int verbosity = 0;
static const char * const program_name = "lunzip";
-static const char * const program_year = "2023";
+static const char * const program_year = "2024";
static const char * invocation_name = "lunzip"; /* default value */
static const struct { const char * from; const char * to; } known_extensions[] = {
@@ -97,8 +97,19 @@ static void show_help( void )
{
printf( "Lunzip is a decompressor for the lzip format written in C. Its small size\n"
"makes it well suited for embedded devices or software installers that need\n"
- "to decompress files but don't need compression capabilities. Lunzip is fully\n"
+ "to decompress files but don't need compression capabilities. Lunzip is\n"
"compatible with lzip 1.4 or newer.\n"
+ "\nLzip is a lossless data compressor with a user interface similar to the one\n"
+ "of gzip or bzip2. Lzip uses a simplified form of the 'Lempel-Ziv-Markov\n"
+ "chain-Algorithm' (LZMA) stream format to maximize interoperability. The\n"
+ "maximum dictionary size is 512 MiB so that any lzip file can be decompressed\n"
+ "on 32-bit machines. Lzip provides accurate and robust 3-factor integrity\n"
+ "checking. Lzip can compress about as fast as gzip (lzip -0) or compress most\n"
+ "files more than bzip2 (lzip -9). Decompression speed is intermediate between\n"
+ "gzip and bzip2. Lzip is better than gzip and bzip2 from a data recovery\n"
+ "perspective. Lzip has been designed, written, and tested with great care to\n"
+ "replace gzip and bzip2 as the standard general-purpose compressed format for\n"
+ "Unix-like systems.\n"
"\nLunzip provides a 'low memory' mode able to decompress any file using as\n"
"little memory as 50 kB, irrespective of the dictionary size used to\n"
"compress the file. To activate it, specify the size of the output buffer\n"
@@ -558,7 +569,7 @@ static void close_and_set_permissions( const struct stat * const in_statsp )
if( in_statsp )
{
const mode_t mode = in_statsp->st_mode;
- /* fchown will in many cases return with EPERM, which can be safely ignored. */
+ /* fchown in many cases returns with EPERM, which can be safely ignored. */
if( fchown( outfd, in_statsp->st_uid, in_statsp->st_gid ) == 0 )
{ if( fchmod( outfd, mode ) != 0 ) warning = true; }
else
@@ -896,11 +907,11 @@ int main( const int argc, const char * const argv[] )
int retval = 0;
const bool one_to_one = !to_stdout && program_mode != m_test && !to_file;
bool stdin_used = false;
+ struct stat in_stats;
for( i = 0; i < num_filenames; ++i )
{
const char * input_filename = "";
int infd;
- struct stat in_stats;
Pp_set_name( &pp, filenames[i] );
if( strcmp( filenames[i], "-" ) == 0 )
@@ -966,7 +977,9 @@ int main( const int argc, const char * const argv[] )
if( input_filename[0] && !keep_input_files && one_to_one )
remove( input_filename );
}
- if( delete_output_on_interrupt ) close_and_set_permissions( 0 ); /* -o */
+ if( delete_output_on_interrupt ) /* -o */
+ close_and_set_permissions( ( retval == 0 && !stdin_used &&
+ filenames_given && num_filenames == 1 ) ? &in_stats : 0 );
else if( outfd >= 0 && close( outfd ) != 0 ) /* -c */
{
show_error( "Error closing stdout", errno, false );