Remove building with NOCRYPTO option
[minix.git] / external / bsd / nvi / dist / ip / ip_screen.c
blob8608fd4fd7ff1a587c92631852e096b34da58a21
1 /* $NetBSD: ip_screen.c,v 1.3 2014/01/26 21:43:45 christos Exp $ */
2 /*-
3 * Copyright (c) 1996
4 * Keith Bostic. All rights reserved.
6 * See the LICENSE file for redistribution information.
7 */
9 #include "config.h"
11 #include <sys/cdefs.h>
12 #if 0
13 #ifndef lint
14 static const char sccsid[] = "Id: ip_screen.c,v 8.8 2001/06/25 15:19:24 skimo Exp (Berkeley) Date: 2001/06/25 15:19:24 ";
15 #endif /* not lint */
16 #else
17 __RCSID("$NetBSD: ip_screen.c,v 1.3 2014/01/26 21:43:45 christos Exp $");
18 #endif
20 #include <sys/types.h>
21 #include <sys/queue.h>
23 #include <bitstring.h>
24 #include <stdio.h>
26 #include "../common/common.h"
27 #include "../ipc/ip.h"
30 * ip_screen --
31 * Initialize/shutdown the IP screen.
33 * PUBLIC: int ip_screen __P((SCR *, u_int32_t));
35 int
36 ip_screen(SCR *sp, u_int32_t flags)
38 GS *gp;
39 IP_PRIVATE *ipp;
41 gp = sp->gp;
42 ipp = IPP(sp);
44 /* See if the current information is incorrect. */
45 if (F_ISSET(gp, G_SRESTART)) {
46 if (ip_quit(sp->wp))
47 return (1);
48 F_CLR(gp, G_SRESTART);
51 /* See if we're already in the right mode. */
52 if ((LF_ISSET(SC_EX) && F_ISSET(sp, SC_SCR_EX)) ||
53 (LF_ISSET(SC_VI) && F_ISSET(sp, SC_SCR_VI)))
54 return (0);
56 /* Ex isn't possible if there is no terminal. */
57 if (LF_ISSET(SC_EX) && ipp->t_fd == -1)
58 return (1);
60 if (F_ISSET(sp, SC_SCR_EX))
61 F_CLR(sp, SC_SCR_EX);
63 if (F_ISSET(sp, SC_SCR_VI))
64 F_CLR(sp, SC_SCR_VI);
66 if (LF_ISSET(SC_EX)) {
67 F_SET(ipp, IP_IN_EX);
68 } else {
69 /* Initialize terminal based information. */
70 if (ip_term_init(sp))
71 return (1);
73 F_CLR(ipp, IP_IN_EX);
74 F_SET(ipp, IP_SCR_VI_INIT);
76 return (0);
80 * ip_quit --
81 * Shutdown the screens.
83 * PUBLIC: int ip_quit __P((WIN *));
85 int
86 ip_quit(WIN *wp)
88 IP_PRIVATE *ipp;
89 int rval;
91 /* Clean up the terminal mappings. */
92 rval = ip_term_end(wp->gp);
94 ipp = WIPP(wp);
95 F_CLR(ipp, IP_SCR_VI_INIT);
97 return (rval);