diff options
author | Daniel Baumann <mail@daniel-baumann.ch> | 2015-11-06 12:49:49 +0000 |
---|---|---|
committer | Daniel Baumann <mail@daniel-baumann.ch> | 2015-11-06 12:49:49 +0000 |
commit | 878fd2f4aebbd116062229b781c43e1549404d23 (patch) | |
tree | 8408091dff2e21db68947399488ad6f1fc5996d4 /main.c | |
parent | Adding upstream version 1.6~pre1. (diff) | |
download | clzip-878fd2f4aebbd116062229b781c43e1549404d23.tar.xz clzip-878fd2f4aebbd116062229b781c43e1549404d23.zip |
Adding upstream version 1.6~pre2.upstream/1.6_pre2
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 32 |
1 files changed, 15 insertions, 17 deletions
@@ -135,7 +135,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" @@ -254,8 +254,7 @@ static int open_instream( const char * const name, struct stat * const in_statsp } else { - 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 ) @@ -339,8 +338,7 @@ static bool open_outstream( const bool force ) int flags = O_CREAT | O_WRONLY | 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 ) @@ -450,12 +448,12 @@ static int compress( const unsigned long long member_size, if( !Fh_set_dictionary_size( header, encoder_options->dictionary_size ) || encoder_options->match_len_limit < min_match_len_limit || encoder_options->match_len_limit > max_match_len ) - internal_error( "invalid argument to encoder" ); + internal_error( "invalid argument to encoder." ); if( !Mf_init( &matchfinder, Fh_get_dictionary_size( header ), encoder_options->match_len_limit, infd ) ) { - Pp_show_msg( pp, "Not enough memory. Try a smaller dictionary size" ); + Pp_show_msg( pp, "Not enough memory. Try a smaller dictionary size." ); return 1; } Fh_set_dictionary_size( header, matchfinder.dictionary_size ); @@ -473,7 +471,7 @@ static int compress( const unsigned long long member_size, if( verbosity >= 2 ) show_progress( in_size, &matchfinder, pp, cfile_size ); /* init */ if( !LZe_encode_member( &encoder, size ) ) - { Pp_show_msg( pp, "Encoder error" ); retval = 1; break; } + { Pp_show_msg( pp, "Encoder error." ); retval = 1; break; } in_size += Mf_data_position( &matchfinder ); out_size += Re_member_position( &encoder.renc ); LZe_free( &encoder ); @@ -488,7 +486,7 @@ static int compress( const unsigned long long member_size, { close_and_set_permissions( in_statsp ); if( !next_filename() ) - { Pp_show_msg( pp, "Too many volume files" ); retval = 1; break; } + { Pp_show_msg( pp, "Too many volume files." ); retval = 1; break; } if( !open_outstream( true ) ) { retval = 1; break; } delete_output_on_interrupt = true; } @@ -538,14 +536,14 @@ static int decompress( const int infd, struct Pretty_print * const pp, 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 ) ) @@ -559,7 +557,7 @@ static int decompress( const int infd, struct Pretty_print * const pp, 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 ) ) @@ -580,10 +578,10 @@ static int decompress( const int infd, struct Pretty_print * const pp, { 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; } @@ -620,7 +618,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 ) @@ -633,7 +631,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 ); } @@ -766,7 +764,7 @@ int main( const int argc, const char * const argv[] ) case 't': program_mode = m_test; 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 */ |