terse mode and some new commands.
authorEdward Wang <edward@ucbvax.Berkeley.EDU>
Fri, 29 Jul 1983 09:32:26 +0000 (01:32 -0800)
committerEdward Wang <edward@ucbvax.Berkeley.EDU>
Fri, 29 Jul 1983 09:32:26 +0000 (01:32 -0800)
also, the : business.

SCCS-vsn: usr.bin/window/cmd.c 1.8
SCCS-vsn: usr.bin/window/cmd1.c 1.6
SCCS-vsn: usr.bin/window/cmd2.c 1.8
SCCS-vsn: usr.bin/window/cmd3.c 1.6
SCCS-vsn: usr.bin/window/cmd4.c 1.4
SCCS-vsn: usr.bin/window/cmd5.c 1.6

usr/src/usr.bin/window/cmd.c
usr/src/usr.bin/window/cmd1.c
usr/src/usr.bin/window/cmd2.c
usr/src/usr.bin/window/cmd3.c
usr/src/usr.bin/window/cmd4.c
usr/src/usr.bin/window/cmd5.c

index 0cbc7aa..6d43467 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)cmd.c       1.7 83/07/28";
+static char *sccsid = "@(#)cmd.c       1.8 83/07/28";
 #endif
 
 #include "defs.h"
 #endif
 
 #include "defs.h"
@@ -11,20 +11,19 @@ docmd()
        register char c;
        register struct ww *w;
 
        register char c;
        register struct ww *w;
 
-top:
        if (!terse)
                Wunhide(cmdwin->ww_win);
        if (selwin != 0)
                Woncursor(selwin->ww_win, 1);
        if (!terse)
                Wunhide(cmdwin->ww_win);
        if (selwin != 0)
                Woncursor(selwin->ww_win, 1);
+top:
        while ((c = bgetc()) >= 0) {
        while ((c = bgetc()) >= 0) {
-               wwputs("\r\n", cmdwin);
+               if (!terse)
+                       wwputs("\r\n", cmdwin);
                switch (c) {
                default:
                        if (c == escapec)
                                goto foo;
                        break;
                switch (c) {
                default:
                        if (c == escapec)
                                goto foo;
                        break;
-               case 'r':
-               case 'R':
                case 'h': case 'j': case 'k': case 'l':
                case CTRL(u):
                case CTRL(d):
                case 'h': case 'j': case 'k': case 'l':
                case CTRL(u):
                case CTRL(d):
@@ -33,7 +32,8 @@ top:
                case CTRL([):
                foo:
                        if (selwin == 0) {
                case CTRL([):
                foo:
                        if (selwin == 0) {
-                               wwputs("No window.  ", cmdwin);
+                               if (!terse)
+                                       wwputs("No window.  ", cmdwin);
                                continue;
                        }
                }
                                continue;
                        }
                }
@@ -58,7 +58,10 @@ top:
                        doclose((struct ww *)0);
                        break;
                case 'Z':
                        doclose((struct ww *)0);
                        break;
                case 'Z':
-                       wwputs("Command Z is now C.  ", cmdwin);
+                       if (terse)
+                               Ding();
+                       else
+                               wwputs("Command Z is now C.  ", cmdwin);
                        break;
                case 'w':
                        dowindow();
                        break;
                case 'w':
                        dowindow();
@@ -66,6 +69,10 @@ top:
                case 'S':
                        doshow();
                        break;
                case 'S':
                        doshow();
                        break;
+               case 'L':
+                       dolist();
+                       break;
+               /*
                case 'e':
                        doescape();
                        break;
                case 'e':
                        doescape();
                        break;
@@ -78,6 +85,7 @@ top:
                case 'R':
                        selwin->ww_refresh = 1;
                        break;
                case 'R':
                        selwin->ww_refresh = 1;
                        break;
+               */
                case 's':
                        dostat();
                        break;
                case 's':
                        dostat();
                        break;
@@ -125,23 +133,35 @@ top:
                case CTRL(z):
                        wwsuspend();
                        break;
                case CTRL(z):
                        wwsuspend();
                        break;
-               case '.':
+               case 'q':
                        doquit();
                        if (quit)
                                goto out;
                        break;
                        doquit();
                        if (quit)
                                goto out;
                        break;
+               case '.':
+                       if (terse)
+                               Ding();
+                       else
+                               wwputs("Use q to quit.  ", cmdwin);
+                       break;
                default:
                        if (c == escapec) {
                                write(selwin->ww_pty, &escapec, 1);
                                goto out;
                        }
                        Ding();
                default:
                        if (c == escapec) {
                                write(selwin->ww_pty, &escapec, 1);
                                goto out;
                        }
                        Ding();
-                       wwprintf(cmdwin, "Type ? for help.  ");
+                       if (!terse)
+                               wwprintf(cmdwin, "Type ? for help.  ");
                        break;
                }
        }
                        break;
                }
        }
