Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-4]: src/distrib/utils/sysinst pull up rev(s) 1.41-1.46 from tru...



details:   https://anonhg.NetBSD.org/src/rev/4a61b4bec3f7
branches:  netbsd-1-4
changeset: 469042:4a61b4bec3f7
user:      cgd <cgd%NetBSD.org@localhost>
date:      Thu Jun 24 23:02:09 1999 +0000

description:
pull up rev(s) 1.41-1.46 from trunk. (cgd)

diffstat:

 distrib/utils/sysinst/util.c |  95 +++++++++++++++++++------------------------
 1 files changed, 43 insertions(+), 52 deletions(-)

diffs (224 lines):

diff -r 26d6eb68284a -r 4a61b4bec3f7 distrib/utils/sysinst/util.c
--- a/distrib/utils/sysinst/util.c      Thu Jun 24 23:02:02 1999 +0000
+++ b/distrib/utils/sysinst/util.c      Thu Jun 24 23:02:09 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: util.c,v 1.34.2.1 1999/04/19 15:19:28 perry Exp $      */
+/*     $NetBSD: util.c,v 1.34.2.2 1999/06/24 23:02:09 cgd Exp $        */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -16,7 +16,7 @@
  *    documentation and/or other materials provided with the distribution.
  * 3. All advertising materials mentioning features or use of this software
  *    must display the following acknowledgement:
- *      This product includes software develooped for the NetBSD Project by
+ *      This product includes software developed for the NetBSD Project by
  *      Piermont Information Systems Inc.
  * 4. The name of Piermont Information Systems Inc. may not be used to endorse
  *    or promote products derived from this software without specific prior
@@ -61,9 +61,10 @@
        int nnotfound;
        int nerror;
        int nsuccess;
+       int nskipped;
 } tarstats;
 
-void   extract_file __P((char *path));
+int    extract_file __P((char *path));
 int    extract_dist __P((void));
 int    cleanup_dist __P((const char *path));
 int    distribution_sets_exist_p __P((const char *path));
@@ -143,33 +144,6 @@
        ask_sizemult();
 }
 
-/*
- * Returns 1 for "y" or "Y" and "n" otherwise.  CR => default.
- */
-int
-ask_ynquestion(char *quest, char def, ...)
-{
-       char line[STRSIZE];
-       va_list ap;
-       char c;
-
-       va_start(ap, def);
-       vsnprintf(line, STRSIZE, quest, ap);
-       va_end(ap);
-
-       if (def)
-               printf("%s [%c]: ", line, def);
-       else
-               printf("%s: ", line);
-       c = getchar();
-       if (c == '\n')
-               return def == 'y';
-
-       while (getchar() != '\n') /* eat characters */;
-
-       return c == 'y' || c == 'Y';
-}
-
 void
 run_makedev()
 {
@@ -466,20 +440,22 @@
        }
 }
 
-void
+int
 extract_file(path)
        char *path;
 {
        char *owd;
-       int   tarexit;
+       int   tarexit, rv;
        
        owd = getcwd (NULL,0);
 
        /* check tarfile exists */
        if (!file_exists_p(path)) {
                tarstats.nnotfound++;
-               ask_ynquestion(msg_string(MSG_notarfile), 0, path);
-               return;
+
+               msg_display(MSG_notarfile, path);
+               process_menu(MENU_noyes);
+               return (yesno == 0);
        }
 
        tarstats.nfound++;      
@@ -493,15 +469,19 @@
        /* Check tarexit for errors and give warning. */
        if (tarexit) {
                tarstats.nerror++;
-               ask_ynquestion(msg_string(MSG_tarerror), 0, path);
-               sleep(3);
+
+               msg_display(MSG_tarerror, path);
+               process_menu(MENU_noyes);
+               rv = (yesno == 0);
        } else {
                tarstats.nsuccess++;
-               sleep(1);
+               rv = 0;
        }
        
        chdir(owd);
        free(owd);
+
+       return (rv);
 }
 
 
@@ -517,15 +497,19 @@
        char distname[STRSIZE];
        char fname[STRSIZE];
        distinfo *list;
+       int punt;
 
        /* reset failure/success counters */
        memset(&tarstats, 0, sizeof(tarstats));
 
        /*endwin();*/
-       list = dist_list;
-       while (list->name) {
+       for (punt = 0, list = dist_list; list->name != NULL; list++) {
                if (list->getit) {
                        tarstats.nselected++;
+                       if (punt) {
+                               tarstats.nskipped++;
+                               continue;
+                       }
                        if (cleanup_dist(list->name) == 0) {
                                msg_display(MSG_cleanup_warn);
                                process_menu(MENU_ok);
@@ -534,12 +518,14 @@
                            dist_postfix);
                        (void)snprintf(fname, STRSIZE, "%s/%s", ext_dir,
                            distname);
-                       extract_file(fname);
+
+                       /* if extraction failed and user aborted, punt. */
+                       punt = extract_file(fname);
                }
-               list++;
        }
 
-       puts(CL);
+       puts(CL);               /* XXX */
+       wclear(stdscr);
        wrefresh(stdscr);
 
        if (tarstats.nerror == 0 && tarstats.nsuccess == tarstats.nselected) {
@@ -549,7 +535,7 @@
        } else {
                /* We encountered  errors. Let the user know. */
                msg_display(MSG_endtar,
-                   tarstats.nselected, tarstats.nnotfound,
+                   tarstats.nselected, tarstats.nnotfound, tarstats.nskipped,
                    tarstats.nfound, tarstats.nsuccess, tarstats.nerror);
                process_menu(MENU_ok);
                return 1;
@@ -730,7 +716,7 @@
  * show failure_msg and wait for the user to ack it before continuing.
  * success_msg and failure_msg must both be 0-adic messages.
  */
-void
+int
 get_and_unpack_sets(success_msg, failure_msg)
        int success_msg;
        int failure_msg;
@@ -750,17 +736,19 @@
        ask_verbose_dist();
 
        /* Get the distribution files */
-       process_menu(MENU_distmedium);
+       do {
+               got_dist = 0;
+               process_menu(MENU_distmedium);
+       } while (got_dist == -1);
 
        if (nodist)
-               return;
+               return 1;
 
        if (got_dist) {
 
                /* Extract the distribution, abort on errors. */
-               if (extract_dist()) {
-                       goto bad;
-               }
+               if (extract_dist())
+                       return 1;
 
                /* Configure the system */
                run_makedev();
@@ -779,12 +767,12 @@
                /* Install/Upgrade complete ... reboot or exit to script */
                msg_display(success_msg);
                process_menu(MENU_ok);
-               return;
+               return 0;
        }
 
-bad:
        msg_display(failure_msg);
        process_menu(MENU_ok);
+       return 1;
 }
 
 
@@ -866,7 +854,10 @@
        int c, found;
 
        yesnowin = subwin(stdscr, 5, 20, getmaxy(stdscr)/2 - 2, getmaxx(stdscr)/2 - 10);
-
+       if (yesnowin == NULL) {
+               fprintf(stderr, "sysinst: failed to allocate yes/no box\n");
+               exit(1);
+       }
        box(yesnowin, '*', '*');
        wmove(yesnowin, 2,2);
        



Home | Main Index | Thread Index | Old Index