summaryrefslogtreecommitdiffstats
path: root/decompress.cc
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--decompress.cc23
1 files changed, 20 insertions, 3 deletions
diff --git a/decompress.cc b/decompress.cc
index 0cc99f8..4c6b946 100644
--- a/decompress.cc
+++ b/decompress.cc
@@ -37,6 +37,23 @@
#include "file_index.h"
+void Pretty_print::operator()( const char * const msg ) const
+ {
+ if( verbosity >= 0 )
+ {
+ if( first_post )
+ {
+ first_post = false;
+ std::fprintf( stderr, " %s: ", name_.c_str() );
+ for( unsigned i = 0; i < longest_name - name_.size(); ++i )
+ std::fputc( ' ', stderr );
+ if( !msg ) std::fflush( stderr );
+ }
+ if( msg ) std::fprintf( stderr, "%s\n", msg );
+ }
+ }
+
+
// Returns the number of bytes really read.
// If (returned value < size) and (errno == 0), means EOF was reached.
//
@@ -82,7 +99,7 @@ int decompress_read_error( struct LZ_Decoder * const decoder,
const LZ_Errno errcode = LZ_decompress_errno( decoder );
pp();
if( verbosity >= 0 )
- std::fprintf( stderr, "LZ_decompress_read error in worker %d: %s.\n",
+ std::fprintf( stderr, "LZ_decompress_read error in worker %d: %s\n",
worker_id, LZ_strerror( errcode ) );
if( errcode == LZ_header_error || errcode == LZ_unexpected_eof ||
errcode == LZ_data_error )
@@ -160,7 +177,7 @@ extern "C" void * dworker( void * arg )
{
pp();
if( verbosity >= 0 )
- std::fprintf( stderr, "Write error in worker %d: %s.\n",
+ std::fprintf( stderr, "Write error in worker %d: %s\n",
worker_id, std::strerror( errno ) );
cleanup_and_fail();
}
@@ -260,7 +277,7 @@ int decompress( int num_workers, const int infd, const int outfd,
std::fprintf( stderr, "decompressed size %9llu, size %9llu. ",
out_size, in_size );
- if( verbosity >= 1 ) std::fprintf( stderr, (outfd < 0) ? "ok\n" : "done\n" );
+ if( verbosity >= 1 ) std::fputs( (outfd < 0) ? "ok\n" : "done\n", stderr );
return 0;
}