File: termios.patch

package info (click to toggle)
elvis-tiny 1.4-26
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,128 kB
  • sloc: ansic: 13,810; sh: 25; makefile: 13
file content (69 lines) | stat: -rw-r--r-- 2,111 bytes parent folder | download
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
diff '--exclude=debian' -ruN x/elvis-tiny-1.4.orig/curses.c elvis-tiny-1.4/curses.c
--- a/curses.c
+++ b/curses.c
@@ -19,7 +19,7 @@
 
 #if ANY_UNIX
 # if UNIXV
-#  include	<termio.h>
+#  include	<termios.h>
 #  undef	TIOCWINSZ	/* we can't handle it correctly yet */
 # else
 #  include	<sgtty.h>
@@ -101,8 +101,8 @@ char	ERASEKEY;	/* backspace key taken fr
 
 #if ANY_UNIX
 # if UNIXV
-static struct termio	oldtermio;	/* original tty mode */
-static struct termio	newtermio;	/* cbreak/noecho tty mode */
+static struct termios	oldtermio;	/* original tty mode */
+static struct termios	newtermio;	/* cbreak/noecho tty mode */
 # else
 static struct sgttyb	oldsgttyb;	/* original tty mode */
 static struct sgttyb	newsgttyb;	/* cbreak/nl/noecho tty mode */
@@ -160,7 +160,7 @@ void initscr()
 	/* change the terminal mode to cbreak/noecho */
 #if ANY_UNIX
 # if UNIXV
-	ioctl(2, TCGETA, &oldtermio);
+	tcgetattr(2, &oldtermio);
 # else
 	ioctl(2, TIOCGETP, &oldsgttyb);
 # endif
@@ -209,7 +209,7 @@ void suspend_curses()
 	/* change the terminal mode back the way it was */
 #if ANY_UNIX
 # if UNIXV
-	ioctl(2, TCSETAW, &oldtermio);
+	tcsetattr(2, TCSANOW, &oldtermio);
 # else
 	ioctl(2, TIOCSETP, &oldsgttyb);
 
@@ -239,19 +239,25 @@ void resume_curses(quietly)
 		/* change the terminal mode to cbreak/noecho */
 #if ANY_UNIX
 # if UNIXV
-		ospeed = (oldtermio.c_cflag & CBAUD);
+		ospeed = cfgetospeed(&oldtermio);
 		ERASEKEY = oldtermio.c_cc[VERASE];
 		newtermio = oldtermio;
 		newtermio.c_iflag &= (IXON|IXOFF|IXANY|ISTRIP|IGNBRK);
 		newtermio.c_oflag &= ~OPOST;
 		newtermio.c_lflag &= ISIG;
 		newtermio.c_cc[VINTR] = ctrl('C'); /* always use ^C for interrupts */
+#ifdef VSUSP
+		newtermio.c_cc[VSUSP] = 0;	/* disable ^Z for elvis */
+#endif
+#ifdef VLNEXT
+		newtermio.c_cc[VLNEXT] = 0;		/* disable ^V for elvis */
+#endif
 		newtermio.c_cc[VMIN] = 1;
 		newtermio.c_cc[VTIME] = 0;
 #  ifdef VSWTCH
 		newtermio.c_cc[VSWTCH] = 0;
 #  endif
-		ioctl(2, TCSETAW, &newtermio);
+		tcsetattr(2, TCSANOW, &newtermio);
 # else /* BSD or V7 or Coherent or Minix */
 		struct tchars	tbuf;
 #  ifdef TIOCSLTC