* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
"@(#) Copyright (c) 1980 Regents of the University of California.\n\
static char sccsid
[] = "@(#)reset.c 5.1 (Berkeley) %G%";
* reset - restore tty to sensible state after crapping out in raw mode.
ioctl(2, TIOCGETP
, &buf
);
ioctl(2, TIOCGETC
, &tbuf
);
ioctl(2, TIOCGLTC
, <buf
);
buf
.sg_flags
&= ~(RAW
|CBREAK
|VTDELAY
|ALLDELAY
);
buf
.sg_flags
|= XTABS
|ECHO
|CRMOD
|ANYP
;
reset(&buf
.sg_erase
, CERASE
);
reset(&buf
.sg_kill
, CKILL
);
reset(&tbuf
.t_intrc
, CINTR
);
reset(&tbuf
.t_quitc
, CQUIT
);
reset(&tbuf
.t_startc
, CSTART
);
reset(&tbuf
.t_stopc
, CSTOP
);
reset(&tbuf
.t_eofc
, CEOF
);
reset(<buf
.t_suspc
, CSUSP
);
reset(<buf
.t_dsuspc
, CDSUSP
);
reset(<buf
.t_rprntc
, CRPRNT
);
reset(<buf
.t_flushc
, CFLUSH
);
reset(<buf
.t_lnextc
, CLNEXT
);
reset(<buf
.t_werasc
, CWERASE
);
ioctl(2, TIOCSETN
, &buf
);
ioctl(2, TIOCSETC
, &tbuf
);
ioctl(2, TIOCSLTC
, <buf
);
execlp("tset", "tset", "-Q", "-I", 0); /* fix term dependent stuff */
if (*cp
== 0 || (*cp
&0377)==0377)