BSD 4 release
[unix-history] / usr / src / cmd / reset.c
... / ...
CommitLineData
1static 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
9main()
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, &ltbuf);
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(&ltbuf.t_suspc, CTRL(z));
28 reset(&ltbuf.t_dsuspc, CTRL(y));
29 reset(&ltbuf.t_rprntc, CTRL(r));
30 reset(&ltbuf.t_flushc, CTRL(o));
31 reset(&ltbuf.t_lnextc, CTRL(v));
32 reset(&ltbuf.t_werasc, CTRL(w));
33 /* brkc is left alone */
34 ioctl(2, TIOCSETN, &buf);
35 ioctl(2, TIOCSETC, &tbuf);
36 ioctl(2, TIOCSLTC, &ltbuf);
37}
38
39reset(cp, def)
40 char *cp;
41 int def;
42{
43
44 if (*cp == 0 || (*cp&0377)==0377)
45 *cp = def;
46}