* main.c (update_progress_no_tty): Properly terminate progress. Also

fixes stk500 problem where number of bytes written is less than a page.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@348 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
troth 2003-08-28 05:37:57 +00:00
parent 076d753607
commit 1abe56733f
2 changed files with 10 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2003-08-27 Theodore A. Roth <troth@openavr.org>
* main.c (update_progress_no_tty): Properly terminate progress. Also
fixes stk500 problem where number of bytes written is less than a page.
2003-08-27 Theodore A. Roth <troth@openavr.org> 2003-08-27 Theodore A. Roth <troth@openavr.org>
* avrdude.spec.in: Fix broken rpmbuild on RedHat-9. * avrdude.spec.in: Fix broken rpmbuild on RedHat-9.

7
main.c
View File

@ -363,23 +363,26 @@ static void update_progress_tty (int percent, double etime, char *hdr)
static void update_progress_no_tty (int percent, double etime, char *hdr) static void update_progress_no_tty (int percent, double etime, char *hdr)
{ {
static int done = 0;
static int last = 0; static int last = 0;
int cnt = (percent>>1)*2; int cnt = (percent>>1)*2;
if (hdr) { if (hdr) {
fprintf (stderr, "\n%s | ", hdr); fprintf (stderr, "\n%s | ", hdr);
last = 0; last = 0;
done = 0;
} }
else { else {
while (cnt > last) { while ((cnt > last) && (done == 0)) {
fprintf (stderr, "#"); fprintf (stderr, "#");
cnt -= 2; cnt -= 2;
} }
} }
if ((percent == 100) && (last != 0)) { if ((percent == 100) && (done == 0)) {
fprintf (stderr, " | 100%% %0.2fs\n\n", etime); fprintf (stderr, " | 100%% %0.2fs\n\n", etime);
last = 0; last = 0;
done = 1;
} }
else else
last = (percent>>1)*2; /* Make last a multiple of 2. */ last = (percent>>1)*2; /* Make last a multiple of 2. */