summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7ca055f)
raw | patch | inline | side by side (parent: 7ca055f)
author | Alex Riesen <raa.lkml@gmail.com> | |
Wed, 23 May 2007 16:07:25 +0000 (18:07 +0200) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Wed, 23 May 2007 18:30:49 +0000 (11:30 -0700) |
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
progress.c | patch | blob | history | |
progress.h | patch | blob | history |
diff --git a/progress.c b/progress.c
index 05f7890314e0bd596eb2e4110cdb98eeea61c9da..4344f4eed5e46c4e013018af8ef9ab062f740d8f 100644 (file)
--- a/progress.c
+++ b/progress.c
fprintf(stderr, "%s%4u%% (%u/%u) done\r",
progress->prefix, percent, n, progress->total);
progress_update = 0;
+ progress->need_lf = 1;
return 1;
}
} else if (progress_update) {
fprintf(stderr, "%s%u\r", progress->prefix, n);
progress_update = 0;
+ progress->need_lf = 1;
return 1;
}
return 0;
progress->total = total;
progress->last_percent = -1;
progress->delay = 0;
+ progress->need_lf = 0;
if (snprintf(buf, sizeof(buf), title, total))
fprintf(stderr, "%s\n", buf);
set_progress_signal();
progress->delayed_percent_treshold = percent_treshold;
progress->delayed_title = title;
progress->delay = delay;
+ progress->need_lf = 0;
set_progress_signal();
}
void stop_progress(struct progress *progress)
{
clear_progress_signal();
- if (progress->total)
+ if (progress->need_lf)
fputc('\n', stderr);
}
diff --git a/progress.h b/progress.h
index 5ae1a89e5a4669553e44d5bd0cc339c308c60c0f..a7c17ca7c4bdad953508d03c20e73022b03bd25a 100644 (file)
--- a/progress.h
+++ b/progress.h
unsigned delay;
unsigned delayed_percent_treshold;
const char *delayed_title;
+ int need_lf;
};
int display_progress(struct progress *progress, unsigned n);