-       wwputs("Command: ", cmdwin);
-       wwsetcursor(WCurRow(cmdwin->ww_win), WCurCol(cmdwin->ww_win));
+       if (terse)
+               wwsetcursor(0, 0);
+       else {
+               if (!terse)
+                       wwputs("Command: ", cmdwin);
+               wwsetcursor(WCurRow(cmdwin->ww_win), WCurCol(cmdwin->ww_win));
+       }
        while (bpeekc() < 0)
                bread();
        goto top;
        while (bpeekc() < 0)
                bread();
        goto top;
@@ -160,13 +180,15 @@ getwin()
        register int c;
        struct ww *w = 0;
 
        register int c;
        struct ww *w = 0;
 
-       wwputs("Which window? ", cmdwin);
+       if (!terse)
+               wwputs("Which window? ", cmdwin);
        wwsetcursor(WCurRow(cmdwin->ww_win), WCurCol(cmdwin->ww_win));
        while ((c = bgetc()) < 0)
                bread();
        if (c < '1' || c > '9' || (w = wwfind(c - '0')) == 0)
                Ding();
        wwsetcursor(WCurRow(cmdwin->ww_win), WCurCol(cmdwin->ww_win));
        while ((c = bgetc()) < 0)
                bread();
        if (c < '1' || c > '9' || (w = wwfind(c - '0')) == 0)
                Ding();
-       wwputs("\r\n", cmdwin);
+       if (!terse)
+               wwputs("\r\n", cmdwin);
        return w;
 }
 
        return w;
 }
 
index 8249015..1d54b6f 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)cmd1.c      1.5 83/07/28";
+static char *sccsid = "@(#)cmd1.c      1.6 83/07/28";
 #endif
 
 #include "defs.h"
 #endif
 
 #include "defs.h"
@@ -12,10 +12,14 @@ dowindow()
        int id;
 
        if ((id = findid()) < 0) {
        int id;
 
        if ((id = findid()) < 0) {
-               wwputs("Too many windows.  ", cmdwin);
+               if (terse)
+                       Ding();
+               else
+                       wwputs("Too many windows.  ", cmdwin);
                return;
        }
                return;
        }
-       wwputs("Upper left corner: ", cmdwin);
+       if (!terse)
+               wwputs("Upper left corner: ", cmdwin);
        col = 0;
        row = 1;
        for (;;) {
        col = 0;
        row = 1;
        for (;;) {
@@ -25,7 +29,8 @@ dowindow()
                switch (getpos(&row, &col, 0, 0)) {
                case -1:
                        WBoxActive = 0;
                switch (getpos(&row, &col, 0, 0)) {
                case -1:
                        WBoxActive = 0;
-                       wwputs("\r\nCancelled.  ", cmdwin);
+                       if (!terse)
+                               wwputs("\r\nCancelled.  ", cmdwin);
                        return;
                case 1:
                        break;
                        return;
                case 1:
                        break;
@@ -34,7 +39,8 @@ dowindow()
                }
                break;
        }
                }
                break;
        }
-       wwputs("\r\nLower right corner: ", cmdwin);
+       if (!terse)
+               wwputs("\r\nLower right corner: ", cmdwin);
        xcol = col + 1;
        xrow = row + 1;
        for (;;) {
        xcol = col + 1;
        xrow = row + 1;
        for (;;) {
@@ -46,7 +52,8 @@ dowindow()
                switch (getpos(&xrow, &xcol, row + 1, col + 1)) {
                case -1:
                        WBoxActive = 0;
                switch (getpos(&xrow, &xcol, row + 1, col + 1)) {
                case -1:
                        WBoxActive = 0;
-                       wwputs("\r\nCancelled.  ", cmdwin);
+                       if (!terse)
+                               wwputs("\r\nCancelled.  ", cmdwin);
                        return;
                case 1:
                        break;
                        return;
                case 1:
                        break;
@@ -56,10 +63,14 @@ dowindow()
                break;
        }
        WBoxActive = 0;
                break;
        }
        WBoxActive = 0;
-       wwputs("\r\n", cmdwin);
+       if (!terse)
+               wwputs("\r\n", cmdwin);
        wwsetcursor(WCurRow(cmdwin->ww_win), WCurCol(cmdwin->ww_win));
        if (doopen(id, xrow-row+1, xcol-col+1, row, col) == 0)
        wwsetcursor(WCurRow(cmdwin->ww_win), WCurCol(cmdwin->ww_win));
        if (doopen(id, xrow-row+1, xcol-col+1, row, col) == 0)
-               wwputs("Can't open window.  ", cmdwin);
+               if (terse)
+                       Ding();
+               else
+                       wwputs("Can't open window.  ", cmdwin);
 }
 
 findid()
 }
 
 findid()
