|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1980 Regents of the University of California. ! 3: * All rights reserved. The Berkeley software License Agreement ! 4: * specifies the terms and conditions for redistribution. ! 5: */ ! 6: ! 7: #ifndef lint ! 8: static char sccsid[] = "@(#)getch.c 5.3 (Berkeley) 4/16/86"; ! 9: #endif not lint ! 10: ! 11: # include "curses.ext" ! 12: ! 13: /* ! 14: * This routine reads in a character from the window. ! 15: * ! 16: */ ! 17: wgetch(win) ! 18: reg WINDOW *win; { ! 19: ! 20: reg bool weset = FALSE; ! 21: reg char inp; ! 22: ! 23: if (!win->_scroll && (win->_flags&_FULLWIN) ! 24: && win->_curx == win->_maxx - 1 && win->_cury == win->_maxy - 1) ! 25: return ERR; ! 26: # ifdef DEBUG ! 27: fprintf(outf, "WGETCH: _echoit = %c, _rawmode = %c\n", _echoit ? 'T' : 'F', _rawmode ? 'T' : 'F'); ! 28: # endif ! 29: if (_echoit && !_rawmode) { ! 30: cbreak(); ! 31: weset++; ! 32: } ! 33: inp = getchar(); ! 34: # ifdef DEBUG ! 35: fprintf(outf,"WGETCH got '%s'\n",unctrl(inp)); ! 36: # endif ! 37: if (_echoit) { ! 38: mvwaddch(curscr, win->_cury + win->_begy, ! 39: win->_curx + win->_begx, inp); ! 40: waddch(win, inp); ! 41: } ! 42: if (weset) ! 43: nocbreak(); ! 44: return inp; ! 45: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.