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.12 2001/06/25 15:19:19 skimo Exp $";
16 #include <sys/types.h>
17 #include <sys/queue.h>
20 #include <bitstring.h>
26 #include "../common/common.h"
33 * PUBLIC: int ex_bg(SCR *, EXCMD *);
36 ex_bg(SCR *sp, EXCMD *cmdp)
45 * PUBLIC: int ex_fg(SCR *, EXCMD *);
48 ex_fg(SCR *sp, EXCMD *cmdp)
53 newscreen = F_ISSET(cmdp, E_NEWSCREEN);
54 if (vs_fg(sp, &nsp, cmdp->argc ? cmdp->argv[0]->bp : NULL, newscreen))
57 /* Set up the switch. */
60 F_SET(sp, SC_SSWITCH);
66 * ex_resize -- :resize [+-]rows
67 * Change the screen size.
69 * PUBLIC: int ex_resize(SCR *, EXCMD *);
72 ex_resize(SCR *sp, EXCMD *cmdp)
76 switch (FL_ISSET(cmdp->iflags,
77 E_C_COUNT | E_C_COUNT_NEG | E_C_COUNT_POS)) {
81 case E_C_COUNT | E_C_COUNT_NEG:
84 case E_C_COUNT | E_C_COUNT_POS:
88 ex_emsg(sp, cmdp->cmd->usage, EXM_USAGE);
91 return (vs_resize(sp, cmdp->count, adj));
96 * Display the list of screens.
98 * PUBLIC: int ex_sdisplay(SCR *);
105 int cnt, col, len, sep;
108 if ((tsp = TAILQ_FIRST(gp->hq)) == NULL) {
109 msgq(sp, M_INFO, "149|No background screens to display");
114 for (cnt = 1; tsp != NULL && !INTERRUPTED(sp);
115 tsp = TAILQ_NEXT(tsp, q)) {
116 col += len = strlen(tsp->frp->name) + sep;
117 if (col >= sp->cols - 1) {
120 (void)ex_puts(sp, "\n");
121 } else if (cnt != 1) {
123 (void)ex_puts(sp, " ");
125 (void)ex_puts(sp, tsp->frp->name);
128 if (!INTERRUPTED(sp))
129 (void)ex_puts(sp, "\n");