]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/libncurses/lib_initscr.c
Make bdev userland access work like cdev userland access unless
[FreeBSD/FreeBSD.git] / lib / libncurses / lib_initscr.c
1
2 /* This work is copyrighted. See COPYRIGHT.OLD & COPYRIGHT.NEW for   *
3 *  details. If they are missing then this copy is in violation of    *
4 *  the copyright conditions.                                        */
5
6 /*
7 **      lib_initscr.c
8 **
9 **      The routine initscr().
10 **
11 */
12
13 #include <stdlib.h>
14 #include "curses.priv.h"
15
16 WINDOW *initscr()
17 {
18 static  bool initialized = FALSE;
19 char *name;
20 #ifdef TRACE
21         _init_trace();
22
23         T(("initscr() called"));
24 #endif
25
26         /* Portable applications must not call initscr() more than once */
27         if (!initialized) {
28                 initialized = TRUE;
29
30                 if ((name = getenv("TERM")) == 0)
31                         name = "unknown";
32                 if (newterm(name, stdout, stdin) == 0) {
33                         fprintf(stderr, "Error opening terminal: %s.\n", name);
34                         exit(1);
35                 }
36                 /* def_shell_mode - done in newterm */
37                 def_prog_mode();
38         }
39         return(stdscr);
40 }