added "more" command
[unix-history] / usr / src / usr.bin / window / cmd7.c
CommitLineData
2e16e1ff 1#ifndef lint
60de5df9 2static char sccsid[] = "@(#)cmd7.c 3.3 %G%";
2e16e1ff
EW
3#endif
4
60de5df9
EW
5/*
6 * Copyright (c) 1983 Regents of the University of California,
7 * All rights reserved. Redistribution permitted subject to
8 * the terms of the Berkeley Software License Agreement.
9 */
10
2e16e1ff
EW
11#include "defs.h"
12
13/*
14 * Window size.
15 */
16
17c_size(w)
18register struct ww *w;
19{
20 int col, row;
21
22 if (!terse)
23 wwputs("New window size (lower right corner): ", cmdwin);
24 col = MIN(w->ww_w.r, wwncol) - 1;
25 row = MIN(w->ww_w.b, wwnrow) - 1;
26 wwadd(boxwin, framewin->ww_back);
27 for (;;) {
28 wwbox(boxwin, w->ww_w.t - 1, w->ww_w.l - 1,
29 row - w->ww_w.t + 3, col - w->ww_w.l + 3);
30 wwsetcursor(row, col);
31 while (wwpeekc() < 0)
32 wwiomux();
33 switch (getpos(&row, &col, w->ww_w.t, w->ww_w.l,
34 wwnrow - 1, wwncol - 1)) {
35 case 3:
36 wwunbox(boxwin);
37 wwdelete(boxwin);
38 return;
39 case 2:
40 wwunbox(boxwin);
41 break;
42 case 1:
43 wwunbox(boxwin);
44 case 0:
45 continue;
46 }
47 break;
48 }
49 wwdelete(boxwin);
50 if (!terse)
51 wwputc('\n', cmdwin);
52 wwcurtowin(cmdwin);
53 sizewin(w, row - w->ww_w.t + 1, col - w->ww_w.l + 1);
54}