diff options
-rw-r--r-- | release/sysinstall/Makefile | 2 | ||||
-rw-r--r-- | release/sysinstall/config.c | 4 | ||||
-rw-r--r-- | release/sysinstall/dist.c | 41 | ||||
-rw-r--r-- | release/sysinstall/index.c | 4 | ||||
-rw-r--r-- | release/sysinstall/msg.c | 11 | ||||
-rw-r--r-- | release/sysinstall/package.c | 36 | ||||
-rw-r--r-- | release/sysinstall/termcap.c | 2 | ||||
-rw-r--r-- | usr.sbin/sade/Makefile | 2 | ||||
-rw-r--r-- | usr.sbin/sade/config.c | 4 | ||||
-rw-r--r-- | usr.sbin/sade/msg.c | 11 | ||||
-rw-r--r-- | usr.sbin/sade/termcap.c | 2 | ||||
-rw-r--r-- | usr.sbin/sysinstall/Makefile | 2 | ||||
-rw-r--r-- | usr.sbin/sysinstall/config.c | 4 | ||||
-rw-r--r-- | usr.sbin/sysinstall/dist.c | 41 | ||||
-rw-r--r-- | usr.sbin/sysinstall/index.c | 4 | ||||
-rw-r--r-- | usr.sbin/sysinstall/msg.c | 11 | ||||
-rw-r--r-- | usr.sbin/sysinstall/package.c | 36 | ||||
-rw-r--r-- | usr.sbin/sysinstall/termcap.c | 2 |
18 files changed, 139 insertions, 80 deletions
diff --git a/release/sysinstall/Makefile b/release/sysinstall/Makefile index f2d4189..475820f 100644 --- a/release/sysinstall/Makefile +++ b/release/sysinstall/Makefile @@ -1,7 +1,7 @@ PROG= sysinstall NOMAN= yes CLEANFILES= makedevs.c rtermcap -#DEBUG_FLAGS+= -g3 +DEBUG_FLAGS+= -g3 .PATH: ${.CURDIR}/../disklabel ${.CURDIR}/../../usr.bin/cksum diff --git a/release/sysinstall/config.c b/release/sysinstall/config.c index fd9a274..1262efa 100644 --- a/release/sysinstall/config.c +++ b/release/sysinstall/config.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: config.c,v 1.30 1996/04/29 18:06:06 jkh Exp $ + * $Id: config.c,v 1.31 1996/05/16 11:47:26 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -460,7 +460,7 @@ configPackages(dialogMenuItem *self) pos = scroll = 0; index_menu(&top, &plist, &pos, &scroll); - if (plist.kids) { + if (plist.kids && plist.kids->name) { /* Now show the packing list menu */ pos = scroll = 0; ret = index_menu(&plist, NULL, &pos, &scroll); diff --git a/release/sysinstall/dist.c b/release/sysinstall/dist.c index 8b9ec23..b729626 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.51 1996/05/16 13:30:22 jkh Exp $ + * $Id: dist.c,v 1.52 1996/05/16 13:39:06 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -34,6 +34,7 @@ * */ +#include <sys/time.h> #include "sysinstall.h" unsigned int Dists; @@ -295,12 +296,13 @@ distSetXF86(dialogMenuItem *self) static Boolean distExtract(char *parent, Distribution *me) { - int i, status; + int i, status, total; int cpid, zpid, fd, fd2, chunk, numchunks; char *path, *dist, buf[10240]; const char *tmp; Attribs *dist_attr; WINDOW *w = savescr(); + struct timeval start, stop; status = TRUE; dialog_clear(); @@ -322,9 +324,10 @@ distExtract(char *parent, Distribution *me) continue; } - /* Recurse if actually have a sub-distribution */ + /* Recurse if we actually have a sub-distribution */ if (me[i].my_dist) { - status = distExtract(dist, me[i].my_dist); + if ((status = distExtract(dist, me[i].my_dist)) == TRUE) + *(me[i].my_mask) &= ~(me[i].my_bit); goto done; } @@ -332,6 +335,10 @@ distExtract(char *parent, Distribution *me) snprintf(buf, 512, "%s/%s.tgz", path, dist); if (isDebug()) msgDebug("Trying to get large piece: %s\n", buf); + /* + * Passing TRUE as 3rd parm to get routine makes this a "probing" get, for which errors + * are not considered too significant. + */ fd = mediaDevice->get(mediaDevice, buf, TRUE); if (fd >= 0) { msgNotify("Extracting %s into %s directory...", me[i].my_name, me[i].my_dir); @@ -378,6 +385,8 @@ distExtract(char *parent, Distribution *me) /* We have one or more chunks, go pick them up */ mediaExtractDistBegin(me[i].my_dir, &fd2, &zpid, &cpid); + total = 0; + (void)gettimeofday(&start, (struct timezone *)0); for (chunk = 0; chunk < numchunks; chunk++) { int n, retval; char prompt[80]; @@ -387,13 +396,31 @@ distExtract(char *parent, Distribution *me) msgDebug("trying for piece %d of %d: %s\n", chunk + 1, numchunks, buf); fd = mediaDevice->get(mediaDevice, buf, FALSE); if (fd < 0) { - msgConfirm("failed to retreive piece file %s!\nAborting the transfer", buf); + msgConfirm("failed to retreive piece file %s!\n" + "Aborting 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, 50, (int)((float)(chunk + 1) / numchunks * 100)); - move(0, 0); /* Get cursor out of the way - it makes gauges look strange */ - while ((n = read(fd, buf, sizeof buf)) > 0) { + while (1) { + int seconds; + + n = read(fd, buf, sizeof buf); + if (n <= 0) + break; + total += n; + + /* Print statistics about how we're doing */ + (void) gettimeofday(&stop, (struct timezone *)0); + stop.tv_sec = stop.tv_sec - start.tv_sec; + stop.tv_usec = stop.tv_usec - start.tv_usec; + if (stop.tv_usec < 0) + stop.tv_sec--, stop.tv_usec += 1000000; + seconds = stop.tv_sec + (stop.tv_usec / 1000000.0); + if (!seconds) + seconds = 1; + msgInfo("%d bytes read from distribution chunk %d of %d, %d KBytes/second", + total, chunk + 1, numchunks, (total / seconds) / 1024); retval = write(fd2, buf, n); if (retval != n) { mediaDevice->close(mediaDevice, fd); diff --git a/release/sysinstall/index.c b/release/sysinstall/index.c index 2ca5a1b..af5214f 100644 --- a/release/sysinstall/index.c +++ b/release/sysinstall/index.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: index.c,v 1.28 1996/05/01 09:31:50 jkh Exp $ + * $Id: index.c,v 1.29 1996/05/16 11:47:29 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -518,7 +518,7 @@ index_extract(Device *dev, PkgNodePtr top, PkgNodePtr plist) PkgNodePtr tmp; int status = DITEM_SUCCESS; - for (tmp = plist->kids; tmp; tmp = tmp->next) + for (tmp = plist->kids; tmp && tmp->name; tmp = tmp->next) status = index_extract_one(dev, top, tmp, FALSE); return status; } diff --git a/release/sysinstall/msg.c b/release/sysinstall/msg.c index ef1d79b..4d01088 100644 --- a/release/sysinstall/msg.c +++ b/release/sysinstall/msg.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: msg.c,v 1.32 1996/04/28 00:37:36 jkh Exp $ + * $Id: msg.c,v 1.33 1996/05/16 11:47:40 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -82,7 +82,7 @@ msgInfo(char *fmt, ...) /* NULL is a special convention meaning "erase the old stuff" */ if (!fmt) { move(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0); - attrset(A_REVERSE); + attrset(A_NORMAL); clrtoeol(); attrset(attrs); return; @@ -99,16 +99,11 @@ msgInfo(char *fmt, ...) break; } line[80] = '\0'; - attrset(A_REVERSE); + attrset(item_attr); mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, line); attrset(attrs); move(OnVTY ? VTY_STATLINE : TTY_STATLINE, 79); refresh(); - if (OnVTY) { - if (isDebug()) - msgDebug("Information: `%s'\n", errstr); - msgInfo(NULL); - } } /* Whack up a warning on the status line */ diff --git a/release/sysinstall/package.c b/release/sysinstall/package.c index 390733c..3bc3953 100644 --- a/release/sysinstall/package.c +++ b/release/sysinstall/package.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: package.c,v 1.35 1996/04/30 06:13:50 jkh Exp $ + * $Id: package.c,v 1.36 1996/05/16 11:47:42 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -38,6 +38,7 @@ #include <string.h> #include <stdlib.h> #include <sys/errno.h> +#include <sys/time.h> #include <sys/param.h> #include <sys/mount.h> #include <sys/stat.h> @@ -114,27 +115,35 @@ package_extract(Device *dev, char *name, Boolean depended) else { char buf[BUFSIZ]; WINDOW *w = savescr(); + struct timeval start, stop; close(pfd[0]); tot = 0; + (void)gettimeofday(&start, (struct timezone *)0); + while ((i = read(fd, buf, BUFSIZ)) > 0) { - char line[80]; - int x, len; + int seconds; - write(pfd[1], buf, i); tot += i; - sprintf(line, "%d bytes read from package %s", tot, name); - len = strlen(line); - for (x = len; x < 79; x++) - line[x] = ' '; - line[79] = '\0'; - mvprintw(0, 0, line); - clrtoeol(); - refresh(); + /* Print statistics about how we're doing */ + (void) gettimeofday(&stop, (struct timezone *)0); + stop.tv_sec = stop.tv_sec - start.tv_sec; + stop.tv_usec = stop.tv_usec - start.tv_usec; + if (stop.tv_usec < 0) + stop.tv_sec--, stop.tv_usec += 1000000; + seconds = stop.tv_sec + (stop.tv_usec / 1000000.0); + if (!seconds) + seconds = 1; + msgInfo("%d bytes read from package %s, %d KBytes/second", tot, name, (tot / seconds) / 1024); + /* Write it out */ + if (write(pfd[1], buf, i) != i) { + msgInfo("Write failure to pkg_add! Package may be corrupt."); + break; + } } close(pfd[1]); dev->close(dev, fd); - mvprintw(0, 0, "Package %s read successfully - waiting for pkg_add", name); + msgInfo("Package %s read successfully - waiting for pkg_add", name); refresh(); i = waitpid(pid, &tot, 0); if (i < 0 || WEXITSTATUS(tot)) { @@ -149,6 +158,7 @@ package_extract(Device *dev, char *name, Boolean depended) } else { msgDebug("pkg_extract: get operation returned %d\n", fd); + dialog_clear(); if (variable_get(VAR_NO_CONFIRM)) msgNotify("Unable to fetch package %s from selected media.\n" "No package add will be done.", name); diff --git a/release/sysinstall/termcap.c b/release/sysinstall/termcap.c index 30efe0c..1f25ab1 100644 --- a/release/sysinstall/termcap.c +++ b/release/sysinstall/termcap.c @@ -55,7 +55,6 @@ set_termcap(void) on = 1; i = ioctl(DebugFD, TIOCCONS, (char *)&on); msgDebug("ioctl(%d, TIOCCONS, NULL) = %d (%s)\n", DebugFD, i, !i ? "success" : strerror(errno)); - OnVTY = TRUE; } if (ColorDisplay) { if (!term) { @@ -73,6 +72,7 @@ set_termcap(void) return -1; } } + OnVTY = TRUE; } return 0; } diff --git a/usr.sbin/sade/Makefile b/usr.sbin/sade/Makefile index f2d4189..475820f 100644 --- a/usr.sbin/sade/Makefile +++ b/usr.sbin/sade/Makefile @@ -1,7 +1,7 @@ PROG= sysinstall NOMAN= yes CLEANFILES= makedevs.c rtermcap -#DEBUG_FLAGS+= -g3 +DEBUG_FLAGS+= -g3 .PATH: ${.CURDIR}/../disklabel ${.CURDIR}/../../usr.bin/cksum diff --git a/usr.sbin/sade/config.c b/usr.sbin/sade/config.c index fd9a274..1262efa 100644 --- a/usr.sbin/sade/config.c +++ b/usr.sbin/sade/config.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: config.c,v 1.30 1996/04/29 18:06:06 jkh Exp $ + * $Id: config.c,v 1.31 1996/05/16 11:47:26 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -460,7 +460,7 @@ configPackages(dialogMenuItem *self) pos = scroll = 0; index_menu(&top, &plist, &pos, &scroll); - if (plist.kids) { + if (plist.kids && plist.kids->name) { /* Now show the packing list menu */ pos = scroll = 0; ret = index_menu(&plist, NULL, &pos, &scroll); diff --git a/usr.sbin/sade/msg.c b/usr.sbin/sade/msg.c index ef1d79b..4d01088 100644 --- a/usr.sbin/sade/msg.c +++ b/usr.sbin/sade/msg.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: msg.c,v 1.32 1996/04/28 00:37:36 jkh Exp $ + * $Id: msg.c,v 1.33 1996/05/16 11:47:40 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -82,7 +82,7 @@ msgInfo(char *fmt, ...) /* NULL is a special convention meaning "erase the old stuff" */ if (!fmt) { move(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0); - attrset(A_REVERSE); + attrset(A_NORMAL); clrtoeol(); attrset(attrs); return; @@ -99,16 +99,11 @@ msgInfo(char *fmt, ...) break; } line[80] = '\0'; - attrset(A_REVERSE); + attrset(item_attr); mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, line); attrset(attrs); move(OnVTY ? VTY_STATLINE : TTY_STATLINE, 79); refresh(); - if (OnVTY) { - if (isDebug()) - msgDebug("Information: `%s'\n", errstr); - msgInfo(NULL); - } } /* Whack up a warning on the status line */ diff --git a/usr.sbin/sade/termcap.c b/usr.sbin/sade/termcap.c index 30efe0c..1f25ab1 100644 --- a/usr.sbin/sade/termcap.c +++ b/usr.sbin/sade/termcap.c @@ -55,7 +55,6 @@ set_termcap(void) on = 1; i = ioctl(DebugFD, TIOCCONS, (char *)&on); msgDebug("ioctl(%d, TIOCCONS, NULL) = %d (%s)\n", DebugFD, i, !i ? "success" : strerror(errno)); - OnVTY = TRUE; } if (ColorDisplay) { if (!term) { @@ -73,6 +72,7 @@ set_termcap(void) return -1; } } + OnVTY = TRUE; } return 0; } diff --git a/usr.sbin/sysinstall/Makefile b/usr.sbin/sysinstall/Makefile index f2d4189..475820f 100644 --- a/usr.sbin/sysinstall/Makefile +++ b/usr.sbin/sysinstall/Makefile @@ -1,7 +1,7 @@ PROG= sysinstall NOMAN= yes CLEANFILES= makedevs.c rtermcap -#DEBUG_FLAGS+= -g3 +DEBUG_FLAGS+= -g3 .PATH: ${.CURDIR}/../disklabel ${.CURDIR}/../../usr.bin/cksum diff --git a/usr.sbin/sysinstall/config.c b/usr.sbin/sysinstall/config.c index fd9a274..1262efa 100644 --- a/usr.sbin/sysinstall/config.c +++ b/usr.sbin/sysinstall/config.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: config.c,v 1.30 1996/04/29 18:06:06 jkh Exp $ + * $Id: config.c,v 1.31 1996/05/16 11:47:26 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -460,7 +460,7 @@ configPackages(dialogMenuItem *self) pos = scroll = 0; index_menu(&top, &plist, &pos, &scroll); - if (plist.kids) { + if (plist.kids && plist.kids->name) { /* Now show the packing list menu */ pos = scroll = 0; ret = index_menu(&plist, NULL, &pos, &scroll); diff --git a/usr.sbin/sysinstall/dist.c b/usr.sbin/sysinstall/dist.c index 8b9ec23..b729626 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.51 1996/05/16 13:30:22 jkh Exp $ + * $Id: dist.c,v 1.52 1996/05/16 13:39:06 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -34,6 +34,7 @@ * */ +#include <sys/time.h> #include "sysinstall.h" unsigned int Dists; @@ -295,12 +296,13 @@ distSetXF86(dialogMenuItem *self) static Boolean distExtract(char *parent, Distribution *me) { - int i, status; + int i, status, total; int cpid, zpid, fd, fd2, chunk, numchunks; char *path, *dist, buf[10240]; const char *tmp; Attribs *dist_attr; WINDOW *w = savescr(); + struct timeval start, stop; status = TRUE; dialog_clear(); @@ -322,9 +324,10 @@ distExtract(char *parent, Distribution *me) continue; } - /* Recurse if actually have a sub-distribution */ + /* Recurse if we actually have a sub-distribution */ if (me[i].my_dist) { - status = distExtract(dist, me[i].my_dist); + if ((status = distExtract(dist, me[i].my_dist)) == TRUE) + *(me[i].my_mask) &= ~(me[i].my_bit); goto done; } @@ -332,6 +335,10 @@ distExtract(char *parent, Distribution *me) snprintf(buf, 512, "%s/%s.tgz", path, dist); if (isDebug()) msgDebug("Trying to get large piece: %s\n", buf); + /* + * Passing TRUE as 3rd parm to get routine makes this a "probing" get, for which errors + * are not considered too significant. + */ fd = mediaDevice->get(mediaDevice, buf, TRUE); if (fd >= 0) { msgNotify("Extracting %s into %s directory...", me[i].my_name, me[i].my_dir); @@ -378,6 +385,8 @@ distExtract(char *parent, Distribution *me) /* We have one or more chunks, go pick them up */ mediaExtractDistBegin(me[i].my_dir, &fd2, &zpid, &cpid); + total = 0; + (void)gettimeofday(&start, (struct timezone *)0); for (chunk = 0; chunk < numchunks; chunk++) { int n, retval; char prompt[80]; @@ -387,13 +396,31 @@ distExtract(char *parent, Distribution *me) msgDebug("trying for piece %d of %d: %s\n", chunk + 1, numchunks, buf); fd = mediaDevice->get(mediaDevice, buf, FALSE); if (fd < 0) { - msgConfirm("failed to retreive piece file %s!\nAborting the transfer", buf); + msgConfirm("failed to retreive piece file %s!\n" + "Aborting 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, 50, (int)((float)(chunk + 1) / numchunks * 100)); - move(0, 0); /* Get cursor out of the way - it makes gauges look strange */ - while ((n = read(fd, buf, sizeof buf)) > 0) { + while (1) { + int seconds; + + n = read(fd, buf, sizeof buf); + if (n <= 0) + break; + total += n; + + /* Print statistics about how we're doing */ + (void) gettimeofday(&stop, (struct timezone *)0); + stop.tv_sec = stop.tv_sec - start.tv_sec; + stop.tv_usec = stop.tv_usec - start.tv_usec; + if (stop.tv_usec < 0) + stop.tv_sec--, stop.tv_usec += 1000000; + seconds = stop.tv_sec + (stop.tv_usec / 1000000.0); + if (!seconds) + seconds = 1; + msgInfo("%d bytes read from distribution chunk %d of %d, %d KBytes/second", + total, chunk + 1, numchunks, (total / seconds) / 1024); retval = write(fd2, buf, n); if (retval != n) { mediaDevice->close(mediaDevice, fd); diff --git a/usr.sbin/sysinstall/index.c b/usr.sbin/sysinstall/index.c index 2ca5a1b..af5214f 100644 --- a/usr.sbin/sysinstall/index.c +++ b/usr.sbin/sysinstall/index.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: index.c,v 1.28 1996/05/01 09:31:50 jkh Exp $ + * $Id: index.c,v 1.29 1996/05/16 11:47:29 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -518,7 +518,7 @@ index_extract(Device *dev, PkgNodePtr top, PkgNodePtr plist) PkgNodePtr tmp; int status = DITEM_SUCCESS; - for (tmp = plist->kids; tmp; tmp = tmp->next) + for (tmp = plist->kids; tmp && tmp->name; tmp = tmp->next) status = index_extract_one(dev, top, tmp, FALSE); return status; } diff --git a/usr.sbin/sysinstall/msg.c b/usr.sbin/sysinstall/msg.c index ef1d79b..4d01088 100644 --- a/usr.sbin/sysinstall/msg.c +++ b/usr.sbin/sysinstall/msg.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: msg.c,v 1.32 1996/04/28 00:37:36 jkh Exp $ + * $Id: msg.c,v 1.33 1996/05/16 11:47:40 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -82,7 +82,7 @@ msgInfo(char *fmt, ...) /* NULL is a special convention meaning "erase the old stuff" */ if (!fmt) { move(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0); - attrset(A_REVERSE); + attrset(A_NORMAL); clrtoeol(); attrset(attrs); return; @@ -99,16 +99,11 @@ msgInfo(char *fmt, ...) break; } line[80] = '\0'; - attrset(A_REVERSE); + attrset(item_attr); mvaddstr(OnVTY ? VTY_STATLINE : TTY_STATLINE, 0, line); attrset(attrs); move(OnVTY ? VTY_STATLINE : TTY_STATLINE, 79); refresh(); - if (OnVTY) { - if (isDebug()) - msgDebug("Information: `%s'\n", errstr); - msgInfo(NULL); - } } /* Whack up a warning on the status line */ diff --git a/usr.sbin/sysinstall/package.c b/usr.sbin/sysinstall/package.c index 390733c..3bc3953 100644 --- a/usr.sbin/sysinstall/package.c +++ b/usr.sbin/sysinstall/package.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: package.c,v 1.35 1996/04/30 06:13:50 jkh Exp $ + * $Id: package.c,v 1.36 1996/05/16 11:47:42 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -38,6 +38,7 @@ #include <string.h> #include <stdlib.h> #include <sys/errno.h> +#include <sys/time.h> #include <sys/param.h> #include <sys/mount.h> #include <sys/stat.h> @@ -114,27 +115,35 @@ package_extract(Device *dev, char *name, Boolean depended) else { char buf[BUFSIZ]; WINDOW *w = savescr(); + struct timeval start, stop; close(pfd[0]); tot = 0; + (void)gettimeofday(&start, (struct timezone *)0); + while ((i = read(fd, buf, BUFSIZ)) > 0) { - char line[80]; - int x, len; + int seconds; - write(pfd[1], buf, i); tot += i; - sprintf(line, "%d bytes read from package %s", tot, name); - len = strlen(line); - for (x = len; x < 79; x++) - line[x] = ' '; - line[79] = '\0'; - mvprintw(0, 0, line); - clrtoeol(); - refresh(); + /* Print statistics about how we're doing */ + (void) gettimeofday(&stop, (struct timezone *)0); + stop.tv_sec = stop.tv_sec - start.tv_sec; + stop.tv_usec = stop.tv_usec - start.tv_usec; + if (stop.tv_usec < 0) + stop.tv_sec--, stop.tv_usec += 1000000; + seconds = stop.tv_sec + (stop.tv_usec / 1000000.0); + if (!seconds) + seconds = 1; + msgInfo("%d bytes read from package %s, %d KBytes/second", tot, name, (tot / seconds) / 1024); + /* Write it out */ + if (write(pfd[1], buf, i) != i) { + msgInfo("Write failure to pkg_add! Package may be corrupt."); + break; + } } close(pfd[1]); dev->close(dev, fd); - mvprintw(0, 0, "Package %s read successfully - waiting for pkg_add", name); + msgInfo("Package %s read successfully - waiting for pkg_add", name); refresh(); i = waitpid(pid, &tot, 0); if (i < 0 || WEXITSTATUS(tot)) { @@ -149,6 +158,7 @@ package_extract(Device *dev, char *name, Boolean depended) } else { msgDebug("pkg_extract: get operation returned %d\n", fd); + dialog_clear(); if (variable_get(VAR_NO_CONFIRM)) msgNotify("Unable to fetch package %s from selected media.\n" "No package add will be done.", name); diff --git a/usr.sbin/sysinstall/termcap.c b/usr.sbin/sysinstall/termcap.c index 30efe0c..1f25ab1 100644 --- a/usr.sbin/sysinstall/termcap.c +++ b/usr.sbin/sysinstall/termcap.c @@ -55,7 +55,6 @@ set_termcap(void) on = 1; i = ioctl(DebugFD, TIOCCONS, (char *)&on); msgDebug("ioctl(%d, TIOCCONS, NULL) = %d (%s)\n", DebugFD, i, !i ? "success" : strerror(errno)); - OnVTY = TRUE; } if (ColorDisplay) { if (!term) { @@ -73,6 +72,7 @@ set_termcap(void) return -1; } } + OnVTY = TRUE; } return 0; } |