Switch from bioq_insert_tail() to bioqdisksort(). When the kernel is
[dragonfly.git] / contrib / nvi / ip / ip_screen.c
blob71578e0d1b399d27a3bf947a472b1a7948e55248
1 /*-
2 * Copyright (c) 1996
3 * Keith Bostic. All rights reserved.
5 * See the LICENSE file for redistribution information.
6 */
8 #include "config.h"
10 #ifndef lint
11 static const char sccsid[] = "@(#)ip_screen.c 8.2 (Berkeley) 10/13/96";
12 #endif /* not lint */
14 #include <sys/types.h>
15 #include <sys/queue.h>
17 #include <bitstring.h>
18 #include <stdio.h>
20 #include "../common/common.h"
21 #include "ip.h"
24 * ip_screen --
25 * Initialize/shutdown the IP screen.
27 * PUBLIC: int ip_screen __P((SCR *, u_int32_t));
29 int
30 ip_screen(sp, flags)
31 SCR *sp;
32 u_int32_t flags;
34 GS *gp;
35 IP_PRIVATE *ipp;
37 gp = sp->gp;
38 ipp = IPP(sp);
40 /* See if the current information is incorrect. */
41 if (F_ISSET(gp, G_SRESTART)) {
42 if (ip_quit(gp))
43 return (1);
44 F_CLR(gp, G_SRESTART);
47 /* See if we're already in the right mode. */
48 if (LF_ISSET(SC_VI) && F_ISSET(ipp, IP_SCR_VI_INIT))
49 return (0);
51 /* Ex isn't possible. */
52 if (LF_ISSET(SC_EX))
53 return (1);
55 /* Initialize terminal based information. */
56 if (ip_term_init(sp))
57 return (1);
59 /* Put up the first file name. */
60 if (ip_rename(sp))
61 return (1);
63 F_SET(ipp, IP_SCR_VI_INIT);
64 return (0);
68 * ip_quit --
69 * Shutdown the screens.
71 * PUBLIC: int ip_quit __P((GS *));
73 int
74 ip_quit(gp)
75 GS *gp;
77 IP_PRIVATE *ipp;
78 int rval;
80 /* Clean up the terminal mappings. */
81 rval = ip_term_end(gp);
83 ipp = GIPP(gp);
84 F_CLR(ipp, IP_SCR_VI_INIT);
86 return (rval);