summaryrefslogtreecommitdiff
path: root/textproc/ispell-base/patches/patch-ak
blob: 8ce093a1f2822d7197afe9e58fb6d03ff9ee88c1 (plain)
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
$NetBSD: patch-ak,v 1.4 2005/03/24 17:08:02 tv Exp $

--- term.c.orig	2001-07-25 17:51:46.000000000 -0400
+++ term.c
@@ -80,7 +80,10 @@ static char Rcs_Id[] =
 #include "ispell.h"
 #include "proto.h"
 #include "msgs.h"
-#ifdef USG
+#if defined(__NetBSD__) || defined(linux) || defined(__sgi) || defined(__INTERIX)
+#define USE_TERMIOS
+#include <termios.h>
+#elif defined(USG)
 #include <termio.h>
 #else
 #include <sgtty.h>
@@ -151,7 +154,10 @@ static int putch (c)
     return putchar (c);
     }
 
-#ifdef USG
+#ifdef USE_TERMIOS
+static struct termios	sbuf;
+static struct termios	osbuf;
+#elif defined(USG)
 static struct termio	sbuf;
 static struct termio	osbuf;
 #else
@@ -279,8 +285,31 @@ retry:
 
 #endif
 
+#ifdef USE_TERMIOS
+    if (!isatty (0))
+	{
+	(void) fprintf (stderr, TERM_C_NO_BATCH);
+	exit (1);
+	}
+    tcgetattr(0, &osbuf);
+    termchanged = 1;
+
+    sbuf = osbuf;
+    sbuf.c_lflag &= ~(ECHO | ECHOK | ECHONL | ICANON);
+    sbuf.c_oflag &= ~(OPOST);
+    sbuf.c_iflag &= ~(INLCR | IGNCR | ICRNL);
+    sbuf.c_lflag |= ISIG;
+    sbuf.c_cc[VMIN] = 1;
+    sbuf.c_cc[VTIME] = 0;
+    tcsetattr(0, TCSANOW, &sbuf);
+
+    uerasechar = osbuf.c_cc[VERASE];
+    ukillchar = osbuf.c_cc[VKILL];
+
+#endif
+
 #ifdef SIGTSTP
-#ifndef USG
+#if !(defined(USG) || defined(USE_TERMIOS))
     (void) sigsetmask (1<<(SIGTSTP-1) | 1<<(SIGTTIN-1) | 1<<(SIGTTOU-1));
 #endif
 #endif
@@ -306,7 +335,7 @@ retry:
 #endif
 #endif
 
-#ifndef USG
+#if !(defined(USG) || defined(USE_TERMIOS))
     (void) ioctl (0, TIOCGETP, (char *) &osbuf);
 #ifdef TIOCGLTC
     (void) ioctl (0, TIOCGLTC, (char *) &oltc);
@@ -359,7 +388,9 @@ SIGNAL_TYPE done (signo)
 	{
 	if (te)
 	    tputs (te, 1, putch);
-#ifdef USG
+#ifdef USE_TERMIOS
+	tcsetattr(0, TCSANOW, &osbuf);
+#elif defined(USG)
 	(void) ioctl (0, TCSETAW, (char *) &osbuf);
 #else
 	(void) ioctl (0, TIOCSETP, (char *) &osbuf);
@@ -375,7 +406,9 @@ SIGNAL_TYPE done (signo)
 static SIGNAL_TYPE onstop (signo)
     int		signo;
     {
-#ifdef USG
+#ifdef USE_TERMIOS
+	tcsetattr(0, TCSANOW, &osbuf);
+#elif defined(USG)
     (void) ioctl (0, TCSETAW, (char *) &osbuf);
 #else
     (void) ioctl (0, TIOCSETP, (char *) &osbuf);
@@ -390,7 +423,9 @@ static SIGNAL_TYPE onstop (signo)
     (void) kill (0, signo);
     /* stop here until continued */
     (void) signal (signo, onstop);
-#ifdef USG
+#ifdef USE_TERMIOS
+	tcsetattr(0, TCSANOW, &sbuf);
+#elif defined(USG)
     (void) ioctl (0, TCSETAW, (char *) &sbuf);
 #else
     (void) ioctl (0, TIOCSETP, (char *) &sbuf);
@@ -450,7 +485,9 @@ int shellescape	(buf)
 	}
     argv[i] = NULL;
 
-#ifdef USG
+#ifdef USE_TERMIOS
+    tcsetattr(0, TCSANOW, &osbuf);
+#elif defined(USG)
     (void) ioctl (0, TCSETAW, (char *) &osbuf);
 #else
     (void) ioctl (0, TIOCSETP, (char *) &osbuf);
@@ -496,7 +533,9 @@ int shellescape	(buf)
 	(void) signal (SIGTSTP, onstop);
 #endif
 
-#ifdef USG
+#ifdef USE_TERMIOS
+    tcsetattr(0, TCSANOW, &sbuf);
+#elif defined(USG)
     (void) ioctl (0, TCSETAW, (char *) &sbuf);
 #else
     (void) ioctl (0, TIOCSETP, (char *) &sbuf);
@@ -529,7 +568,9 @@ void shescape (buf)
     int		ch;
 #endif
 
-#ifdef USG
+#ifdef USE_TERMIOS
+    tcsetattr(0, TCSANOW, &osbuf);
+#elif defined(USG)
     (void) ioctl (0, TCSETAW, (char *) &osbuf);
 #else
     (void) ioctl (0, TIOCSETP, (char *) &osbuf);
@@ -561,7 +602,9 @@ void shescape (buf)
 	(void) signal (SIGTSTP, onstop);
 #endif
 
-#ifdef USG
+#ifdef USE_TERMIOS
+    tcsetattr(0, TCSANOW, &sbuf);
+#elif defined(USG)
     (void) ioctl (0, TCSETAW, (char *) &sbuf);
 #else
     (void) ioctl (0, TIOCSETP, (char *) &sbuf);