@@ -67,7 +78,6 @@ findid()
        register id;
        char ids[10];
        register struct ww *w;
        register id;
        char ids[10];
        register struct ww *w;
-#define NWINDOW 9
 
        for (id = 1; id <= NWINDOW; id++)
                ids[id] = 0;
 
        for (id = 1; id <= NWINDOW; id++)
                ids[id] = 0;
@@ -131,7 +141,8 @@ register int *row, *col, minrow, mincol;
                case '\r':
                        return 1;
                default:
                case '\r':
                        return 1;
                default:
-                       wwputs("\r\nType [hjklHJKL] to move, return to enter position, escape to cancel.", cmdwin);
+                       if (!terse)
+                               wwputs("\r\nType [hjklHJKL] to move, return to enter position, escape to cancel.", cmdwin);
                        Ding();
                }
        }
                        Ding();
                }
        }
@@ -156,7 +167,7 @@ int id, nrow, ncol, row, col;
        wwflush();
        switch (wwfork(w)) {
        case -1:
        wwflush();
        switch (wwfork(w)) {
        case -1:
-               doclose(CLOSE_ONE, w);
+               doclose(w);
                return 0;
        case 0:
                execl("/bin/csh", "csh", 0);
                return 0;
        case 0:
                execl("/bin/csh", "csh", 0);
index 8a36262..a41c4f8 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)cmd2.c      1.7 83/07/28";
+static char *sccsid = "@(#)cmd2.c      1.8 83/07/28";
 #endif
 
 #include "defs.h"
 #endif
 
 #include "defs.h"
@@ -12,33 +12,41 @@ dohelp()
 {
        register struct ww *w;
 
 {
        register struct ww *w;
 
-       if ((w = openwin(wwncol - 1, "Help")) == 0) {
-               wwputs("Can't open help window.  ", cmdwin);
+       if ((w = openwin(wwnrow - 1, "Help")) == 0) {
+               if (terse)
+                       Ding();
+               else
+                       wwputs("Can't open help window.  ", cmdwin);
                return;
        }
                return;
        }
-       wwprintf(w, "The escape character is ^P, which gets you into command mode.\r\n");
-       wwprintf(w, "The commands are:\r\n");
-       wwprintf(w, "[1-9]   Select window [1-9] and exit command mode.\r\n");
-       wwprintf(w, "%%[1-9]  Select window [1-9].\r\n");
-       wwprintf(w, "c[1-9]  Close window [1-9].\r\n");
+       wwprintf(w, "The escape character is %s, which gets you into command mode.\r\n\n",
+               unctrl(escapec));
+       wwprintf(w, "Short commands:\r\n\n");
+       wwprintf(w, "{1-9}   Select window {1-9} and return to conversation mode.\r\n");
+       wwprintf(w, "%%{1-9}  Select window {1-9}.\r\n");
+       wwprintf(w, "c{1-9}  Close window {1-9}.\r\n");
        wwprintf(w, "C       Close all windows.\r\n");
        wwprintf(w, "S       Show all windows in sequence.\r\n");
        wwprintf(w, "C       Close all windows.\r\n");
        wwprintf(w, "S       Show all windows in sequence.\r\n");
-       wwprintf(w, "R       Force refresh after every newline (current window only).\r\n");
-       wwprintf(w, "r       Don't refresh every line.\r\n");
+       wwprintf(w, "L       List all windows with their labels.\r\n");
        wwprintf(w, "w       Open a new window.\r\n");
        wwprintf(w, "w       Open a new window.\r\n");
-       wwprintf(w, "^U      Scroll up.\r\n");
-       wwprintf(w, "^D      Scroll down.\r\n");
+       wwprintf(w, "[^U^D]  Scroll [up, down] half a window.\r\n");
+       wwprintf(w, "[^B^F]  Scroll [up, down] a full window.\r\n");
        wwprintf(w, "[hjkl]  Move cursor [left, down, up, right].\r\n");
        wwprintf(w, "[hjkl]  Move cursor [left, down, up, right].\r\n");
-       /*
-       wwprintf(w, "s       Print IO statistics.\r\n");
-       wwprintf(w, "t       Print resource usage of this program.\r\n");
-       wwprintf(w, "T       Print resource usage of children.\r\n");
-       */
        wwprintf(w, "escape  Exit command mode.\r\n");
        wwprintf(w, "^L      Redraw screen.\r\n");
        wwprintf(w, "^Z      Suspend.\r\n");
        wwprintf(w, ".       Quit.\r\n");
        waitnl(w);
        wwprintf(w, "escape  Exit command mode.\r\n");
        wwprintf(w, "^L      Redraw screen.\r\n");
        wwprintf(w, "^Z      Suspend.\r\n");
        wwprintf(w, ".       Quit.\r\n");
        waitnl(w);
+       wwprintf(w, "Long commands:\r\n\n");
+       wwprintf(w, ":terse [off]            Turn on (or off) terse mode.\r\n");
+       wwprintf(w, ":refresh {1-9} [off]    Turn on (or off) refresh after every newline\r\n");
+       wwprintf(w, "                        for window {1-9}.\r\n");
+       wwprintf(w, ":label {1-9} string     Label window {1-9}.\r\n");
+       wwprintf(w, ":escape c               Set escape character to c.\r\n");
+       wwprintf(w, ":%{1-9}                 Select window {1-9}.\r\n");
+       wwprintf(w, ":window r c nr nc       Open a window at row r column c\r\n");
+       wwprintf(w, "                        with nr rows and nc colomns\r\n");
+       waitnl(w);
        closewin(w);
 }
 
        closewin(w);
 }
 
@@ -49,7 +57,10 @@ dotime(flag)
        struct timeval timeval;
 
        if ((w = openwin(8, "Timing and Resource Usage")) == 0) {
        struct timeval timeval;
 
        if ((w = openwin(8, "Timing and Resource Usage")) == 0) {
-               wwputs("Can't open time window.  ", cmdwin);
+               if (terse)
+                       Ding();
+               else
+                       wwputs("Can't open time window.  ", cmdwin);
                return;
        }
 
                return;
        }
 
@@ -113,7 +124,10 @@ dostat()
        register struct ww *w;
 
        if ((w = openwin(6, "IO Statics")) == 0) {
        register struct ww *w;
 
        if ((w = openwin(6, "IO Statics")) == 0) {
-               wwputs("Can't open statistics window.  ", cmdwin);
+               if (terse)
+                       Ding();
+               else
+                       wwputs("Can't open statistics window.  ", cmdwin);
                return;
        }
        wwprintf(w, "nread\tnreadz\tnreade\tnreadc\tnwrite\tnwritec\r\n");
                return;
        }
        wwprintf(w, "nread\tnreadz\tnreade\tnreadc\tnwrite\tnwritec\r\n");
@@ -123,8 +137,35 @@ dostat()
        closewin(w);
 }
 
        closewin(w);
 }
 
