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 revisions 1.26-1.28 (requ...



details:   https://anonhg.NetBSD.org/src/rev/3c99dd114f4c
branches:  netbsd-1-4
changeset: 470192:3c99dd114f4c
user:      he <he%NetBSD.org@localhost>
date:      Sun Jan 23 12:57:12 2000 +0000

description:
Pull up revisions 1.26-1.28 (requested by mycroft):
  Get rid of the side and bottom borders on command output windows,
  so this works better on a terminal.  Also fix bugs that could
  cause the display to be partially blanked after a suspend/resume.

diffstat:

 distrib/utils/sysinst/run.c |  91 +++++++++++++++++++++++---------------------
 1 files changed, 48 insertions(+), 43 deletions(-)

diffs (196 lines):

diff -r 17d30c5cf61d -r 3c99dd114f4c distrib/utils/sysinst/run.c
--- a/distrib/utils/sysinst/run.c       Sun Jan 23 12:56:43 2000 +0000
+++ b/distrib/utils/sysinst/run.c       Sun Jan 23 12:57:12 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: run.c,v 1.11.2.5 2000/01/23 12:53:23 he Exp $  */
+/*     $NetBSD: run.c,v 1.11.2.6 2000/01/23 12:57:12 he Exp $  */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -288,13 +288,14 @@
        (void)tcsetattr(STDIN_FILENO, TCSAFLUSH, &rtt);
 
        /* ignore tty signals until we're done with subprocess setup */
+       endwin();
        ttysig_ignore = 1;
 
        switch(child=fork()) {
        case -1:
                ttysig_ignore = 0;
+               refresh();
                return -1;
-               break;
        case 0:
                (void)close(STDIN_FILENO);
                subchild = fork();
@@ -306,7 +307,6 @@
                                        break;
                                write(dataflow[1], obuf, n);
                        } /* while spinning */
-                       nonl();
                        _exit(EXIT_SUCCESS);
                } /* subchild, child forks */
                (void)close(master);
@@ -335,6 +335,7 @@
                 */
                ttysig_forward = child;
                ttysig_ignore = 0;
+               refresh();
                break;
        }
        close(dataflow[1]);
@@ -364,27 +365,36 @@
                                        (void)write(master, ibuf, n);
                                for (j=0; j < n; j++) {
                                        if (display) {
-                                               getyx(actionwin, ycor, xcor);
-                                               if (ibuf[j] == '\n') {
+                                               switch (ibuf[j]) {
+                                               case '\n':
                                                        getyx(actionwin, ycor, xcor);
                                                        if (ycor + 1 >= actionwin->maxy) {
                                                                scroll(actionwin);
                                                                wmove(actionwin, actionwin->maxy - 1, 0);
                                                        } else
                                                                wmove(actionwin, ycor + 1, 0);
-                                               } else if (ibuf[j] == '\r') {
+                                                       break;
+                                               case '\r':
                                                        getyx(actionwin, ycor, xcor);
                                                        wmove(actionwin, ycor, 0);
-                                               } else
+                                                       break;
+                                               case '\b':
+                                                       getyx(actionwin, ycor, xcor);
+                                                       if (xcor > 0)
+                                                               wmove(actionwin, ycor, xcor - 1);
+                                                       break;
+                                               default:
                                                        waddch(actionwin, ibuf[j]);
+                                                       break;
+                                               }
                                                if (logging)
                                                        putc(ibuf[j], log);
                                        }
-                                       if (display)
-                                               wrefresh(actionwin);
-                                       if (logging)
-                                               fflush(log);
                                }
+                               if (display)
+                                       wrefresh(actionwin);
+                               if (logging)
+                                       fflush(log);
                        }
                }
 loop:
@@ -445,22 +455,25 @@
                win.ws_col = 80;
 
        if (display) {
-               wclear(stdscr); /* XXX shouldn't be needed */
-               wrefresh(stdscr);
-               statuswin = subwin(stdscr, win.ws_row, win.ws_col, 0, 0);
+               wclear(stdscr);
+               clearok(stdscr, 1);
+               refresh();
+
+               statuswin = subwin(stdscr, 3, win.ws_col, 0, 0);
                if (statuswin == NULL) {
                        fprintf(stderr, "sysinst: failed to allocate"
                            " status window.\n");
                        exit(1);
                }
-               boxwin = subwin(statuswin, win.ws_row - 3, win.ws_col, 3, 0);
+
+               boxwin = subwin(stdscr, 1, win.ws_col, 3, 0);
                if (boxwin == NULL) {
                        fprintf(stderr, "sysinst: failed to allocate"
                            " status box.\n");
                        exit(1);
                }
-               actionwin = subwin(statuswin, win.ws_row - 5, win.ws_col - 2,
-                  4, 1);
+
+               actionwin = subwin(stdscr, win.ws_row - 4, win.ws_col, 4, 0);
                if (actionwin == NULL) {
                        fprintf(stderr, "sysinst: failed to allocate"
                            " output window.\n");
@@ -468,25 +481,13 @@
                }
                scrollok(actionwin, TRUE);
 
-               win.ws_col -= 2;
-               win.ws_row -= 5;
-
-               wclear(statuswin);
-               wrefresh(statuswin);
+               win.ws_row -= 4;
 
-               wclear(boxwin);
-               box(boxwin, 124, 45);
-               wrefresh(boxwin);
-
-               wclear(actionwin);
-               wrefresh(actionwin);
-
-               wmove(statuswin, 0 , 5);
+               wmove(statuswin, 0, 5);
                waddstr(statuswin, "Status: ");
                wstandout(statuswin);
                waddstr(statuswin, "Running");
                wstandend(statuswin);
-
                wmove(statuswin, 1, 4);
                waddstr(statuswin, "Command: ");
                wstandout(statuswin);
@@ -494,17 +495,24 @@
                wstandend(statuswin);
                wrefresh(statuswin);
 
+               wmove(boxwin, 0, 0);
+               {
+                       int n, m;
+                       for (n = win.ws_col; (m = min(n, 30)) > 0; n -= m)
+                               waddstr(boxwin,
+                                   "------------------------------" + 30 - m);
+               }
+               wrefresh(boxwin);
+
+               wrefresh(actionwin);
+
                ret = launch_subwin(actionwin, args, win, 1);
 
                wmove(statuswin, 0, 13);
-               waddstr(statuswin, "          ");
-               wmove(statuswin, 0, 13);
                wstandout(statuswin);
-               if (ret != 0)
-                       waddstr(statuswin, "Failed");
-               else
-                       waddstr(statuswin, "Finished");
+               waddstr(statuswin, ret ? "Failed" : "Finished");
                wstandend(statuswin);
+               waddstr(statuswin, "  ");
                wmove(statuswin, 2, 5);
                if (ret != 0)
                        waddstr(statuswin, "Press any key to continue");
@@ -513,15 +521,12 @@
                        (void)getchar();
 
                /* clean things up */
-               wclear(actionwin);
-               wrefresh(actionwin);
                delwin(actionwin);
-               wclear(boxwin);
-               wrefresh(boxwin);
                delwin(boxwin);
-               wclear(statuswin);
-               wrefresh(statuswin);
                delwin(statuswin);
+
+               wclear(stdscr);
+               clearok(stdscr, 1);
                refresh();
        } else { /* display */
                ret = launch_subwin(NULL, args, win, 0);



Home | Main Index | Thread Index | Old Index