|
|
1.1 ! root 1: /* @(#) restarttrm.c: 1.1 10/15/83 (1.36 3/18/83) */ ! 2: #include "curses.ext" ! 3: #include "../local/uparm.h" ! 4: ! 5: extern struct term *cur_term; ! 6: ! 7: /* ! 8: * This is useful after saving/restoring memory from a file (e.g. as ! 9: * in a rogue save game). It assumes that the modes and windows are ! 10: * as wanted by the user, but the terminal type and baud rate may ! 11: * have changed. ! 12: */ ! 13: restartterm(term, filenum, errret) ! 14: char *term; ! 15: int filenum; /* This is a UNIX file descriptor, not a stdio ptr. */ ! 16: int *errret; ! 17: { ! 18: int saveecho = SP->fl_echoit; ! 19: int savecbreak = SP->fl_rawmode; ! 20: int saveraw; ! 21: int savenl; ! 22: ! 23: #ifdef USG ! 24: saveraw = (cur_term->Nttyb).c_cc[VINTR] == 0377; ! 25: savenl = (cur_term->Nttyb).c_iflag & ICRNL; ! 26: #else ! 27: saveraw = (cur_term->Nttyb).sg_flags | RAW; ! 28: savenl = (cur_term->Nttyb).sg_flags & CRMOD; ! 29: #endif ! 30: ! 31: setupterm(term, filenum, errret); ! 32: ! 33: /* ! 34: * Restore curses settable flags, leaving other stuff alone. ! 35: */ ! 36: if (saveecho) ! 37: echo(); ! 38: else ! 39: noecho(); ! 40: ! 41: if (savecbreak) ! 42: cbreak(), noraw(); ! 43: else if (saveraw) ! 44: nocbreak(), raw(); ! 45: else ! 46: nocbreak(), noraw(); ! 47: ! 48: if (savenl) ! 49: nl(); ! 50: else ! 51: nonl(); ! 52: ! 53: reset_prog_mode(); ! 54: ! 55: LINES = lines; ! 56: COLS = columns; ! 57: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.