diff options
author | jkh <jkh@FreeBSD.org> | 1995-05-29 14:38:31 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1995-05-29 14:38:31 +0000 |
commit | 19dcd1c0c98ec23509630b0a17eef3820be1428d (patch) | |
tree | 5156b4835a02978a12356a611076b2f7321b7660 | |
parent | e2a3ce09ed9b0d972c690feabca86e68309a36fc (diff) | |
download | FreeBSD-src-19dcd1c0c98ec23509630b0a17eef3820be1428d.zip FreeBSD-src-19dcd1c0c98ec23509630b0a17eef3820be1428d.tar.gz |
Some floating-point trickery to make the gauge come out right. Also
make it a little longer.
-rw-r--r-- | release/sysinstall/dist.c | 17 | ||||
-rw-r--r-- | usr.sbin/sysinstall/dist.c | 17 |
2 files changed, 26 insertions, 8 deletions
diff --git a/release/sysinstall/dist.c b/release/sysinstall/dist.c index 2e3e201..ad91eb8 100644 --- a/release/sysinstall/dist.c +++ b/release/sysinstall/dist.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: dist.c,v 1.32 1995/05/29 11:01:10 jkh Exp $ + * $Id: dist.c,v 1.33 1995/05/29 13:37:42 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -306,15 +306,19 @@ distExtract(char *parent, Distribution *me) for (chunk = 0; chunk < numchunks; chunk++) { int n, retval; char prompt[80]; + int retries = 0; snprintf(buf, 512, "%s/%s.%c%c", path, dist, (chunk / 26) + 'a', (chunk % 26) + 'a'); +retry: fd = (*mediaDevice->get)(buf); if (fd < 0) { - msgConfirm("failed to retreive piece file %s!\nAborting the transfer", buf); + if (++retries < 5) + goto retry; + msgConfirm("failed to retreive piece file %s after 5 retries!\nAborting the transfer", buf); goto punt; } snprintf(prompt, 80, "Extracting %s into %s directory...", me[i].my_name, me[i].my_dir); - dialog_gauge(" Progress ", prompt, 8, 15, 6, 40, (chunk + 1 ) / numchunks * 100); + dialog_gauge(" Progress ", prompt, 8, 15, 6, 50, (int) ((float) (chunk + 1) / numchunks * 100)); while ((n = read(fd, buf, sizeof buf)) > 0) { retval = write(fd2, buf, n); if (retval != n) @@ -363,6 +367,11 @@ distExtract(char *parent, Distribution *me) void distExtractAll(void) { - while (Dists) + int retries = 0; + + /* Try for 3 times around the loop, then give up. */ + while (Dists && ++retries < 3) distExtract(NULL, DistTable); + if (Dists) + msgConfirm("Couldn't extract all of the dists. Residue: %0x", Dists); } diff --git a/usr.sbin/sysinstall/dist.c b/usr.sbin/sysinstall/dist.c index 2e3e201..ad91eb8 100644 --- a/usr.sbin/sysinstall/dist.c +++ b/usr.sbin/sysinstall/dist.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: dist.c,v 1.32 1995/05/29 11:01:10 jkh Exp $ + * $Id: dist.c,v 1.33 1995/05/29 13:37:42 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -306,15 +306,19 @@ distExtract(char *parent, Distribution *me) for (chunk = 0; chunk < numchunks; chunk++) { int n, retval; char prompt[80]; + int retries = 0; snprintf(buf, 512, "%s/%s.%c%c", path, dist, (chunk / 26) + 'a', (chunk % 26) + 'a'); +retry: fd = (*mediaDevice->get)(buf); if (fd < 0) { - msgConfirm("failed to retreive piece file %s!\nAborting the transfer", buf); + if (++retries < 5) + goto retry; + msgConfirm("failed to retreive piece file %s after 5 retries!\nAborting the transfer", buf); goto punt; } snprintf(prompt, 80, "Extracting %s into %s directory...", me[i].my_name, me[i].my_dir); - dialog_gauge(" Progress ", prompt, 8, 15, 6, 40, (chunk + 1 ) / numchunks * 100); + dialog_gauge(" Progress ", prompt, 8, 15, 6, 50, (int) ((float) (chunk + 1) / numchunks * 100)); while ((n = read(fd, buf, sizeof buf)) > 0) { retval = write(fd2, buf, n); if (retval != n) @@ -363,6 +367,11 @@ distExtract(char *parent, Distribution *me) void distExtractAll(void) { - while (Dists) + int retries = 0; + + /* Try for 3 times around the loop, then give up. */ + while (Dists && ++retries < 3) distExtract(NULL, DistTable); + if (Dists) + msgConfirm("Couldn't extract all of the dists. Residue: %0x", Dists); } |