1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
$NetBSD: patch-bf,v 1.1.1.1 1999/12/24 03:21:10 itohy Exp $
--- stty.c.orig Wed Sep 23 01:22:53 1998
+++ stty.c Sun Sep 27 10:21:12 1998
@@ -31,12 +31,15 @@
#endif
+#ifndef STDIN_FILENO
+#define STDIN_FILENO 0
+#endif
+
#ifndef NO_SUSPEND
SignalFunc suspend();
#endif
TERMPARAM d_ioval;
-int tty;
#ifdef TIOCSWINSZ
struct winsize d_winsize;
#endif /* TIOCSWINSZ */
@@ -142,7 +145,7 @@
#ifdef TIOCSWINSZ
extern int lines, columns;
- ioctl(tty, TIOCGWINSZ, &d_winsize);
+ ioctl(STDIN_FILENO, TIOCGWINSZ, &d_winsize);
if (d_winsize.ws_col == 0) {
d_winsize.ws_col = columns;
} else {
@@ -153,7 +156,7 @@
} else {
lines = d_winsize.ws_row;
}
- ioctl(tty, TIOCSWINSZ, &d_winsize);
+ ioctl(STDIN_FILENO, TIOCSWINSZ, &d_winsize);
#endif /* TIOCSWINSZ */
}
@@ -161,7 +164,7 @@
{ int er;
TERMPARAM ioval;
- GET_TTY(tty, &d_ioval);
+ GET_TTY(STDIN_FILENO, &d_ioval);
ioval = d_ioval;
#if defined TERMIOS || defined TERMIO
@@ -195,7 +198,7 @@
ioval.m_ttyb.sg_flags = RAW;
#endif
- er = SET_TTY(tty, &ioval);
+ er = SET_TTY(STDIN_FILENO, &ioval);
initFep();
@@ -208,14 +211,8 @@
reset_tty()
{
- reset_tty_without_close();
- close(tty);
-}
-
-reset_tty_without_close()
-{
termFep();
- SET_TTY(tty, &d_ioval);
+ SET_TTY(STDIN_FILENO, &d_ioval);
}
set_tty_sane(tty)
@@ -258,12 +255,6 @@
}
}
-tty_ready()
-{ char *ttyname();
-
- tty = open(ttyname(0),O_RDWR);
-}
-
SignalFunc
reset_exit()
{
@@ -315,7 +306,7 @@
union wait statusp;
#endif
-#ifndef NO_SUSPEND
+#ifdef NO_SUSPEND
while ((cpid = wait((int *)&statusp)) != -1 && cpid != ShellPID)
;
#else
@@ -385,7 +376,7 @@
SignalFunc
suspend()
{
- reset_tty_without_close();
+ reset_tty();
signal(SIGTSTP,SIG_DFL);
kill(0,SIGTSTP);
|