Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-ports-gnome
Path: blob/main/chinese/celvis/files/patch-curses.c
16135 views
1
The following patch seems to fix celvis on my machine. Just place it in
2
the files/ directory.
3
4
--- curses.c 1991-09-21 23:42:07.000000000 +0200
5
+++ curses.c 2007-12-31 15:40:30.000000000 +0100
6
@@ -17,8 +17,13 @@
7
#include "config.h"
8
#include "vi.h"
9
10
+#undef BSD
11
+#undef UNIXV
12
+#define BSD 0
13
+#define UNIXV 1
14
+
15
#if UNIXV
16
-# include <termio.h>
17
+# include <termios.h>
18
#endif
19
20
#if BSD || UNIX7 || MINIX
21
@@ -86,8 +91,8 @@
22
char ERASEKEY; /* backspace key taken from ioctl structure */
23
24
#if UNIXV
25
-static struct termio oldtermio; /* original tty mode */
26
-static struct termio newtermio; /* raw/noecho tty mode */
27
+static struct termios oldtermio; /* original tty mode */
28
+static struct termios newtermio; /* raw/noecho tty mode */
29
#endif
30
31
#if BSD || UNIX7 || MINIX
32
@@ -133,7 +138,7 @@
33
34
/* change the terminal mode to raw/noecho */
35
#if UNIXV
36
- ioctl(2, TCGETA, &oldtermio);
37
+ tcgetattr(2, &oldtermio);
38
#endif
39
40
#if BSD || UNIX7 || MINIX
41
@@ -170,7 +175,7 @@
42
43
/* change the terminal mode back the way it was */
44
#if UNIXV
45
- ioctl(2, TCSETAW, &oldtermio);
46
+ tcsetattr(2, TCSADRAIN, &oldtermio);
47
#endif
48
#if BSD || UNIX7 || MINIX
49
ioctl(2, TIOCSETP, &oldsgttyb);
50
@@ -190,7 +195,7 @@
51
{
52
/* change the terminal mode to raw/noecho */
53
#if UNIXV
54
- ospeed = (oldtermio.c_cflag & CBAUD);
55
+ ospeed = cfgetospeed(&oldtermio);
56
ERASEKEY = oldtermio.c_cc[VERASE];
57
newtermio = oldtermio;
58
newtermio.c_iflag &= (IXON|IXOFF|IXANY|ISTRIP|IGNBRK);
59
@@ -199,7 +204,7 @@
60
newtermio.c_cc[VINTR] = ctrl('C'); /* always use ^C for interrupts */
61
newtermio.c_cc[VEOF] = 1; /* minimum # characters to read */
62
newtermio.c_cc[VEOL] = 2; /* allow at least 0.2 seconds */
63
- ioctl(2, TCSETAW, &newtermio);
64
+ tcsetattr(2, TCSADRAIN, &newtermio);
65
#endif
66
#if BSD || UNIX7 || MINIX
67
struct tchars tbuf;
68
69