+dolist()
+{
+       register struct ww *w, *w1;
+       int id;
+       char doneit = 0;
+
+       if ((w = openwin(14, "Active Windows")) == 0) {
+               if (terse)
+                       Ding();
+               else
+                       wwputs("Can't open listing window.  ", cmdwin);
+               return;
+       }
+       for (id = 1; id <= NWINDOW; id++) {
+               if ((w1 = wwfind(id)) == 0)
+                       continue;
+               doneit = 1;
+               wwprintf(w, "%d   %s\r\n", id, w1->ww_label);
+       }
+       if (!doneit)
+               wwprintf(w, "No windows.\r\n");
+       waitnl(w);
+       closewin(w);
+}
+
 doquit()
 {
 doquit()
 {
+       if (terse)
+               Wunhide(cmdwin->ww_win);
        wwputs("Really quit [yn]? ", cmdwin);
        wwsetcursor(WCurRow(cmdwin->ww_win), WCurCol(cmdwin->ww_win));
        while (bpeekc() < 0)
        wwputs("Really quit [yn]? ", cmdwin);
        wwsetcursor(WCurRow(cmdwin->ww_win), WCurCol(cmdwin->ww_win));
        while (bpeekc() < 0)
@@ -134,6 +175,8 @@ doquit()
                quit++;
        } else
                wwputs("\r\n", cmdwin);
                quit++;
        } else
                wwputs("\r\n", cmdwin);
