written by Edward Wang; attach Berkeley specific copyright
[unix-history] / usr / src / usr.bin / window / cmd4.c
index 3ad5282..b2bfefe 100644 (file)
@@ -1,73 +1,32 @@
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that this notice is preserved and that due credit is given
+ * to the University of California at Berkeley. The name of the University
+ * may not be used to endorse or promote products derived from this
+ * software without specific prior written permission. This software
+ * is provided ``as is'' without express or implied warranty.
+ */
+
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)cmd4.c      3.6 83/12/02";
-#endif
+static char sccsid[] = "@(#)cmd4.c     3.15 (Berkeley) %G%";
+#endif /* not lint */
 
 #include "defs.h"
 
 
 #include "defs.h"
 
-c_show()
-{
-       register i;
-       register struct ww *w = 0;
-       char done_it = 0;
-
-       for (i = 0; i < NWINDOW; i++) {
-               if ((w = window[i]) == 0)
-                       continue;
-               done_it++;
-               if (!terse && cmdwin->ww_order < framewin->ww_order) {
-                       wwdelete(cmdwin);
-                       wwadd(cmdwin, framewin);
-               }
-               front(w, 0);
-               wwsetcursor(w->ww_w.t - 1, w->ww_w.l + 1);
-               for (;;) {
-                       switch (bgetc()) {
-                       case '\r':
-                       case '\n':
-                               break;
-                       case CTRL([):
-                               setselwin(w);
-                               goto out;
-                       case -1:
-                               bread();
-                               continue;
-                       default:
-                               wwbell();
-                               if (!terse) {
-                                       (void) wwputs("\rType return to continue, escape to select.", cmdwin);
-                                       wwdelete(cmdwin);
-                                       wwadd(cmdwin, &wwhead);
-                               }
-                               continue;
-                       }
-                       break;
-               }
-       }
-out:
-       if (!done_it) {
-               error("No windows.");
-       } else {
-               if (!terse) {
-                       wwdelete(cmdwin);
-                       wwadd(cmdwin, &wwhead);
-                       (void) wwputs("\r\n", cmdwin);
-               }
-       }
-}
-
 c_colon()
 {
 c_colon()
 {
+       char oldterse = terse;
        char buf[512];
 
        char buf[512];
 
-       if (terse)
-               wwadd(cmdwin, &wwhead);
-       (void) wwputc(':', cmdwin);
-       bgets(buf, wwncol - 3, cmdwin);
-       (void) wwputs("\r\n", cmdwin);
-       if (terse)
-               wwdelete(cmdwin);
-       else
-               wwcurtowin(cmdwin);
-       if (dolongcmd(buf) < 0)
+       setterse(0);
+       wwputc(':', cmdwin);
+       wwgets(buf, wwncol - 3, cmdwin);
+       wwputc('\n', cmdwin);
+       wwcurtowin(cmdwin);
+       setterse(oldterse);
+       if (dolongcmd(buf, (struct value *)0, 0) < 0)
                error("Out of memory.");
 }
                error("Out of memory.");
 }