shell: fix off by one in draw_progress()

tags/0.1.0
S.J.R. van Schaik 7 years ago
parent 635df8e06f
commit 23b478e582
  1. 10
      source/shell/progress.c

@ -4,12 +4,16 @@
void draw_progress(FILE *fp, unsigned long pos, unsigned long max)
{
unsigned long head = (TERM_WIDTH - 2) * pos / max;
unsigned long i;
unsigned long head, i;
if (pos > max)
pos = max;
head = (TERM_WIDTH - 2) * pos / max;
fputc('[', fp);
for (i = 0; i <= head; ++i)
for (i = 0; i < head; ++i)
fputc('#', fp);
for (; i < (TERM_WIDTH - 2); ++i)

Loading…
Cancel
Save