1994-10-07 08:58:58 +00:00
|
|
|
|
|
|
|
/* This work is copyrighted. See COPYRIGHT.OLD & COPYRIGHT.NEW for *
|
|
|
|
* details. If they are missing then this copy is in violation of *
|
|
|
|
* the copyright conditions. */
|
|
|
|
|
|
|
|
/*
|
|
|
|
** lib_initscr.c
|
|
|
|
**
|
|
|
|
** The routine initscr().
|
|
|
|
**
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include "curses.priv.h"
|
|
|
|
|
|
|
|
WINDOW *initscr()
|
|
|
|
{
|
1997-08-25 07:41:15 +00:00
|
|
|
static bool initialized = FALSE;
|
|
|
|
char *name;
|
1994-10-07 08:58:58 +00:00
|
|
|
#ifdef TRACE
|
|
|
|
_init_trace();
|
|
|
|
|
1994-12-02 06:40:24 +00:00
|
|
|
T(("initscr() called"));
|
1994-10-07 08:58:58 +00:00
|
|
|
#endif
|
1994-12-02 06:40:24 +00:00
|
|
|
|
1997-08-25 07:41:15 +00:00
|
|
|
/* Portable applications must not call initscr() more than once */
|
|
|
|
if (!initialized) {
|
|
|
|
initialized = TRUE;
|
|
|
|
|
|
|
|
if ((name = getenv("TERM")) == 0)
|
|
|
|
name = "unknown";
|
|
|
|
if (newterm(name, stdout, stdin) == 0) {
|
|
|
|
fprintf(stderr, "Error opening terminal: %s.\n", name);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
/* def_shell_mode - done in newterm */
|
1994-10-07 08:58:58 +00:00
|
|
|
def_prog_mode();
|
|
|
|
}
|
1997-08-25 07:41:15 +00:00
|
|
|
return(stdscr);
|
1994-10-07 08:58:58 +00:00
|
|
|
}
|