|
|
1.1 root 1: /* @(#) resetshell.c: 1.1 10/15/83 (1.36 3/18/83) */
2:
3: #include "curses.ext"
4: #include "../local/uparm.h"
5:
6: extern struct term *cur_term;
7:
8: #ifdef DIOCSETT
9: /*
10: * Disable CB/UNIX virtual terminals.
11: * This really should be a field in the cur_term structure, but
12: * I didn't do it that way because I'm trying to make ex fit.
13: * If you're using virtual terminals on a 32 bit machine it
14: * probably makes sense to change it.
15: */
16: static struct termcb new, old;
17: #endif
18: #ifdef LTILDE
19: static int newlmode, oldlmode;
20: #endif
21:
22: /*
23: * Getting the baud rate is different on the two systems.
24: * In either case, a baud rate of 0 hangs up the phone.
25: * Since things are often initialized to 0, getting the phone
26: * hung up on you is a common result of a bug in your program.
27: * This is not very friendly, so if the baud rate is 0, we
28: * assume we're doing a reset_xx_mode with no def_xx_mode, and
29: * just don't do anything.
30: */
31: #ifdef USG
32: #define BR(x) (cur_term->x.c_cflag&CBAUD)
33: #else
34: #define BR(x) (cur_term->x.sg_ispeed)
35: #endif
36:
37: reset_shell_mode()
38: {
39: #ifdef DIOCSETT
40: /*
41: * Restore any virtual terminal setting. This must be done
42: * before the TIOCSETN because DIOCSETT will clobber flags like xtabs.
43: */
44: old.st_flgs |= TM_SET;
45: ioctl(2, DIOCSETT, &old);
46: #endif
47: if (BR(Ottyb)) {
48: ioctl(cur_term -> Filedes,
49: #ifdef USG
50: TCSETAW,
51: #else
52: TIOCSETN,
53: #endif
54: &(cur_term->Ottyb));
55: # ifdef LTILDE
56: if (newlmode != oldlmode)
57: ioctl(cur_term -> Filedes, TIOCLSET, &oldlmode);
58: # endif
59: }
60: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.