From dd808771fa882d70b21e72277989f7323b0b8182 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Tue, 30 Aug 2022 14:04:21 +0100 Subject: [PATCH] Fix progress show. --- main.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/main.c b/main.c index e37e5f7..05d208c 100644 --- a/main.c +++ b/main.c @@ -90,6 +90,11 @@ int main(int argc, char** argv) in_read = read(fd_in, in_buf, block_size); + printf("\rProcessing position %d of %ld (%f%%)", + 0, + last_pos, + 0.0); + while(in_read > 0) { current_pos = lseek(fd_in, 0, SEEK_CUR); @@ -123,6 +128,11 @@ int main(int argc, char** argv) in_read = read(fd_in, in_buf, block_size); } + printf("\rProcessing position %ld of %ld (%f%%)", + current_pos, + last_pos, + ((float)current_pos * 100.0) / (float)last_pos); + close(fd_in); close(fd_out); free(in_buf);