From f6ef4b51dd20aa5d595042419ac650f0a0a29320 Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Sat, 8 Feb 2014 23:56:56 +0100 Subject: Report progress --- src/decompress.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/decompress.c b/src/decompress.c index fbf33ec..fef4241 100644 --- a/src/decompress.c +++ b/src/decompress.c @@ -17,7 +17,7 @@ int main(int argc, char **argv) { unsigned char output [HUGEBLOCK]; char respath[32]; /* file_XXXXX\0 */ int i, zres = 0, filenum = 0, resfile; - size_t offs = 0; + size_t offs = 0, reported = 0; z_stream z; memset( &z, 0, sizeof(z)); @@ -49,6 +49,12 @@ error_continue: close( resfile ); offs += z.total_in; + if( reported < ( offs * 10 ) / in->size ) { + reported++; + printf( "%zd%% ", 10 * reported ); + fflush( stdout ); + } + inflateEnd(&z); memset( &z, 0, sizeof(z)); } unmap_file(&in); -- cgit v1.2.3