diff options
author | Daniel Baumann <mail@daniel-baumann.ch> | 2015-11-07 05:06:05 +0000 |
---|---|---|
committer | Daniel Baumann <mail@daniel-baumann.ch> | 2015-11-07 05:06:05 +0000 |
commit | a3c37bf807e8bcf3682987c2ab984053e7940a5c (patch) | |
tree | e739a4f5a6645fa64c4e66954a485bdf98d3bb61 /main.c | |
parent | Adding upstream version 1.5~rc2. (diff) | |
download | lunzip-a3c37bf807e8bcf3682987c2ab984053e7940a5c.tar.xz lunzip-a3c37bf807e8bcf3682987c2ab984053e7940a5c.zip |
Adding upstream version 1.5.upstream/1.5
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 40 |
1 files changed, 20 insertions, 20 deletions
@@ -88,14 +88,14 @@ static void show_help( void ) "small size makes it well suited for embedded devices or software\n" "installers that need to decompress files but do not need compression\n" "capabilities. Lunzip is fully compatible with lzip-1.4 or newer.\n" - "\nIf the size of the output buffer is specified with the '--buffer-size'\n" - "option, lunzip uses the decompressed file as dictionary for distances\n" - "beyond the buffer size and is able to decompress any file using as\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. Of course, the smaller the output buffer size used in\n" - "relation to the dictionary size, the more accesses to disk are needed\n" - "and the slower the decompression is. This 'low memory' mode only works\n" - "when decompressing to a regular file.\n" ); + "compress the file. To activate it, specify the size of the output buffer\n" + "with the '--buffer-size' option and lunzip will use the decompressed\n" + "file as dictionary for distances beyond the buffer size. Of course, the\n" + "smaller the output buffer size used in relation to the dictionary size,\n" + "the more accesses to disk are needed and the slower the decompression is.\n" + "This 'low memory' mode only works when decompressing to a regular file.\n" ); printf( "\nUsage: %s [options] [files]\n", invocation_name ); printf( "\nOptions:\n" " -h, --help display this help and exit\n" @@ -111,6 +111,8 @@ 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" + "Numbers may be followed by a multiplier: k = kB = 10^3 = 1000,\n" + "Ki = KiB = 2^10 = 1024, M = 10^6, Mi = 2^20, G = 10^9, Gi = 2^30, etc...\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" @@ -122,7 +124,7 @@ static void show_help( void ) static void show_version( void ) { - printf( "%s %s\n", Program_name, PROGVERSION ); + printf( "%s %s\n", program_name, PROGVERSION ); printf( "Copyright (C) %s Antonio Diaz Diaz.\n", program_year ); printf( "License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n" "This is free software: you are free to change and redistribute it.\n" @@ -232,8 +234,7 @@ static int open_instream( const char * const name, struct stat * const in_statsp const bool no_ofile ) { int infd; - do infd = open( name, O_RDONLY | O_BINARY ); - while( infd < 0 && errno == EINTR ); + infd = open( name, O_RDONLY | O_BINARY ); if( infd < 0 ) { if( verbosity >= 0 ) @@ -305,8 +306,7 @@ static bool open_outstream( const bool force ) int flags = O_APPEND | O_CREAT | O_RDWR | O_BINARY; if( force ) flags |= O_TRUNC; else flags |= O_EXCL; - do outfd = open( output_filename, flags, outfd_mode ); - while( outfd < 0 && errno == EINTR ); + outfd = open( output_filename, flags, outfd_mode ); if( outfd < 0 && verbosity >= 0 ) { if( errno == EEXIST ) @@ -390,14 +390,14 @@ static int decompress( const int buffer_size, const int infd, if( Rd_finished( &rdec ) ) /* End Of File */ { if( first_member ) - { Pp_show_msg( pp, "File ends unexpectedly at member header" ); + { Pp_show_msg( pp, "File ends unexpectedly at member header." ); retval = 2; } break; } if( !Fh_verify_magic( header ) ) { if( !first_member ) break; /* trailing garbage */ - Pp_show_msg( pp, "Bad magic number (file not in lzip format)" ); + Pp_show_msg( pp, "Bad magic number (file not in lzip format)." ); retval = 2; break; } if( !Fh_verify_version( header ) ) @@ -411,7 +411,7 @@ static int decompress( const int buffer_size, const int infd, dictionary_size = Fh_get_dictionary_size( header ); if( dictionary_size < min_dictionary_size || dictionary_size > max_dictionary_size ) - { Pp_show_msg( pp, "Invalid dictionary size in member header" ); + { Pp_show_msg( pp, "Invalid dictionary size in member header." ); retval = 2; break; } if( verbosity >= 2 || ( verbosity == 1 && first_member ) ) @@ -432,10 +432,10 @@ static int decompress( const int buffer_size, const int infd, { Pp_show_msg( pp, 0 ); if( result == 2 ) - fprintf( stderr, "File ends unexpectedly at pos %llu\n", + fprintf( stderr, "File ends unexpectedly at pos %llu.\n", partial_file_pos ); else - fprintf( stderr, "Decoder error at pos %llu\n", partial_file_pos ); + fprintf( stderr, "Decoder error at pos %llu.\n", partial_file_pos ); } retval = 2; break; } @@ -472,7 +472,7 @@ void show_error( const char * const msg, const int errcode, const bool help ) if( msg && msg[0] ) { fprintf( stderr, "%s: %s", program_name, msg ); - if( errcode > 0 ) fprintf( stderr, ": %s", strerror( errcode ) ); + if( errcode > 0 ) fprintf( stderr, ": %s.", strerror( errcode ) ); fprintf( stderr, "\n" ); } if( help ) @@ -485,7 +485,7 @@ void show_error( const char * const msg, const int errcode, const bool help ) void internal_error( const char * const msg ) { if( verbosity >= 0 ) - fprintf( stderr, "%s: internal error: %s.\n", program_name, msg ); + fprintf( stderr, "%s: internal error: %s\n", program_name, msg ); exit( 3 ); } @@ -553,7 +553,7 @@ int main( const int argc, const char * const argv[] ) case 'u': buffer_size = get_dict_size( arg ); break; case 'v': if( verbosity < 4 ) ++verbosity; break; case 'V': show_version(); return 0; - default : internal_error( "uncaught option" ); + default : internal_error( "uncaught option." ); } } /* end process options */ |