+       if (terse)
+               Whide(cmdwin->ww_win);
 }
 
 struct ww *
 }
 
 struct ww *
@@ -141,11 +184,14 @@ openwin(nrow, label)
 char *label;
 {
        register struct ww *w;
 char *label;
 {
        register struct ww *w;
+       int startcol;
 
 
-       if ((w = wwopen(WW_NONE, 0, nrow, wwncol, 1, 0)) == 0)
+       if ((w = wwopen(WW_NONE, 0, nrow, wwncol, 0, 0)) == 0)
                return 0;
        wwframe(w);
                return 0;
        wwframe(w);
-       wwlabel(w, (wwncol - strlen(label)) / 2 + 1, label, WINVERSE);
+       if ((startcol = (wwncol - strlen(label)) / 2) <= 0)
+               startcol = 1;
+       wwlabel(w, startcol, label, WINVERSE);
        wwsetcurwin(w);
        return w;
 }
        wwsetcurwin(w);
        return w;
 }
@@ -158,6 +204,7 @@ register struct ww *w;
        wwsetcursor(WCurRow(w->ww_win), WCurCol(w->ww_win));
        while (bgetc() < 0)
                bread();
        wwsetcursor(WCurRow(w->ww_win), WCurCol(w->ww_win));
        while (bgetc() < 0)
                bread();
+       wwputs("\033E", w);                     /* clear and home cursor */
 }
 
 closewin(w)
 }
 
 closewin(w)
index 601549e..e17106b 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)cmd3.c      1.5 83/07/28";
+static char *sccsid = "@(#)cmd3.c      1.6 83/07/28";
 #endif
 
 #include "defs.h"
 #endif
 
 #include "defs.h"
@@ -46,6 +46,7 @@ register struct ww *w;
                reframe();
 }
 
                reframe();
 }
 
+/*
 doescape()
 {
        char buf[2];
 doescape()
 {
        char buf[2];
@@ -58,6 +59,7 @@ doescape()
        setescape(buf);
        wwputs("\r\n", cmdwin);
 }
        setescape(buf);
        wwputs("\r\n", cmdwin);
 }
+*/
 
 setescape(esc)
 register char *esc;
 
 setescape(esc)
 register char *esc;
@@ -71,6 +73,7 @@ register char *esc;
                escapec = *esc;
 }
 
                escapec = *esc;
 }
 
+/*
 dolabel()
 {
        register struct ww *w;
 dolabel()
 {
        register struct ww *w;
@@ -84,6 +87,7 @@ dolabel()
        setlabel(w, buf);
        wwputs("\r\n", cmdwin);
 }
        setlabel(w, buf);
        wwputs("\r\n", cmdwin);
 }
+*/
 
 setlabel(w, label)
 register struct ww *w;
 
 setlabel(w, label)
 register struct ww *w;
index c04f357..c038b67 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)cmd4.c      1.3 83/07/22";
+static char *sccsid = "@(#)cmd4.c      1.4 83/07/28";
 #endif
 
 #include "defs.h"
 #endif
 
 #include "defs.h"
@@ -8,7 +8,7 @@ struct ww *getwin();
 struct ww *openwin();
 char *strtime();
 
 struct ww *openwin();
 char *strtime();
 
-doquery()
+doshow()
 {
        register i;
        register struct ww *w = 0;
 {
        register i;
        register struct ww *w = 0;
@@ -32,7 +32,10 @@ doquery()
                                bread();
                                continue;
                        default:
                                bread();
                                continue;
                        default:
-                               wwputs("\rType return to continue, escape to select.", cmdwin);
+                               if (terse)
+                                       Ding();
+                               else
+                                       wwputs("\rType return to continue, escape to select.", cmdwin);
                                wwsetcurwin(cmdwin);
                                Ding();
                                continue;
                                wwsetcurwin(cmdwin);
                                Ding();
                                continue;
@@ -41,10 +44,26 @@ doquery()
                }
        }
 out:
                }
        }
 out:
