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);
}