diff options
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 29 |
1 files changed, 13 insertions, 16 deletions
@@ -105,7 +105,7 @@ static void show_help( void ) " -c, --stdout send output to standard output\n" " -d, --decompress decompress\n" " -f, --force overwrite existing output files\n" - " -F, --recompress force recompression of compressed files\n" + " -F, --recompress force re-compression of compressed files\n" " -k, --keep keep (don't delete) input files\n" " -m, --match-length=<bytes> set match length limit in bytes [36]\n" " -o, --output=<file> if reading stdin, place the output into <file>\n" @@ -180,7 +180,7 @@ static unsigned long long getnum( const char * const ptr, if( !errno && tail[0] ) { - int factor = ( tail[1] == 'i' ) ? 1024 : 1000; + const int factor = ( tail[1] == 'i' ) ? 1024 : 1000; int exponent = 0, i; bool bad_multiplier = false; switch( tail[0] ) @@ -264,7 +264,7 @@ static int open_instream( const char * const name, struct stat * const in_statsp if( infd < 0 ) { if( verbosity >= 0 ) - fprintf( stderr, "%s: Can't open input file '%s': %s.\n", + fprintf( stderr, "%s: Can't open input file '%s': %s\n", program_name, name, strerror( errno ) ); } else @@ -281,7 +281,7 @@ static int open_instream( const char * const name, struct stat * const in_statsp fprintf( stderr, "%s: Input file '%s' is not a regular file%s.\n", program_name, name, ( can_read && !no_ofile ) ? - " and '--stdout' was not specified" : "" ); + ",\n and '--stdout' was not specified" : "" ); close( infd ); infd = -1; } @@ -335,7 +335,7 @@ static void set_d_outname( const char * const name, const int i ) strcpy( output_filename, name ); strcat( output_filename, ".out" ); if( verbosity >= 1 ) - fprintf( stderr, "%s: Can't guess original name for '%s' -- using '%s'.\n", + fprintf( stderr, "%s: Can't guess original name for '%s' -- using '%s'\n", program_name, name, output_filename ); } @@ -352,7 +352,7 @@ static bool open_outstream( const bool force ) fprintf( stderr, "%s: Output file '%s' already exists, skipping.\n", program_name, output_filename ); else - fprintf( stderr, "%s: Can't create output file '%s': %s.\n", + fprintf( stderr, "%s: Can't create output file '%s': %s\n", program_name, output_filename, strerror( errno ) ); } return ( outfd >= 0 ); @@ -519,7 +519,7 @@ static int compress( const unsigned long long member_size, if( retval == 0 && verbosity >= 1 ) { if( in_size == 0 || out_size == 0 ) - fprintf( stderr, " no data compressed.\n" ); + fputs( " no data compressed.\n", stderr ); else fprintf( stderr, "%6.3f:1, %6.3f bits/byte, " "%5.2f%% saved, %llu in, %llu out.\n", @@ -598,20 +598,17 @@ static int decompress( const int infd, struct Pretty_print * const pp, if( verbosity >= 0 && result <= 2 ) { Pp_show_msg( pp, 0 ); - if( result == 2 ) - 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, "%s at pos %llu\n", ( result == 2 ) ? + "File ends unexpectedly" : "Decoder error", partial_file_pos ); } retval = 2; break; } if( verbosity >= 2 ) - { fprintf( stderr, testing ? "ok\n" : "done\n" ); Pp_reset( pp ); } + { fputs( testing ? "ok\n" : "done\n", stderr ); Pp_reset( pp ); } } Rd_free( &rdec ); if( verbosity == 1 && retval == 0 ) - fprintf( stderr, testing ? "ok\n" : "done\n" ); + fputs( testing ? "ok\n" : "done\n", stderr ); return retval; } @@ -639,8 +636,8 @@ 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 ) ); - fprintf( stderr, "\n" ); + if( errcode > 0 ) fprintf( stderr, ": %s", strerror( errcode ) ); + fputc( '\n', stderr ); } if( help ) fprintf( stderr, "Try '%s --help' for more information.\n", |