1 /* $NetBSD: ex_screen.c,v 1.1.1.2 2008/05/18 14:31:17 aymeric Exp $ */
4 * Copyright (c) 1993, 1994
5 * The Regents of the University of California. All rights reserved.
6 * Copyright (c) 1993, 1994, 1995, 1996
7 * Keith Bostic. All rights reserved.
9 * See the LICENSE file for redistribution information.
15 static const char sccsid
[] = "Id: ex_screen.c,v 10.12 2001/06/25 15:19:19 skimo Exp (Berkeley) Date: 2001/06/25 15:19:19";
18 #include <sys/types.h>
19 #include <sys/queue.h>
22 #include <bitstring.h>
28 #include "../common/common.h"
35 * PUBLIC: int ex_bg __P((SCR *, EXCMD *));
38 ex_bg(SCR
*sp
, EXCMD
*cmdp
)
47 * PUBLIC: int ex_fg __P((SCR *, EXCMD *));
50 ex_fg(SCR
*sp
, EXCMD
*cmdp
)
55 newscreen
= F_ISSET(cmdp
, E_NEWSCREEN
);
56 if (vs_fg(sp
, &nsp
, cmdp
->argc
? cmdp
->argv
[0]->bp
: NULL
, newscreen
))
59 /* Set up the switch. */
62 F_SET(sp
, SC_SSWITCH
);
68 * ex_resize -- :resize [+-]rows
69 * Change the screen size.
71 * PUBLIC: int ex_resize __P((SCR *, EXCMD *));
74 ex_resize(SCR
*sp
, EXCMD
*cmdp
)
78 switch (FL_ISSET(cmdp
->iflags
,
79 E_C_COUNT
| E_C_COUNT_NEG
| E_C_COUNT_POS
)) {
83 case E_C_COUNT
| E_C_COUNT_NEG
:
86 case E_C_COUNT
| E_C_COUNT_POS
:
90 ex_emsg(sp
, cmdp
->cmd
->usage
, EXM_USAGE
);
93 return (vs_resize(sp
, cmdp
->count
, adj
));
98 * Display the list of screens.
100 * PUBLIC: int ex_sdisplay __P((SCR *));
111 if ((tsp
= gp
->hq
.cqh_first
) == (void *)&gp
->hq
) {
112 msgq(sp
, M_INFO
, "149|No background screens to display");
117 for (cnt
= 1; tsp
!= (void *)&gp
->hq
&& !INTERRUPTED(sp
);
118 tsp
= tsp
->q
.cqe_next
) {
119 col
+= len
= strlen(tsp
->frp
->name
) + sep
;
120 if (col
>= sp
->cols
- 1) {
123 (void)ex_puts(sp
, "\n");
124 } else if (cnt
!= 1) {
126 (void)ex_puts(sp
, " ");
128 (void)ex_puts(sp
, tsp
->frp
->name
);
131 if (!INTERRUPTED(sp
))
132 (void)ex_puts(sp
, "\n");