|
|
1.1 root 1: /*
2: * Copyright (c) 1981 Regents of the University of California.
3: * All rights reserved.
4: *
5: * Redistribution and use in source and binary forms are permitted
6: * provided that: (1) source distributions retain this entire copyright
7: * notice and comment, and (2) distributions including binaries display
8: * the following acknowledgement: ``This product includes software
9: * developed by the University of California, Berkeley and its contributors''
10: * in the documentation or other materials provided with the distribution
11: * and in all advertising materials mentioning features or use of this
12: * software. Neither the name of the University nor the names of its
13: * contributors may be used to endorse or promote products derived
14: * from this software without specific prior written permission.
15: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
16: * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
17: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18: */
19:
20: #ifndef lint
21: static char sccsid[] = "@(#)initscr.c 5.5 (Berkeley) 6/1/90";
22: #endif /* not lint */
23:
24: # include "curses.ext"
25: # include <signal.h>
26:
27: extern char *getenv();
28:
29: /*
30: * This routine initializes the current and standard screen.
31: *
32: */
33: WINDOW *
34: initscr() {
35:
36: reg char *sp;
37: int tstp();
38:
39: # ifdef DEBUG
40: fprintf(outf, "INITSCR()\n");
41: # endif
42: if (My_term)
43: setterm(Def_term);
44: else {
45: gettmode();
46: if ((sp = getenv("TERM")) == NULL)
47: sp = Def_term;
48: setterm(sp);
49: # ifdef DEBUG
50: fprintf(outf, "INITSCR: term = %s\n", sp);
51: # endif
52: }
53: _puts(TI);
54: _puts(VS);
55: # ifdef SIGTSTP
56: signal(SIGTSTP, tstp);
57: # endif
58: if (curscr != NULL) {
59: # ifdef DEBUG
60: fprintf(outf, "INITSCR: curscr = 0%o\n", curscr);
61: # endif
62: delwin(curscr);
63: }
64: # ifdef DEBUG
65: fprintf(outf, "LINES = %d, COLS = %d\n", LINES, COLS);
66: # endif
67: if ((curscr = newwin(LINES, COLS, 0, 0)) == ERR)
68: return ERR;
69: clearok(curscr, TRUE);
70: curscr->_flags &= ~_FULLLINE;
71: if (stdscr != NULL) {
72: # ifdef DEBUG
73: fprintf(outf, "INITSCR: stdscr = 0%o\n", stdscr);
74: # endif
75: delwin(stdscr);
76: }
77: stdscr = newwin(LINES, COLS, 0, 0);
78: return stdscr;
79: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.