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