added "more" command
[unix-history] / usr / src / usr.bin / window / cmd1.c
index 5beb4e7..0962c4b 100644 (file)
@@ -1,8 +1,15 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)cmd1.c      3.19 84/01/13";
+static char sccsid[] = "@(#)cmd1.c     3.29 %G%";
 #endif
 
 #endif
 
+/*
+ * Copyright (c) 1983 Regents of the University of California,
+ * All rights reserved.  Redistribution permitted subject to
+ * the terms of the Berkeley Software License Agreement.
+ */
+
 #include "defs.h"
 #include "defs.h"
+#include "char.h"
 
 c_window()
 {
 
 c_window()
 {
@@ -12,15 +19,15 @@ c_window()
        if ((id = findid()) < 0)
                return;
        if (!terse)
        if ((id = findid()) < 0)
                return;
        if (!terse)
-               (void) wwputs("Upper left corner: ", cmdwin);
+               wwputs("New window (upper left corner): ", cmdwin);
        col = 0;
        row = 1;
        wwadd(boxwin, framewin->ww_back);
        for (;;) {
                wwbox(boxwin, row - 1, col - 1, 3, 3);
                wwsetcursor(row, col);
        col = 0;
        row = 1;
        wwadd(boxwin, framewin->ww_back);
        for (;;) {
                wwbox(boxwin, row - 1, col - 1, 3, 3);
                wwsetcursor(row, col);
-               while (bpeekc() < 0)
-                       bread();
+               while (wwpeekc() < 0)
+                       wwiomux();
                switch (getpos(&row, &col, row > 1, 0,
                        wwnrow - 1, wwncol - 1)) {
                case 3:
                switch (getpos(&row, &col, row > 1, 0,
                        wwnrow - 1, wwncol - 1)) {
                case 3:
@@ -38,7 +45,7 @@ c_window()
                break;
        }
        if (!terse)
                break;
        }
        if (!terse)
-               (void) wwputs("\r\nLower right corner: ", cmdwin);
+               wwputs("\nNew window (lower right corner): ", cmdwin);
        xcol = col;
        xrow = row;
        for (;;) {
        xcol = col;
        xrow = row;
        for (;;) {
@@ -46,8 +53,8 @@ c_window()
                        xrow - row + 3, xcol - col + 3);
                wwsetcursor(xrow, xcol);
                wwflush();
                        xrow - row + 3, xcol - col + 3);
                wwsetcursor(xrow, xcol);
                wwflush();
-               while (bpeekc() < 0)
-                       bread();
+               while (wwpeekc() < 0)
+                       wwiomux();
                switch (getpos(&xrow, &xcol, row, col, wwnrow - 1, wwncol - 1))
                {
                case 3:
                switch (getpos(&xrow, &xcol, row, col, wwnrow - 1, wwncol - 1))
                {
                case 3:
@@ -66,10 +73,10 @@ c_window()
        }
        wwdelete(boxwin);
        if (!terse)
        }
        wwdelete(boxwin);
        if (!terse)
-               (void) wwputs("\r\n", cmdwin);
+               wwputc('\n', cmdwin);
        wwcurtowin(cmdwin);
        (void) openwin(id, row, col, xrow-row+1, xcol-col+1, nbufline,
        wwcurtowin(cmdwin);
        (void) openwin(id, row, col, xrow-row+1, xcol-col+1, nbufline,
-               (char *) 0);
+               (char *) 0, 1, 1, shellfile, shell);
 }
 
 getpos(row, col, minrow, mincol, maxrow, maxcol)
 }
 
 getpos(row, col, minrow, mincol, maxrow, maxcol)
@@ -77,12 +84,12 @@ register int *row, *col;
 int minrow, mincol;
 int maxrow, maxcol;
 {
 int minrow, mincol;
 int maxrow, maxcol;
 {
-       static int scount = 0;
+       static int scount;
        int count;
        char c;
        int oldrow = *row, oldcol = *col;
 
        int count;
        char c;
        int oldrow = *row, oldcol = *col;
 
-       while ((c = bgetc()) >= 0) {
+       while ((c = wwgetc()) >= 0) {
                switch (c) {
                case '0': case '1': case '2': case '3': case '4':
                case '5': case '6': case '7': case '8': case '9':
                switch (c) {
                case '0': case '1': case '2': case '3': case '4':
                case '5': case '6': case '7': case '8': case '9':
@@ -120,15 +127,15 @@ int maxrow, maxcol;
                case 'K':
                        *row = minrow;
                        break;
                case 'K':
                        *row = minrow;
                        break;
-               case CTRL([):
+               case ctrl([):
                        if (!terse)
                        if (!terse)
-                               (void) wwputs("\r\nCancelled.  ", cmdwin);
+                               wwputs("\nCanceled.  ", cmdwin);
                        return 3;
                case '\r':
                        return 2;
                default:
                        if (!terse)
                        return 3;
                case '\r':
                        return 2;
                default:
                        if (!terse)
-                               (void) wwputs("\r\nType [hjklHJKL] to move, return to enter position, escape to cancel.", cmdwin);
+                               wwputs("\nType [hjklHJKL] to move, return to enter position, escape to cancel.", cmdwin);
                        wwbell();
                }
        }
                        wwbell();
                }
        }