Remove building with NOCRYPTO option
[minix.git] / external / bsd / nvi / dist / ex / ex_screen.c
blob8990609044d8bf8c1d59077e5b5cf527a6a79f20
1 /* $NetBSD: ex_screen.c,v 1.4 2014/01/26 21:43:45 christos Exp $ */
2 /*-
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.
9 */
11 #include "config.h"
13 #include <sys/cdefs.h>
14 #if 0
15 #ifndef lint
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 ";
17 #endif /* not lint */
18 #else
19 __RCSID("$NetBSD: ex_screen.c,v 1.4 2014/01/26 21:43:45 christos Exp $");
20 #endif
22 #include <sys/types.h>
23 #include <sys/queue.h>
24 #include <sys/time.h>
26 #include <bitstring.h>
27 #include <limits.h>
28 #include <stdio.h>
29 #include <stdlib.h>
30 #include <string.h>
32 #include "../common/common.h"
33 #include "../vi/vi.h"
36 * ex_bg -- :bg
37 * Hide the screen.
39 * PUBLIC: int ex_bg __P((SCR *, EXCMD *));
41 int
42 ex_bg(SCR *sp, EXCMD *cmdp)
44 return (vs_bg(sp));
48 * ex_fg -- :fg [file]
49 * Show the screen.
51 * PUBLIC: int ex_fg __P((SCR *, EXCMD *));
53 int
54 ex_fg(SCR *sp, EXCMD *cmdp)
56 SCR *nsp;
57 int newscreen;
59 newscreen = F_ISSET(cmdp, E_NEWSCREEN);
60 if (vs_fg(sp, &nsp, cmdp->argc ? cmdp->argv[0]->bp : NULL, newscreen))
61 return (1);
63 /* Set up the switch. */
64 if (newscreen) {
65 sp->nextdisp = nsp;
66 F_SET(sp, SC_SSWITCH);
68 return (0);
72 * ex_resize -- :resize [+-]rows
73 * Change the screen size.
75 * PUBLIC: int ex_resize __P((SCR *, EXCMD *));
77 int
78 ex_resize(SCR *sp, EXCMD *cmdp)
80 adj_t adj;
82 switch (FL_ISSET(cmdp->iflags,
83 E_C_COUNT | E_C_COUNT_NEG | E_C_COUNT_POS)) {
84 case E_C_COUNT:
85 adj = A_SET;
86 break;
87 case E_C_COUNT | E_C_COUNT_NEG:
88 adj = A_DECREASE;
89 break;
90 case E_C_COUNT | E_C_COUNT_POS:
91 adj = A_INCREASE;
92 break;
93 default:
94 ex_emsg(sp, cmdp->cmd->usage, EXM_USAGE);
95 return (1);
97 return (vs_resize(sp, cmdp->count, adj));
101 * ex_sdisplay --
102 * Display the list of screens.
104 * PUBLIC: int ex_sdisplay __P((SCR *));
107 ex_sdisplay(SCR *sp)
109 GS *gp;
110 SCR *tsp;
111 int cnt, sep;
112 size_t col, len;
114 gp = sp->gp;
115 if ((tsp = TAILQ_FIRST(&gp->hq)) == NULL) {
116 msgq(sp, M_INFO, "149|No background screens to display");
117 return (0);
120 col = len = sep = 0;
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) {
125 col = len;
126 sep = 0;
127 (void)ex_puts(sp, "\n");
128 } else if (cnt != 1) {
129 sep = 1;
130 (void)ex_puts(sp, " ");
132 (void)ex_puts(sp, tsp->frp->name);
133 ++cnt;
135 if (!INTERRUPTED(sp))
136 (void)ex_puts(sp, "\n");
137 return (0);