From 2b7ef0259768de48b4afb2da68892b7f9a6f3d5e Mon Sep 17 00:00:00 2001 From: Bill Joy Date: Thu, 2 Oct 1980 01:28:06 -0800 Subject: [PATCH] date and time created 80/10/01 17:28:06 by bill SCCS-vsn: usr.bin/tset/reset.c 4.1 --- usr/src/usr.bin/tset/reset.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 usr/src/usr.bin/tset/reset.c diff --git a/usr/src/usr.bin/tset/reset.c b/usr/src/usr.bin/tset/reset.c new file mode 100644 index 0000000000..1e1fd2bb17 --- /dev/null +++ b/usr/src/usr.bin/tset/reset.c @@ -0,0 +1,33 @@ +static char *sccsid = "@(#)reset.c 4.1 (Berkeley) %G%"; +/* + * reset - set the teletype mode bits to be sensible + * + * Kurt Shoens + * + * Very useful after crapping out in raw. + * Modified by Mark Horton to know about tchars + * and to not mess with peoples chars unless they are null. + */ +#include +#define chk(val, dft) (val==0 ? dft : val) + +main() +{ + struct sgttyb buf; + struct tchars tbuf; + + gtty(2, &buf); + ioctl(2, TIOCGETC, &tbuf); + buf.sg_flags &= ~(RAW|CBREAK|VTDELAY|ALLDELAY); + buf.sg_flags |= XTABS|ECHO|CRMOD|ANYP; + buf.sg_erase = chk(buf.sg_erase, '\08'); /* ^H */ + buf.sg_kill = chk(buf.sg_kill, '\30'); /* ^X */ + tbuf.t_intrc = chk(tbuf.t_intrc, '\177'); /* ^? */ + tbuf.t_quitc = chk(tbuf.t_quitc, '\34'); /* ^\ */ + tbuf.t_startc = chk(tbuf.t_startc, '\22'); /* ^Q */ + tbuf.t_stopc = chk(tbuf.t_stopc, '\24'); /* ^S */ + tbuf.t_eofc = chk(tbuf.t_eofc, '\4'); /* ^D */ + /* brkc is left alone */ + ioctl(2, TIOCSETN, &buf); + ioctl(2, TIOCSETC, &tbuf); +} -- 2.20.1