1: #ifndef lint
2: static char *sccsid = "@(#)reset.c 4.3 (Berkeley) 12/3/80";
3: #endif
4: /*
5: * reset - restore tty to sensible state after crapping out in raw mode.
6: */
7: #include <sgtty.h>
8:
9: #define CTRL(x) ('x'&037)
10:
11: main()
12: {
13: struct sgttyb buf;
14: struct tchars tbuf;
15: struct ltchars ltbuf;
16:
17: gtty(2, &buf);
18: ioctl(2, TIOCGETC, &tbuf);
19: ioctl(2, TIOCGLTC, <buf);
20: buf.sg_flags &= ~(RAW|CBREAK|VTDELAY|ALLDELAY);
21: buf.sg_flags |= XTABS|ECHO|CRMOD|ANYP;
22: reset(&buf.sg_erase, CTRL(h));
23: reset(&buf.sg_kill, '@');
24: reset(&tbuf.t_intrc, 0177);
25: reset(&tbuf.t_quitc, CTRL(\\\\));
26: reset(&tbuf.t_startc, CTRL(q));
27: reset(&tbuf.t_stopc, CTRL(s));
28: reset(&tbuf.t_eofc, CTRL(d));
29: reset(<buf.t_suspc, CTRL(z));
30: reset(<buf.t_dsuspc, CTRL(y));
31: reset(<buf.t_rprntc, CTRL(r));
32: reset(<buf.t_flushc, CTRL(o));
33: reset(<buf.t_lnextc, CTRL(v));
34: reset(<buf.t_werasc, CTRL(w));
35: /* brkc is left alone */
36: ioctl(2, TIOCSETN, &buf);
37: ioctl(2, TIOCSETC, &tbuf);
38: ioctl(2, TIOCSLTC, <buf);
39: execlp("tset", "tset", "-Q", "-I", 0); /* fix term dependent stuff */
40: exit(1);
41: }
42:
43: reset(cp, def)
44: char *cp;
45: int def;
46: {
47:
48: if (*cp == 0 || (*cp&0377)==0377)
49: *cp = def;
50: }
Defined functions
main
defined in line
11;
never used
reset
defined in line
43; used 13 times
Defined variables
sccsid
defined in line
2;
never used
Defined macros
CTRL
defined in line
9; used 11 times