1 /* $NetBSD: ex_screen.c,v 1.4 2014/01/26 21:43:45 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.
13 #include <sys/cdefs.h>
16 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 ";
19 __RCSID("$NetBSD: ex_screen.c,v 1.4 2014/01/26 21:43:45 christos Exp $");
22 #include <sys/types.h>
23 #include <sys/queue.h>
26 #include <bitstring.h>
32 #include "../common/common.h"
39 * PUBLIC: int ex_bg __P((SCR *, EXCMD *));
42 ex_bg(SCR
*sp
, EXCMD
*cmdp
)
51 * PUBLIC: int ex_fg __P((SCR *, EXCMD *));
54 ex_fg(SCR
*sp
, EXCMD
*cmdp
)
59 newscreen
= F_ISSET(cmdp
, E_NEWSCREEN
);
60 if (vs_fg(sp
, &nsp
, cmdp
->argc
? cmdp
->argv
[0]->bp
: NULL
, newscreen
))
63 /* Set up the switch. */
66 F_SET(sp
, SC_SSWITCH
);
72 * ex_resize -- :resize [+-]rows
73 * Change the screen size.
75 * PUBLIC: int ex_resize __P((SCR *, EXCMD *));
78 ex_resize(SCR
*sp
, EXCMD
*cmdp
)
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 *));
115 if ((tsp
= TAILQ_FIRST(&gp
->hq
)) == NULL
) {
116 msgq(sp
, M_INFO
, "149|No background screens to display");
121 for (cnt
= 1; tsp
!= NULL
&& !INTERRUPTED(sp
);
122 tsp
= TAILQ_NEXT(tsp
, q
)) {
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");