read on closed socketpair returns eof
[unix-history] / usr / src / usr.bin / window / cmd2.c
index 8907b32..7cac446 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)cmd2.c      3.25 84/04/05";
+static char sccsid[] = "@(#)cmd2.c     3.30 %G%";
 #endif
 
 #include "defs.h"
 #endif
 
 #include "defs.h"
@@ -7,18 +7,12 @@ static        char *sccsid = "@(#)cmd2.c      3.25 84/04/05";
 char *help_shortcmd[] = {
        "{1-9}   Select window {1-9} and return to conversation mode.",
        "%{1-9}  Select window {1-9} but stay in command mode.",
 char *help_shortcmd[] = {
        "{1-9}   Select window {1-9} and return to conversation mode.",
        "%{1-9}  Select window {1-9} but stay in command mode.",
-       "escape  Return to conversation mode",
-       "        and don't change the current window.",
-       "^^      Return to conversation mode",
-       "        and change to previously selected window.",
+       "escape  Return to conversation mode without changing window.",
+       "^^      Return to conversation mode and change to previous window.",
        "c{1-9}  Close window {1-9}.",
        "c{1-9}  Close window {1-9}.",
-       "C       Close all windows.",
-       "S       Show all windows in sequence.",
-       "L       List all windows with their labels.",
        "w       Open a new window.",
        "m{1-9}  Move window {1-9}.",
        "M{1-9}  Move window {1-9} to previous position.",
        "w       Open a new window.",
        "m{1-9}  Move window {1-9}.",
        "M{1-9}  Move window {1-9} to previous position.",
-       "v       List all variables.",
        "{^Y^E}  Scroll {up, down} one line",
        "{^U^D}  Scroll {up, down} half a window.",
        "{^B^F}  Scroll {up, down} a full window.",
        "{^Y^E}  Scroll {up, down} one line",
        "{^U^D}  Scroll {up, down} half a window.",
        "{^B^F}  Scroll {up, down} a full window.",
@@ -30,19 +24,27 @@ char *help_shortcmd[] = {
 };
 char *help_longcmd[] = {
        ":%{1-9}               Select window {1-9}.",
 };
 char *help_longcmd[] = {
        ":%{1-9}               Select window {1-9}.",
-       ":buffer lines         Set the default window buffer size.",
-       ":close {1-9}          Close window.",
+       ":close {1-9} . . .    Close windows.",
+       ":close all            Close all windows.",
        ":cursor modes         Set the cursor modes.",
        ":escape C             Set escape character to C.",
        ":cursor modes         Set the cursor modes.",
        ":escape C             Set escape character to C.",
+       ":foreground {1-9} [off]",
+       "                      Make {1-9} a foreground window.",
        ":label {1-9} string   Label window {1-9}.",
        ":label {1-9} string   Label window {1-9}.",
-       ":source filename      Execute commands in ``filename''.",
+       ":list                 List all windows.",
+       ":nline lines          Set the default number of lines",
+       "                      in window text buffers.",
+       ":shell string         Set default shell program to ``string.''",
+       ":source filename      Execute commands in ``filename.''",
        ":terse [off]          Turn on (or off) terse mode.",
        ":unset variable       Deallocate ``variable''.",
        ":terse [off]          Turn on (or off) terse mode.",
        ":unset variable       Deallocate ``variable''.",
-       ":window row col nrow ncol [nline label]",
+       ":variable             List all variables.",
+       ":window row col nrow ncol [nline label pty frame shell]",
        "                      Open a window at ``row'', ``col''",
        "                      of size ``nrow'', ``ncol'',",
        "                      with ``nline'', and ``label''.",
        "                      Open a window at ``row'', ``col''",
        "                      of size ``nrow'', ``ncol'',",
        "                      with ``nline'', and ``label''.",
-       ":write {1-9} string   Write ``string'' to window {1-9}.",
+       ":write {1-9} string . . .",
+       "                      Write strings to window {1-9}.",
        0
 };
 
        0
 };
 
@@ -54,8 +56,8 @@ c_help()
                error("Can't open help window: %s.", wwerror());
                return;
        }
                error("Can't open help window: %s.", wwerror());
                return;
        }
-       wwprintf(w, "The escape character is %s, which gets you into command mode.\n\n",
-               unctrl(escapec));
+       wwprintf(w, "The escape character is %c, which gets you into command mode.\n\n",
+               escapec);
        if (help_print(w, "Short commands", help_shortcmd) >= 0)
                (void) help_print(w, "Long commands", help_longcmd);
        closeiwin(w);
        if (help_print(w, "Short commands", help_shortcmd) >= 0)
                (void) help_print(w, "Long commands", help_longcmd);
        closeiwin(w);
@@ -82,37 +84,6 @@ register char **list;
        return more(w, 1) == 2 ? -1 : 0;
 }
 
        return more(w, 1) == 2 ? -1 : 0;
 }
 
-c_list()
-{
-       register struct ww *w, *wp;
-       register i;
-       int n;
-
-       for (n = 0, i = 0; i < NWINDOW; i++)
-               if (window[i] != 0)
-                       n++;
-       if (n == 0) {
-               error("No windows.");
-               return;
-       }
-       if ((w = openiwin(n + 2, "Windows")) == 0) {
-               error("Can't open listing window: %s.", wwerror());
-               return;
-       }
-       for (i = 0; i < NWINDOW; i++) {
-               if ((wp = window[i]) == 0)
-                       continue;
-               wwprintf(w, "%c %c %-13s %-.*s\n",
-                       wp == selwin ? '*' : ' ',
-                       i + '1',
-                       wp->ww_state == WWS_HASPROC ? "" : "(No process)",
-                       wwncol - 20,
-                       wp->ww_label ? wp->ww_label : "(No label)");
-       }
-       waitnl(w);
-       closeiwin(w);
-}
-
 c_quit()
 {
        char oldterse = terse;
 c_quit()
 {
        char oldterse = terse;
@@ -126,6 +97,6 @@ c_quit()
                wwputs("Yes", cmdwin);
                quit++;
        } else
                wwputs("Yes", cmdwin);
                quit++;
        } else
-               wwputs("\r\n", cmdwin);
+               wwputc('\n', cmdwin);
        setterse(!quit && oldterse);
 }
        setterse(!quit && oldterse);
 }