|
|
1.1 ! root 1: static char *sccsid = "@(#)reset.c 4.2 (Berkeley) 10/9/80"; ! 2: /* ! 3: * reset ! 4: */ ! 5: #include <sgtty.h> ! 6: ! 7: #define CTRL(x) ('x'&037) ! 8: ! 9: main() ! 10: { ! 11: struct sgttyb buf; ! 12: struct tchars tbuf; ! 13: struct ltchars ltbuf; ! 14: ! 15: gtty(2, &buf); ! 16: ioctl(2, TIOCGETC, &tbuf); ! 17: ioctl(2, TIOCGLTC, <buf); ! 18: buf.sg_flags &= ~(RAW|CBREAK|VTDELAY|ALLDELAY); ! 19: buf.sg_flags |= XTABS|ECHO|CRMOD|ANYP; ! 20: reset(&buf.sg_erase, CTRL(h)); ! 21: reset(&buf.sg_kill, '@'); ! 22: reset(&tbuf.t_intrc, 0177); ! 23: reset(&tbuf.t_quitc, CTRL(\\\\)); ! 24: reset(&tbuf.t_startc, CTRL(q)); ! 25: reset(&tbuf.t_stopc, CTRL(s)); ! 26: reset(&tbuf.t_eofc, CTRL(d)); ! 27: reset(<buf.t_suspc, CTRL(z)); ! 28: reset(<buf.t_dsuspc, CTRL(y)); ! 29: reset(<buf.t_rprntc, CTRL(r)); ! 30: reset(<buf.t_flushc, CTRL(o)); ! 31: reset(<buf.t_lnextc, CTRL(v)); ! 32: reset(<buf.t_werasc, CTRL(w)); ! 33: /* brkc is left alone */ ! 34: ioctl(2, TIOCSETN, &buf); ! 35: ioctl(2, TIOCSETC, &tbuf); ! 36: ioctl(2, TIOCSLTC, <buf); ! 37: } ! 38: ! 39: reset(cp, def) ! 40: char *cp; ! 41: int def; ! 42: { ! 43: ! 44: if (*cp == 0 || (*cp&0377)==0377) ! 45: *cp = def; ! 46: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.