Path: blob/main/chinese/celvis/files/patch-curses.c
16135 views
The following patch seems to fix celvis on my machine. Just place it in1the files/ directory.23--- curses.c 1991-09-21 23:42:07.000000000 +02004+++ curses.c 2007-12-31 15:40:30.000000000 +01005@@ -17,8 +17,13 @@6#include "config.h"7#include "vi.h"89+#undef BSD10+#undef UNIXV11+#define BSD 012+#define UNIXV 113+14#if UNIXV15-# include <termio.h>16+# include <termios.h>17#endif1819#if BSD || UNIX7 || MINIX20@@ -86,8 +91,8 @@21char ERASEKEY; /* backspace key taken from ioctl structure */2223#if UNIXV24-static struct termio oldtermio; /* original tty mode */25-static struct termio newtermio; /* raw/noecho tty mode */26+static struct termios oldtermio; /* original tty mode */27+static struct termios newtermio; /* raw/noecho tty mode */28#endif2930#if BSD || UNIX7 || MINIX31@@ -133,7 +138,7 @@3233/* change the terminal mode to raw/noecho */34#if UNIXV35- ioctl(2, TCGETA, &oldtermio);36+ tcgetattr(2, &oldtermio);37#endif3839#if BSD || UNIX7 || MINIX40@@ -170,7 +175,7 @@4142/* change the terminal mode back the way it was */43#if UNIXV44- ioctl(2, TCSETAW, &oldtermio);45+ tcsetattr(2, TCSADRAIN, &oldtermio);46#endif47#if BSD || UNIX7 || MINIX48ioctl(2, TIOCSETP, &oldsgttyb);49@@ -190,7 +195,7 @@50{51/* change the terminal mode to raw/noecho */52#if UNIXV53- ospeed = (oldtermio.c_cflag & CBAUD);54+ ospeed = cfgetospeed(&oldtermio);55ERASEKEY = oldtermio.c_cc[VERASE];56newtermio = oldtermio;57newtermio.c_iflag &= (IXON|IXOFF|IXANY|ISTRIP|IGNBRK);58@@ -199,7 +204,7 @@59newtermio.c_cc[VINTR] = ctrl('C'); /* always use ^C for interrupts */60newtermio.c_cc[VEOF] = 1; /* minimum # characters to read */61newtermio.c_cc[VEOL] = 2; /* allow at least 0.2 seconds */62- ioctl(2, TCSETAW, &newtermio);63+ tcsetattr(2, TCSADRAIN, &newtermio);64#endif65#if BSD || UNIX7 || MINIX66struct tchars tbuf;676869