added "more" command
[unix-history] / usr / src / usr.bin / window / cmd5.c
index 8a24b55..23fb50e 100644 (file)
@@ -1,7 +1,13 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)cmd5.c      3.7 83/09/15";
+static char sccsid[] = "@(#)cmd5.c     3.14 %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"
 
 /*
@@ -16,6 +22,8 @@ register struct ww *w;
        int maxcol, maxrow;
        int curcol, currow;
 
        int maxcol, maxrow;
        int curcol, currow;
 
+       if (!terse)
+               wwputs("New window position: ", cmdwin);
        col = w->ww_w.l;
        row = w->ww_w.t;
        wwadd(boxwin, framewin->ww_back);
        col = w->ww_w.l;
        row = w->ww_w.t;
        wwadd(boxwin, framewin->ww_back);
@@ -26,17 +34,18 @@ register struct ww *w;
                getminmax(col, w->ww_w.nc, 0, wwncol,
                        &curcol, &mincol, &maxcol);
                wwsetcursor(currow, curcol);
                getminmax(col, w->ww_w.nc, 0, wwncol,
                        &curcol, &mincol, &maxcol);
                wwsetcursor(currow, curcol);
-               while (bpeekc() < 0)
-                       bread();
-               wwunbox(boxwin);
+               while (wwpeekc() < 0)
+                       wwiomux();
                switch (getpos(&row, &col, minrow, mincol, maxrow, maxcol)) {
                switch (getpos(&row, &col, minrow, mincol, maxrow, maxcol)) {
-               case -1:
+               case 3:
+                       wwunbox(boxwin);
                        wwdelete(boxwin);
                        wwdelete(boxwin);
-                       if (!terse)
-                               (void) wwputs("\r\nCancelled.  ", cmdwin);
                        return;
                        return;
-               case 1:
+               case 2:
+                       wwunbox(boxwin);
                        break;
                        break;
+               case 1:
+                       wwunbox(boxwin);
                case 0:
                        continue;
                }
                case 0:
                        continue;
                }
@@ -44,7 +53,7 @@ register struct ww *w;
        }
        wwdelete(boxwin);
        if (!terse)
        }
        wwdelete(boxwin);
        if (!terse)
-               (void) wwputs("\r\n", cmdwin);
+               wwputc('\n', cmdwin);
        wwcurtowin(cmdwin);
        movewin(w, row, col);
 }
        wwcurtowin(cmdwin);
        movewin(w, row, col);
 }
@@ -54,8 +63,8 @@ register struct ww *w;
 {
        struct ww *back = w->ww_back;
 
 {
        struct ww *back = w->ww_back;
 
-       w->ww_altpos.r = w->ww_w.t;
-       w->ww_altpos.c = w->ww_w.l;
+       w->ww_alt.t = w->ww_w.t;
+       w->ww_alt.l = w->ww_w.l;
        wwdelete(w);
        wwmove(w, row, col);
        wwadd(w, back);
        wwdelete(w);
        wwmove(w, row, col);
        wwadd(w, back);