ChangeLog, Makefile.in:
Makefile.in (install): Install resize2fs in /sbin, not /usr/sbin.
ChangeLog, unix.c:
unix.c: Also, re-arrange the logic so that we do the time check only
after doing the percentage check, and we only advance the spinner if
we're about to display it.
ChangeLog:
Fix minor wording error in Chagelog.
diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog
index 3aa67c2..abaa9bc 100644
--- a/e2fsck/ChangeLog
+++ b/e2fsck/ChangeLog
@@ -4,6 +4,9 @@
percentage after multiplying it by 10, nor 1000, since we
only need to save values to a tenth of a percent (and the
percentage is already from 0 .. 100%, not 0 .. 1).
+ Also, re-arrange the logic so that we do the time
+ check only after doing the percentage check, and we
+ only advance the spinner if we're about to display it.
2000-07-04 Theodore Ts'o <tytso@valinux.com>
diff --git a/e2fsck/unix.c b/e2fsck/unix.c
index 3b43f7d..1675817 100644
--- a/e2fsck/unix.c
+++ b/e2fsck/unix.c
@@ -340,18 +340,35 @@
} else {
if (ctx->flags & E2F_FLAG_PROG_SUPPRESS)
return 0;
+ /*
+ * Calculate the new progress position. If the
+ * percentage hasn't changed, then we skip out right
+ * away.
+ */
+ percent = calc_percent(&e2fsck_tbl, pass, cur, max);
+ if (ctx->progress_last_percent == (int) 10 * percent)
+ return 0;
+ ctx->progress_last_percent = (int) 10 * percent;
+
+ /*
+ * If we've already updated the spinner once within
+ * the last 1/8th of a second, no point doing it
+ * again.
+ */
gettimeofday(&tv, NULL);
tick = (tv.tv_sec << 3) + (tv.tv_usec / (1000000 / 8));
if ((tick == ctx->progress_last_time) &&
(cur != max) && (cur != 0))
return 0;
ctx->progress_last_time = tick;
+
+ /*
+ * Advance the spinner, and note that the progress bar
+ * will be on the screen
+ */
ctx->progress_pos = (ctx->progress_pos+1) & 3;
ctx->flags |= E2F_FLAG_PROG_BAR;
- percent = calc_percent(&e2fsck_tbl, pass, cur, max);
- if (ctx->progress_last_percent == (int) 10 * percent)
- return 0;
- ctx->progress_last_percent = (int) 10 * percent;
+
i = ((percent * dpywidth) + 50) / 100;
printf("%s: |%s%s", ctx->device_name,
bar + (sizeof(bar) - (i+1)),