2 * Copyright (c) 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 * Copyright (c) 1993, 1994, 1995, 1996
5 * Keith Bostic. All rights reserved.
7 * See the LICENSE file for redistribution information.
13 static const char sccsid
[] = "$Id: ex_screen.c,v 10.11 1996/06/29 12:27:15 bostic Exp $ (Berkeley) $Date: 1996/06/29 12:27:15 $";
16 #include <sys/types.h>
17 #include <sys/queue.h>
20 #include <bitstring.h>
26 #include "../common/common.h"
33 * PUBLIC: int ex_bg __P((SCR *, EXCMD *));
47 * PUBLIC: int ex_fg __P((SCR *, EXCMD *));
57 newscreen
= F_ISSET(cmdp
, E_NEWSCREEN
);
58 if (vs_fg(sp
, &nsp
, cmdp
->argc
? cmdp
->argv
[0]->bp
: NULL
, newscreen
))
61 /* Set up the switch. */
64 F_SET(sp
, SC_SSWITCH
);
70 * ex_resize -- :resize [+-]rows
71 * Change the screen size.
73 * PUBLIC: int ex_resize __P((SCR *, EXCMD *));
82 switch (FL_ISSET(cmdp
->iflags
,
83 E_C_COUNT
| E_C_COUNT_NEG
| E_C_COUNT_POS
)) {
87 case E_C_COUNT
| E_C_COUNT_NEG
:
90 case E_C_COUNT
| E_C_COUNT_POS
:
94 ex_emsg(sp
, cmdp
->cmd
->usage
, EXM_USAGE
);
97 return (vs_resize(sp
, cmdp
->count
, adj
));
102 * Display the list of screens.
104 * PUBLIC: int ex_sdisplay __P((SCR *));
112 int cnt
, col
, len
, sep
;
115 if ((tsp
= gp
->hq
.cqh_first
) == (void *)&gp
->hq
) {
116 msgq(sp
, M_INFO
, "149|No background screens to display");
121 for (cnt
= 1; tsp
!= (void *)&gp
->hq
&& !INTERRUPTED(sp
);
122 tsp
= tsp
->q
.cqe_next
) {
123 col
+= len
= strlen(tsp
->frp
->name
) + sep
;
124 if (col
>= sp
->cols
- 1) {
127 (void)ex_puts(sp
, "\n");
128 } else if (cnt
!= 1) {
130 (void)ex_puts(sp
, " ");
132 (void)ex_puts(sp
, tsp
->frp
->name
);
135 if (!INTERRUPTED(sp
))
136 (void)ex_puts(sp
, "\n");