-       if (!done_it)
-               wwputs("No windows.  ", cmdwin);
-       else {
+       if (!done_it) {
+               if (!terse)
+                       wwputs("No windows.  ", cmdwin);
+       } else {
                wwsetcurwin(cmdwin);
                wwsetcurwin(cmdwin);
-               wwputs("\r\n", cmdwin);
+               if (!terse)
+                       wwputs("\r\n", cmdwin);
        }
 }
        }
 }
+
+docolon()
+{
+       char buf[512];
+
+       if (terse)
+               Wunhide(cmdwin->ww_win);
+       wwputc(':', cmdwin);
+       bgets(buf, wwncol - 3, cmdwin);
+       wwputs("\r\n", cmdwin);
+       if (terse)
+               Whide(cmdwin->ww_win);
+       dolongcmd(buf);
+}
index 28223ee..62d701f 100644 (file)
@@ -1,25 +1,23 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)cmd5.c      1.5 83/07/28";
+static char *sccsid = "@(#)cmd5.c      1.6 83/07/28";
 #endif
 
 #include "defs.h"
 
 #endif
 
 #include "defs.h"
 
-struct ww *openwin();
 struct ww *doopen();
 struct ww *idtowin();
 
 struct ww *doopen();
 struct ww *idtowin();
 
-static char *sourcefilename;
-static int lineno;                     /* current line number in source file */
+int lineno;                            /* current line number in source file */
 static char *argv[100];                        /* one line broken up into words */
 static int argc;
 static char *argv[100];                        /* one line broken up into words */
 static int argc;
-static struct ww *errwin;              /* window for error reporting */
-static int errlineno;                  /* lineno in errwin */
-static char baderrwin;                 /* can't open errwin */
 
 int s_window();
 int s_select();
 int s_escape();
 int s_label();
 
 int s_window();
 int s_select();
 int s_escape();
 int s_label();
+int s_terse();
+int s_refresh();
+
 struct scmd {
        char *s_name;                   /* name of command */
        int s_len;                      /* number of characters to check */
 struct scmd {
        char *s_name;                   /* name of command */
        int s_len;                      /* number of characters to check */
@@ -32,6 +30,8 @@ static struct scmd scmd[] = {
        "%",            1, 0, 0, s_select,
        "escape",       1, 1, 1, s_escape,
        "label",        1, 2, 2, s_label,
        "%",            1, 0, 0, s_select,
        "escape",       1, 1, 1, s_escape,
        "label",        1, 2, 2, s_label,
+       "terse",        1, 0, 1, s_terse,
+       "refresh",      1, 1, 2, s_refresh,
        0
 };
 
        0
 };
 
@@ -45,12 +45,12 @@ char *filename;
                return;
        beginerror(filename);
        for (lineno = 1; fgets(buf, sizeof buf, f) != 0; lineno++)
                return;
        beginerror(filename);
        for (lineno = 1; fgets(buf, sizeof buf, f) != 0; lineno++)
-               doline(buf);
+               dolongcmd(buf);
        enderror();
        return 0;
 }
 
        enderror();
        return 0;
 }
 
-doline(line)
+dolongcmd(line)
 char *line;
 {
        register struct scmd *sp;
 char *line;
 {
        register struct scmd *sp;
@@ -76,74 +76,6 @@ char *line;
                error("%s: Unknown command.", *argv);
 }
 
                error("%s: Unknown command.", *argv);
 }
 
-s_window()
-{
-       register char **pp = argv;
-       register struct ww *w;
-       int col, row, ncol, nrow, id;
-
-       if ((id = findid()) < 0) {
-               error("Too many windows.");
-               return;
-       }
-       if (**++pp == '*')
-               row = 0;
-       else
-               row = atoi(*pp);
-       if (**++pp == '*')
-               col = 0;
-       else
-               col = atoi(*pp);
-       if (**++pp == '*')
-               nrow = wwnrow - row;
-       else
-               nrow = atoi(*pp);
-       if (**++pp == '*')
-               ncol = wwncol - col;
-       else
-               ncol = atoi(*pp);
-       w = doopen(id, nrow, ncol, row, col);
-       if (w == 0)
-               error("Can't open window: row %d col %d, %d rows %d cols.",
-                       row, col, nrow, ncol);
-}
-
-s_select()
-{
-       struct ww *w;
-
-       if ((w = idtowin(*argv + 1)) == 0)
-               return;
-       setselwin(w);
-}
-
-s_escape()
-{
-       setescape(argv[1]);
-}
-
-s_label()
-{
-       struct ww *w;
-
-       if ((w = idtowin(argv[1])) == 0)
-               return;
-       setlabel(w, argv[2]);
-}
-
-struct ww *
-idtowin(idstr)
-char *idstr;
-{
-       int id;
-       struct ww *w = 0;
-
-       id = atoi(idstr);
-       if (id < 1 || id > 9 || (w = wwfind(id)) == 0)
-               error("%d: No such window.", id);
-       return w;
-}
-
 makeargv(p)
 register char *p;
 {
 makeargv(p)
 register char *p;
 {
@@ -204,51 +136,98 @@ register char *p;
        argc = pp - argv;
 }
 
        argc = pp - argv;
 }
 
