summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2014-02-08 23:56:56 +0100
committerDirk Engling <erdgeist@erdgeist.org>2014-02-08 23:56:56 +0100
commitf6ef4b51dd20aa5d595042419ac650f0a0a29320 (patch)
tree5e0394899a4f8968c5db4f46250e8ca0c5a7b850
parent4affb3811c4a57cb4e033ddd40f5e99236b59250 (diff)
Report progress
-rw-r--r--src/decompress.c8
1 files changed, 7 insertions, 1 deletions
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) {
17 unsigned char output [HUGEBLOCK]; 17 unsigned char output [HUGEBLOCK];
18 char respath[32]; /* file_XXXXX\0 */ 18 char respath[32]; /* file_XXXXX\0 */
19 int i, zres = 0, filenum = 0, resfile; 19 int i, zres = 0, filenum = 0, resfile;
20 size_t offs = 0; 20 size_t offs = 0, reported = 0;
21 21
22 z_stream z; memset( &z, 0, sizeof(z)); 22 z_stream z; memset( &z, 0, sizeof(z));
23 23
@@ -49,6 +49,12 @@ error_continue:
49 close( resfile ); 49 close( resfile );
50 offs += z.total_in; 50 offs += z.total_in;
51 51
52 if( reported < ( offs * 10 ) / in->size ) {
53 reported++;
54 printf( "%zd%% ", 10 * reported );
55 fflush( stdout );
56 }
57
52 inflateEnd(&z); memset( &z, 0, sizeof(z)); 58 inflateEnd(&z); memset( &z, 0, sizeof(z));
53 } 59 }
54 unmap_file(&in); 60 unmap_file(&in);