From d83a3d72313a92fcbe4322587306c856bb847c1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20Israelson?= <57065102+israpps@users.noreply.github.com> Date: Thu, 23 May 2024 12:48:43 -0300 Subject: [PATCH 1/5] make progress display include a gauge --- hdl_dump.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/hdl_dump.c b/hdl_dump.c index de43b25..83cfb8c 100644 --- a/hdl_dump.c +++ b/hdl_dump.c @@ -1442,14 +1442,27 @@ handle_sigint(/*@unused@*/ int signo) static int progress_cb(progress_t *pgs, /*@unused@*/ void *data) { + int barWidth = 70; static time_t last_flush = 0; time_t now = time(NULL); - if (pgs->remaining != -1) + if (pgs->remaining != -1) { + fprintf(stdout, "["); + int pos = barWidth * (pgs->pc_completed); + for (int i = 0; i < barWidth; ++i) + { + if (i < pos) + fprintf(stdout, "="); + else if (i == pos) + fprintf(stdout, ">"); + else + fprintf(stdout, " "); + } fprintf(stdout, - "%3d%%, %s remaining, %.2f MB/sec \r", + "] %3d%%, %s remaining, %.2f MB/sec \r", pgs->pc_completed, pgs->remaining_text, (double)pgs->curr_bps / (1024.0 * 1024.0)); + } else fprintf(stdout, "%3d%%\r", pgs->pc_completed); From da7c6f9cfbc38cb5c992126dc25e287c7fad5f98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20Israelson?= <57065102+israpps@users.noreply.github.com> Date: Thu, 23 May 2024 12:51:34 -0300 Subject: [PATCH 2/5] Update hdl_dump.c --- hdl_dump.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hdl_dump.c b/hdl_dump.c index 83cfb8c..82729df 100644 --- a/hdl_dump.c +++ b/hdl_dump.c @@ -1449,7 +1449,8 @@ progress_cb(progress_t *pgs, /*@unused@*/ void *data) if (pgs->remaining != -1) { fprintf(stdout, "["); int pos = barWidth * (pgs->pc_completed); - for (int i = 0; i < barWidth; ++i) + int i = 0 + for (int i; i < barWidth; ++i) { if (i < pos) fprintf(stdout, "="); From f6c415f14d37c0f821213e4ae686f0e5c51b4f5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20Israelson?= <57065102+israpps@users.noreply.github.com> Date: Thu, 23 May 2024 12:55:59 -0300 Subject: [PATCH 3/5] Update hdl_dump.c --- hdl_dump.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hdl_dump.c b/hdl_dump.c index 82729df..2f8663a 100644 --- a/hdl_dump.c +++ b/hdl_dump.c @@ -1448,10 +1448,10 @@ progress_cb(progress_t *pgs, /*@unused@*/ void *data) if (pgs->remaining != -1) { fprintf(stdout, "["); - int pos = barWidth * (pgs->pc_completed); - int i = 0 - for (int i; i < barWidth; ++i) - { + int pos; + pos = barWidth * (pgs->pc_completed); + int i = 0; + for (int i; i < barWidth; ++i) { if (i < pos) fprintf(stdout, "="); else if (i == pos) From f8175f84d0455aed7f9a97fd7f44153bf62b510d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20Israelson?= <57065102+israpps@users.noreply.github.com> Date: Thu, 23 May 2024 12:58:18 -0300 Subject: [PATCH 4/5] Update hdl_dump.c --- hdl_dump.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hdl_dump.c b/hdl_dump.c index 2f8663a..8522169 100644 --- a/hdl_dump.c +++ b/hdl_dump.c @@ -1442,15 +1442,13 @@ handle_sigint(/*@unused@*/ int signo) static int progress_cb(progress_t *pgs, /*@unused@*/ void *data) { - int barWidth = 70; + int barWidth = 70, pos, i = 0; static time_t last_flush = 0; time_t now = time(NULL); if (pgs->remaining != -1) { fprintf(stdout, "["); - int pos; pos = barWidth * (pgs->pc_completed); - int i = 0; for (int i; i < barWidth; ++i) { if (i < pos) fprintf(stdout, "="); From 902ac0d3895f98ae3d92b751c3bdc4ceaf9d926f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20Israelson?= <57065102+israpps@users.noreply.github.com> Date: Thu, 23 May 2024 13:01:31 -0300 Subject: [PATCH 5/5] Update hdl_dump.c --- hdl_dump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hdl_dump.c b/hdl_dump.c index 8522169..060790b 100644 --- a/hdl_dump.c +++ b/hdl_dump.c @@ -1449,7 +1449,7 @@ progress_cb(progress_t *pgs, /*@unused@*/ void *data) if (pgs->remaining != -1) { fprintf(stdout, "["); pos = barWidth * (pgs->pc_completed); - for (int i; i < barWidth; ++i) { + for (i = 0; i < barWidth; ++i) { if (i < pos) fprintf(stdout, "="); else if (i == pos)