Source code for the Trusted Boot Module.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#define TERM_WIDTH 80
|
|
|
|
|
|
|
|
void draw_progress(FILE *fp, unsigned long pos, unsigned long max)
|
|
|
|
{
|
|
|
|
unsigned long head, i;
|
|
|
|
|
|
|
|
if (pos > max)
|
|
|
|
pos = max;
|
|
|
|
|
|
|
|
head = (TERM_WIDTH - 2) * pos / max;
|
|
|
|
|
|
|
|
fputc('[', fp);
|
|
|
|
|
|
|
|
for (i = 0; i < head; ++i)
|
|
|
|
fputc('#', fp);
|
|
|
|
|
|
|
|
for (; i < (TERM_WIDTH - 2); ++i)
|
|
|
|
fputc(' ', fp);
|
|
|
|
|
|
|
|
fputc(']', fp);
|
|
|
|
|
|
|
|
for (i = 0; i < TERM_WIDTH; ++i)
|
|
|
|
fputc('\b', fp);
|
|
|
|
}
|