1 /* $NetBSD: ex_screen.c,v 1.3 2013/11/25 22:43:46 christos Exp $ */
3 * Copyright (c) 1993, 1994
4 * The Regents of the University of California. All rights reserved.
5 * Copyright (c) 1993, 1994, 1995, 1996
6 * Keith Bostic. All rights reserved.
8 * See the LICENSE file for redistribution information.
14 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 ";
17 #include <sys/types.h>
18 #include <sys/queue.h>
21 #include <bitstring.h>
27 #include "../common/common.h"
34 * PUBLIC: int ex_bg __P((SCR *, EXCMD *));
37 ex_bg(SCR
*sp
, EXCMD
*cmdp
)
46 * PUBLIC: int ex_fg __P((SCR *, EXCMD *));
49 ex_fg(SCR
*sp
, EXCMD
*cmdp
)
54 newscreen
= F_ISSET(cmdp
, E_NEWSCREEN
);
55 if (vs_fg(sp
, &nsp
, cmdp
->argc
? cmdp
->argv
[0]->bp
: NULL
, newscreen
))
58 /* Set up the switch. */
61 F_SET(sp
, SC_SSWITCH
);
67 * ex_resize -- :resize [+-]rows
68 * Change the screen size.
70 * PUBLIC: int ex_resize __P((SCR *, EXCMD *));
73 ex_resize(SCR
*sp
, EXCMD
*cmdp
)
77 switch (FL_ISSET(cmdp
->iflags
,
78 E_C_COUNT
| E_C_COUNT_NEG
| E_C_COUNT_POS
)) {
82 case E_C_COUNT
| E_C_COUNT_NEG
:
85 case E_C_COUNT
| E_C_COUNT_POS
:
89 ex_emsg(sp
, cmdp
->cmd
->usage
, EXM_USAGE
);
92 return (vs_resize(sp
, cmdp
->count
, adj
));
97 * Display the list of screens.
99 * PUBLIC: int ex_sdisplay __P((SCR *));
110 if ((tsp
= TAILQ_FIRST(&gp
->hq
)) == NULL
) {
111 msgq(sp
, M_INFO
, "149|No background screens to display");
116 for (cnt
= 1; tsp
!= NULL
&& !INTERRUPTED(sp
);
117 tsp
= TAILQ_NEXT(tsp
, q
)) {
118 col
+= len
= strlen(tsp
->frp
->name
) + sep
;
119 if (col
>= sp
->cols
- 1) {
122 (void)ex_puts(sp
, "\n");
123 } else if (cnt
!= 1) {
125 (void)ex_puts(sp
, " ");
127 (void)ex_puts(sp
, tsp
->frp
->name
);
130 if (!INTERRUPTED(sp
))
131 (void)ex_puts(sp
, "\n");