-
Committer:
agc
-
Date:
2012-05-07 03:36:59 UTC
-
Revision ID:
svn-v4:288d5a72-fed7-e111-8680-000c29dcf8fe:trunk:2299
Break out the routines (from tnftp) to calculate and draw a progress bar.
The code was originally written by Luke Mewburn - all mangling and bugs
courtesy of agc.
A quick (hypothetical) example of how to use this progress bar:
progress_t prog;
uint64_t total;
uint64_t done;
total = 15768554;
progress_init(&prog, "test update bar", total);
for (done = 0 ; done < total ; done += (total / 20) + ((random() % 20) * 1024)) {
progress_draw(&prog, done);
sleep(1);
}
progress_complete(&prog, done);