Removed
Link Here
|
1 |
Index: tty.c |
2 |
@@ -33,7 +33,9 @@ |
3 |
#include "tty.h" |
4 |
#include "tcp.h" |
5 |
|
6 |
-#ifndef USE_SGTTY |
7 |
+#ifdef POSIX |
8 |
+# include <termios.h> |
9 |
+#elif !defined(USE_SGTTY) |
10 |
# ifdef APOLLO |
11 |
# include "/sys5.3/usr/include/sys/termio.h" |
12 |
# else |
13 |
@@ -64,6 +66,9 @@ |
14 |
# define O_CBREAK CBREAK |
15 |
#endif |
16 |
|
17 |
+#ifdef POSIX |
18 |
+typedef struct termios termiostruct; |
19 |
+#else |
20 |
#if defined(TCSETS) || defined(TCSETATTR) |
21 |
# ifndef TCSETS /* cc for HP-UX SHOULD define this... */ |
22 |
# define TCSETS TCSETATTR |
23 |
@@ -75,6 +80,7 @@ |
24 |
# define TCGETS TCGETA |
25 |
typedef struct termio termiostruct; |
26 |
#endif |
27 |
+#endif /* POSIX */ |
28 |
|
29 |
#ifdef VSUSP |
30 |
# define O_SUSP VSUSP |
31 |
@@ -181,14 +187,22 @@ |
32 |
ioctl(tty_read_fd, TIOCSLTC, <c); |
33 |
#else /* not USE_SGTTY */ |
34 |
termiostruct ttyb; |
35 |
+#if POSIX |
36 |
+ tcgetattr(tty_read_fd, &ttyb); |
37 |
+#else |
38 |
ioctl(tty_read_fd, TCGETS, &ttyb); |
39 |
+#endif |
40 |
ttybsave = ttyb; |
41 |
ttyb.c_lflag &= ~(ECHO|ICANON); |
42 |
ttyb.c_cc[VTIME] = 0; |
43 |
ttyb.c_cc[VMIN] = 1; |
44 |
/* disable the special handling of the suspend key (handle it ourselves) */ |
45 |
ttyb.c_cc[O_SUSP] = 0; |
46 |
+#if POSIX |
47 |
+ tcsetattr(tty_read_fd, TCSANOW, &ttyb); |
48 |
+#else |
49 |
ioctl(tty_read_fd, TCSETS, &ttyb); |
50 |
+#endif |
51 |
#endif /* USE_SGTTY */ |
52 |
|
53 |
#ifdef USE_LOCALE |
54 |
@@ -216,7 +230,11 @@ |
55 |
ioctl(tty_read_fd, TIOCSETC, &tcsave); |
56 |
ioctl(tty_read_fd, TIOCSLTC, <csave); |
57 |
#else /* not USE_SGTTY */ |
58 |
+#if POSIX |
59 |
+ tcsetattr(tty_read_fd, TCSANOW, &ttybsave); |
60 |
+#else |
61 |
ioctl(tty_read_fd, TCSETS, &ttybsave); |
62 |
+#endif |
63 |
#endif /* USE_SGTTY */ |
64 |
tty_puts(kpadend); |
65 |
tty_flush(); |
66 |
@@ -251,7 +269,11 @@ |
67 |
#else /* not USE_SGTTY */ |
68 |
int i; |
69 |
termiostruct ttyb; |
70 |
+#if POSIX |
71 |
+ tcgetattr(tty_read_fd, &ttyb); |
72 |
+#else |
73 |
ioctl(tty_read_fd, TCGETS, &ttyb); |
74 |
+#endif |
75 |
if (linemode & LM_CHAR) { |
76 |
/* char-by-char mode: disable all special keys and set raw mode */ |
77 |
for(i = 0; i < NCCS; i++) |
78 |
@@ -266,7 +288,11 @@ |
79 |
/* set cooked mode */ |
80 |
ttyb.c_oflag |= OPOST; |
81 |
} |
82 |
+#if POSIX |
83 |
+ tcsetattr(tty_read_fd, TCSANOW, &ttyb); |
84 |
+#else |
85 |
ioctl(tty_read_fd, TCSETS, &ttyb); |
86 |
+#endif |
87 |
#endif /* USE_SGTTY */ |
88 |
} |