projects
/
finddup.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
87d05f1
)
Bug fixed in the progress bar display.
author
Francois Fleuret
<francois@fleuret.org>
Mon, 29 Mar 2010 15:50:28 +0000
(17:50 +0200)
committer
Francois Fleuret
<francois@fleuret.org>
Mon, 29 Mar 2010 15:50:28 +0000
(17:50 +0200)
finddup.c
patch
|
blob
|
history
diff --git
a/finddup.c
b/finddup.c
index
6b14142
..
acbbddc
100644
(file)
--- a/
finddup.c
+++ b/
finddup.c
@@
-403,8
+403,8
@@
void print_progress(struct progress_state *state) {
if(state->bar_width <= 0 || position != state->last_position) {
if(!ioctl (STDERR_FILENO, TIOCGWINSZ, (char *) &win)) {
/* Something weird is going on if the previous test is wrong */
if(state->bar_width <= 0 || position != state->last_position) {
if(!ioctl (STDERR_FILENO, TIOCGWINSZ, (char *) &win)) {
/* Something weird is going on if the previous test is wrong */
- if(win.ws_col >= PROGRESS_BUFFER_SIZE) {
- state->bar_width = PROGRESS_BUFFER_SIZE -
8
;
+ if(win.ws_col >= PROGRESS_BUFFER_SIZE
- 3
) {
+ state->bar_width = PROGRESS_BUFFER_SIZE -
10
;
} else {
state->bar_width = win.ws_col - 7;
}
} else {
state->bar_width = win.ws_col - 7;
}
@@
-417,7
+417,9
@@
void print_progress(struct progress_state *state) {
for(; k < state->bar_width; k++) {
*(s++) = '-';
}
for(; k < state->bar_width; k++) {
*(s++) = '-';
}
- sprintf(s, " [%3d%%]\r",
+
+ /* We need four % because of the fprintf that follows */
+ sprintf(s, " [%3d%%%%]\r",
(100 * state->value) / (state->nb_values - 1));
fprintf(stderr, buffer);
(100 * state->value) / (state->nb_values - 1));
fprintf(stderr, buffer);