aboutsummaryrefslogtreecommitdiff
path: root/japanese/sj3-lib/files/patch-termios
blob: 24f8e5ee157c34eef5fc4b4ec63e22a522d6afb3 (plain) (blame)
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
--- include/sj_sysvdef.h
+++ include/sj_sysvdef.h
@@ -50,8 +50,8 @@
 #endif 
 #endif 
 
-#ifdef SVR4
 #define SYSV_TERMIOS
+#ifdef SVR4
 #define SIGTYPE_VOID
 #endif /* SVR4 */
 
--- sj3/sj3.c
+++ sj3/sj3.c
@@ -50,7 +50,7 @@
 #define LACKOF_SETLOCALE
 #endif
 #endif
-#if defined(__FreeBSD__) || defined(__OpenBSD__)
+#if defined(__OpenBSD__)
 #include <sys/ioctl_compat.h>
 #endif
 #include <curses.h>
@@ -81,9 +81,7 @@
 #define DEFAULTSHELL	"/bin/sh"
 #endif
 
-#if defined(linux) && defined (__GLIBC__) && (__GLIBC__ >= 2)
 #include <termios.h>
-#endif
 
 int	Lflag = 0;		
 int	shell_flag = 0;		
@@ -119,9 +117,9 @@
 #define ts_lines ws_row
 #define ts_cols ws_col
 #else
-int	Ttyslot;
 struct	ttysize	Ttysize;
 #endif
+int	Ttyslot;
 int	master;
 int	slave;
 
@@ -419,7 +417,7 @@
 get_ttymode()
 {
 #ifdef SYSV_TERMIOS
-	ioctl (0, TCGETS, (char *)&b);
+	tcgetattr (0, &b);
 	erase_char = b.c_cc[VERASE];
 	set_bs(erase_char);
 	erase_str[0] = erase_char;
@@ -586,7 +584,7 @@
 	struct termios sbuf;
 
 	sbuf = b;
-	sbuf.c_iflag &= ~(INLCR|IGNCR|ICRNL|IUCLC|IXON);
+	sbuf.c_iflag &= ~(INLCR|IGNCR|ICRNL|IXON);
 	sbuf.c_oflag &= ~(ONLCR|OPOST);
 	sbuf.c_lflag &= ~(ICANON|ECHO);
 	sbuf.c_cc[VMIN] = 1;
@@ -601,7 +599,7 @@
 	sbuf.c_cc[VDISCARD] = 0;
 	sbuf.c_cc[VWERASE] = 0;
 	sbuf.c_cc[VLNEXT] = 0;
-	(void) ioctl(0, TCSETSW, (char *)&sbuf);
+	(void) tcsetattr(0, TCSADRAIN, &sbuf);
 #else 
 	struct sgttyb sbuf;
 
@@ -793,7 +791,7 @@
 shellprocess()
 {
 	int			t, f;
-#ifdef SYSV_TERMIOS
+#if 0
 #ifdef SYSV_UTMP
 	struct utmp Utmp;
 #else
@@ -952,7 +950,7 @@
 #endif
 	ioctl (slave, TIOCSSIZE, &Ttysize);
 #else /* SYSV_TERMIOS */
-	(void) ioctl(slave, TCSETSF, (char *)&b);
+	(void) tcsetattr(slave, TCSAFLUSH, &b);
 	(void) ioctl(slave, TIOCSWINSZ, (char *)&Ttysize);
 #endif /* SYSV_TERMIOS */
 #endif /* SVR4 */
@@ -1026,7 +1024,7 @@
 	chown (slave_name, 0, 0);
 	chmod (slave_name, 0666);
 #ifdef SYSV_TERMIOS
-	ioctl (0, TCSETSW, (char *)&b);		
+	tcsetattr (0, TCSADRAIN, &b);		
 #else /* SYSV_TERMIOS */
 	ioctl (0, TIOCSETP, (char *)&b);	
 	ioctl (0, TIOCSETC, (char *)&tc);	
@@ -1119,7 +1117,7 @@
 	} while (nc > 0);
 
 #ifdef SYSV_TERMIOS
-	ioctl (0, TCSETSW, (char *)&b);		
+	tcsetattr (0, TCSADRAIN, &b);		
 #else /* SYSV_TERMIOS */
 	ioctl (0, TIOCSETP, (char *)&b);	
 	ioctl (0, TIOCSETC, (char *)&tc);	
--- sj3/sjgetchar.c
+++ sj3/sjgetchar.c
@@ -54,7 +54,7 @@
 #if defined(__NetBSD__) || defined(__bsdi__)
 #define	USE_OLD_TTY
 #endif
-#if defined(__FreeBSD__) || defined(__OpenBSD__)
+#if defined(__OpenBSD__)
 #include <sys/ioctl_compat.h>
 #endif
 #include <curses.h>
@@ -259,9 +259,7 @@
 	}
 }
 #else 
-#if defined(linux) && defined (__GLIBC__) && (__GLIBC__ >= 2)
 #include <termios.h>
-#endif
 
 void
 output_master()
@@ -299,10 +297,10 @@
 		}
 		else if (m & TIOCPKT_NOSTOP) {
 #ifdef SYSV_TERMIOS
-			ioctl (1, TCGETS, &tc);
+			tcgetattr (1, &tc);
 			tc.c_cc[VSTOP] = 0;
 			tc.c_cc[VSTART] = 0;
-			ioctl (STDOUT, TCSETS, &tc);
+			tcsetattr (STDOUT, TCSANOW, &tc);
 #else
  
 			ioctl (1, TIOCGETC, &tc);
@@ -313,11 +311,11 @@
 		}
 		else if (m & TIOCPKT_DOSTOP) {
 #ifdef SYSV_TERMIOS
-			ioctl (master, TCGETS, &tc1);
-			ioctl (STDOUT, TCGETS, &tc);
+			tcgetattr (master, &tc1);
+			tcgetattr (STDOUT, &tc);
 			tc.c_cc[VSTOP] = tc1.c_cc[VSTOP];
 			tc.c_cc[VSTART] = tc1.c_cc[VSTART];
-			ioctl (STDOUT, TCSETS, &tc);
+			tcsetattr (STDOUT, TCSANOW, &tc);
 #else
 			ioctl (master, TIOCGETC, &tc1);
 			ioctl (STDOUT, TIOCGETC, &tc);