1: /*
2: * Copyright (c) 1980 Regents of the University of California.
3: * All rights reserved. The Berkeley software License Agreement
4: * specifies the terms and conditions for redistribution.
5: */
6:
7: #ifndef lint
8: static char sccsid[] = "@(#)initscr.c 5.1 (Berkeley) 6/7/85";
9: #endif not lint
10:
11: # include "curses.ext"
12: # include <signal.h>
13:
14: extern char *getenv();
15:
16: /*
17: * This routine initializes the current and standard screen.
18: *
19: */
20: WINDOW *
21: initscr() {
22:
23: reg char *sp;
24: int tstp();
25: int nfd;
26:
27: # ifdef DEBUG
28: fprintf(outf, "INITSCR()\n");
29: # endif
30: if (My_term)
31: setterm(Def_term);
32: else {
33: for (_tty_ch = 0; _tty_ch < nfd; _tty_ch++)
34: if (isatty(_tty_ch))
35: break;
36: gettmode();
37: if ((sp = getenv("TERM")) == NULL)
38: sp = Def_term;
39: setterm(sp);
40: # ifdef DEBUG
41: fprintf(outf, "INITSCR: term = %s\n", sp);
42: # endif
43: }
44: _puts(TI);
45: _puts(VS);
46: # ifdef SIGTSTP
47: signal(SIGTSTP, tstp);
48: # endif
49: if (curscr != NULL) {
50: # ifdef DEBUG
51: fprintf(outf, "INITSCR: curscr = 0%o\n", curscr);
52: # endif
53: delwin(curscr);
54: }
55: # ifdef DEBUG
56: fprintf(outf, "LINES = %d, COLS = %d\n", LINES, COLS);
57: # endif
58: if ((curscr = newwin(LINES, COLS, 0, 0)) == ERR)
59: return ERR;
60: clearok(curscr, TRUE);
61: curscr->_flags &= ~_FULLLINE;
62: if (stdscr != NULL) {
63: # ifdef DEBUG
64: fprintf(outf, "INITSCR: stdscr = 0%o\n", stdscr);
65: # endif
66: delwin(stdscr);
67: }
68: stdscr = newwin(LINES, COLS, 0, 0);
69: return stdscr;
70: }
Defined functions
Defined variables
sccsid
defined in line
8;
never used