|
|
1.1 ! root 1: # include "curses.ext" ! 2: # include <signal.h> ! 3: /* @(#) newterm.c: 1.1 10/15/83 (1.17 3/16/83) */ ! 4: ! 5: char *calloc(); ! 6: char *malloc(); ! 7: extern char *getenv(); ! 8: ! 9: extern WINDOW *makenew(); ! 10: ! 11: struct screen * ! 12: newterm(type, outfd, infd) ! 13: char *type; ! 14: FILE *outfd, *infd; ! 15: { ! 16: int _tstp(); ! 17: struct screen *scp; ! 18: struct screen *_new_tty(); ! 19: extern int _endwin; ! 20: ! 21: #ifdef DEBUG ! 22: if(outf) fprintf(outf, "NEWTERM() isatty(2) %d, getenv %s\n", ! 23: isatty(2), getenv("TERM")); ! 24: # endif ! 25: SP = (struct screen *) calloc(1, sizeof (struct screen)); ! 26: SP->term_file = outfd; ! 27: SP->input_file = infd; ! 28: /* ! 29: * The default is echo, for upward compatibility, but we do ! 30: * all echoing in curses to avoid problems with the tty driver ! 31: * echoing things during critical sections. ! 32: */ ! 33: SP->fl_echoit = 1; ! 34: savetty(); ! 35: scp = _new_tty(type, outfd); ! 36: if (scp == NULL) ! 37: return NULL; ! 38: #ifdef USG ! 39: (cur_term->Nttyb).c_lflag &= ~ECHO; ! 40: #else ! 41: (cur_term->Nttyb).sg_flags &= ~ECHO; ! 42: #endif ! 43: reset_prog_mode(); ! 44: # ifdef SIGTSTP ! 45: signal(SIGTSTP, _tstp); ! 46: # endif ! 47: if (curscr != NULL) { ! 48: # ifdef DEBUG ! 49: if(outf) fprintf(outf, "INITSCR: non null curscr = 0%o\n", curscr); ! 50: # endif ! 51: } ! 52: # ifdef DEBUG ! 53: if(outf) fprintf(outf, "LINES = %d, COLS = %d\n", LINES, COLS); ! 54: # endif ! 55: LINES = lines; ! 56: COLS = columns; ! 57: curscr = makenew(LINES, COLS, 0, 0); ! 58: stdscr = newwin(LINES, COLS, 0, 0); ! 59: # ifdef DEBUG ! 60: if(outf) fprintf(outf, "SP %x, stdscr %x, curscr %x\n", SP, stdscr, curscr); ! 61: # endif ! 62: SP->std_scr = stdscr; ! 63: SP->cur_scr = curscr; ! 64: /* Maybe should use makewin and glue _y's to DesiredScreen. */ ! 65: _endwin = FALSE; ! 66: return scp; ! 67: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.