-/*VARARGS1*/
-static
-error(fmt, a, b, c, d, e, f, g, h)
-char *fmt;
+s_window()
 {
 {
-       if (sourcefilename == 0) {
-               wwprintf(cmdwin, fmt, a, b, c, d, e, f, g, h);
-               wwprintf(cmdwin, ".  ");
+       register char **pp = argv;
+       register struct ww *w;
+       int col, row, ncol, nrow, id;
+
+       if ((id = findid()) < 0) {
+               error("Too many windows.");
                return;
        }
                return;
        }
-#define ERRLINES 10
-       if (errwin == 0 && !baderrwin) {
-               char buf[512];
-
-               (void) sprintf(buf, "Errors from %s", sourcefilename);
-               if ((errwin = openwin(ERRLINES, buf)) == 0) {
-                       wwprintf(cmdwin, "Can't open error window.  ");
-                       baderrwin++;
-                       return;
-               }
-               errlineno = 0;
-       }
-       if (errlineno++ > ERRLINES - 4) {
-               waitnl(errwin);
-               wwprintf(errwin, "\r\n");
-               errlineno = 0;
-       }
-       wwprintf(errwin, "line %d: ", lineno);
-       wwprintf(errwin, fmt, a, b, c, d, e, f, g, h);
-       wwprintf(errwin, "\r\n");
+       if (**++pp == '*')
+               row = 0;
+       else
+               row = atoi(*pp);
+       if (**++pp == '*')
+               col = 0;
+       else
+               col = atoi(*pp);
+       if (**++pp == '*')
+               nrow = wwnrow - row;
+       else
+               nrow = atoi(*pp);
+       if (**++pp == '*')
+               ncol = wwncol - col;
+       else
+               ncol = atoi(*pp);
+       w = doopen(id, nrow, ncol, row, col);
+       if (w == 0)
+               error("Can't open window: row %d col %d, %d rows %d cols.",
+                       row, col, nrow, ncol);
 }
 
 }
 
-beginerror(filename)
-char *filename;
+s_select()
 {
 {
-       sourcefilename = filename;
+       struct ww *w;
+
+       if ((w = idtowin(*argv + 1)) == 0)
+               return;
+       setselwin(w);
 }
 
 }
 
-enderror()
+s_escape()
 {
 {
-       if (errwin != 0) {
-               waitnl(errwin);
-               closewin(errwin);
-               errwin = 0;
-       } else
-               baderrwin = 0;
-       sourcefilename = 0;
+       setescape(argv[1]);
+}
+
+s_label()
+{
+       struct ww *w;
+
+       if ((w = idtowin(argv[1])) == 0)
+               return;
+       setlabel(w, argv[2]);
+}
+
+s_terse()
+{
+       if (argc < 2)
+               terse = 1;
+       else if (strcmp(argv[1], "off") == 0)
+               terse = 0;
+       else
+               terse = 1;
+       if (terse)
+               Whide(cmdwin->ww_win);
+       else
+               Wunhide(cmdwin->ww_win);
+}
+
+s_refresh()
+{
+       struct ww *w;
+
+       if ((w = idtowin(argv[1])) == 0)
+               return;
+       if (argc < 3)
+               w->ww_refresh = 1;
+       else if (strcmp(argv[2], "off") == 0)
+               w->ww_refresh = 0;
+       else
+               w->ww_refresh = 1;
+}
+
+struct ww *
+idtowin(idstr)
+char *idstr;
+{
+       int id;
+       struct ww *w = 0;
+
+       id = atoi(idstr);
+       if (id < 1 || id > 9 || (w = wwfind(id)) == 0)
+               error("%d: No such window.", id);
+       return w;
 }
 }