|
|
1.1 ! root 1: # include "curses.ext" ! 2: # include <signal.h> ! 3: ! 4: extern char *getenv(); ! 5: ! 6: /* ! 7: * This routine initializes the current and standard screen. ! 8: * ! 9: * 3/5/81 (Berkeley) @(#)initscr.c 1.2 ! 10: */ ! 11: WINDOW * ! 12: initscr() { ! 13: ! 14: reg char *sp; ! 15: int tstp(); ! 16: ! 17: # ifdef DEBUG ! 18: fprintf(outf, "INITSCR()\n"); ! 19: # endif ! 20: if (!My_term && isatty(2)) { ! 21: _tty_ch = 2; ! 22: gettmode(); ! 23: if ((sp = getenv("TERM")) == NULL) ! 24: sp = Def_term; ! 25: setterm(sp); ! 26: # ifdef DEBUG ! 27: fprintf(outf, "INITSCR: term = %s\n", sp); ! 28: # endif ! 29: } ! 30: else ! 31: setterm(Def_term); ! 32: _puts(TI); ! 33: _puts(VS); ! 34: # ifdef SIGTSTP ! 35: signal(SIGTSTP, tstp); ! 36: # endif ! 37: if (curscr != NULL) { ! 38: # ifdef DEBUG ! 39: fprintf(outf, "INITSCR: curscr = 0%o\n", curscr); ! 40: # endif ! 41: delwin(curscr); ! 42: } ! 43: # ifdef DEBUG ! 44: fprintf(outf, "LINES = %d, COLS = %d\n", LINES, COLS); ! 45: # endif ! 46: if ((curscr = newwin(LINES, COLS, 0, 0)) == ERR) ! 47: return ERR; ! 48: curscr->_clear = TRUE; ! 49: if (stdscr != NULL) { ! 50: # ifdef DEBUG ! 51: fprintf(outf, "INITSCR: stdscr = 0%o\n", stdscr); ! 52: # endif ! 53: delwin(stdscr); ! 54: } ! 55: stdscr = newwin(LINES, COLS, 0, 0); ! 56: return stdscr; ! 57: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.