summaryrefslogtreecommitdiff
path: root/lang/ucblogo/patches/patch-term.c
diff options
context:
space:
mode:
authordholland <dholland@pkgsrc.org>2015-11-09 07:18:34 +0000
committerdholland <dholland@pkgsrc.org>2015-11-09 07:18:34 +0000
commit44cc1124bfc516bcaf90b019b7213950d7ed3e58 (patch)
tree4759229388ac1ff4c78f0bf4adf05dcca3fda7ef /lang/ucblogo/patches/patch-term.c
parent421a8add3b905430fec1ff07dad9000917e61b79 (diff)
downloadpkgsrc-44cc1124bfc516bcaf90b019b7213950d7ed3e58.tar.gz
Use termios unconditionally; forget about legacy sysv termio and legacy
bsd sgtty.h.
Diffstat (limited to 'lang/ucblogo/patches/patch-term.c')
-rw-r--r--lang/ucblogo/patches/patch-term.c97
1 files changed, 94 insertions, 3 deletions
diff --git a/lang/ucblogo/patches/patch-term.c b/lang/ucblogo/patches/patch-term.c
index a9511929a2a..eb73272cafb 100644
--- a/lang/ucblogo/patches/patch-term.c
+++ b/lang/ucblogo/patches/patch-term.c
@@ -1,8 +1,38 @@
-$NetBSD: patch-term.c,v 1.1 2013/07/18 12:05:09 joerg Exp $
+$NetBSD: patch-term.c,v 1.2 2015/11/09 07:18:34 dholland Exp $
---- term.c.orig 2002-10-03 16:54:33.000000000 +0000
+- unconditionally use termios, not legacy termio or sgtty.h
+- unconditionally include term.h for termcap stuff
+
+--- term.c.orig 2008-09-14 04:57:09.000000000 +0000
+++ term.c
-@@ -53,6 +53,9 @@
+@@ -30,26 +30,11 @@
+ #include <console.h>
+ #endif
+
+-#ifdef HAVE_TERMIO_H
+-#ifdef HAVE_WX
+-#include <termios.h>
+-#else
+-#include <termio.h>
+-#endif
+-#else
+-#ifdef HAVE_SGTTY_H
+-#include <sgtty.h>
+-#endif
+-#endif
+-
+ #undef TRUE
+ #undef FALSE
+
+ #ifdef HAVE_TERMCAP_H
+ #include <termcap.h>
+-#ifdef HAVE_SGTTY_H
+-#include <sgtty.h>
+-#endif
+ #else
+ #ifdef HAVE_TERMLIB_H
+ #include <termlib.h>
+@@ -60,6 +45,9 @@
#endif
#endif
@@ -12,3 +42,64 @@ $NetBSD: patch-term.c,v 1.1 2013/07/18 12:05:09 joerg Exp $
#undef TRUE
#undef FALSE
+@@ -78,13 +66,7 @@ char cm_arr[40];
+ char so_arr[40];
+ char se_arr[40];
+
+-#ifdef HAVE_TERMIO_H
+-struct termio tty_cooked, tty_cbreak;
+-#else
+-#ifdef HAVE_SGTTY_H
+-struct sgttyb tty_cooked, tty_cbreak;
+-#endif
+-#endif
++struct termios tty_cooked, tty_cbreak;
+
+ int interactive, tty_charmode;
+
+@@ -132,18 +114,11 @@ void term_init(void) {
+ #endif /* WIN32 */
+ #else
+ if (interactive) {
+-#ifdef HAVE_TERMIO_H
+- ioctl(0,TCGETA,(char *)(&tty_cooked));
++ tcgetattr(0, &tty_cooked);
+ tty_cbreak = tty_cooked;
+ tty_cbreak.c_cc[VMIN] = '\01';
+ tty_cbreak.c_cc[VTIME] = '\0';
+ tty_cbreak.c_lflag &= ~(ECHO|ICANON);
+-#else
+- ioctl(0,TIOCGETP,(char *)(&tty_cooked));
+- tty_cbreak = tty_cooked;
+- tty_cbreak.sg_flags |= CBREAK;
+- tty_cbreak.sg_flags &= ~ECHO;
+-#endif
+ }
+ tty_charmode = 0;
+ tgetent(bp, getenv("TERM"));
+@@ -188,11 +163,7 @@ void term_init(void) {
+ void charmode_on() {
+ #ifdef unix
+ if ((readstream == stdin) && interactive && !tty_charmode) {
+-#ifdef HAVE_TERMIO_H
+- ioctl(0,TCSETA,(char *)(&tty_cbreak));
+-#else /* !HAVE_TERMIO_H */
+- ioctl(0,TIOCSETP,(char *)(&tty_cbreak));
+-#endif /* HAVE_TERMIO_H */
++ tcsetattr(0, TCSANOW, &tty_cbreak);
+ tty_charmode++;
+ }
+ #endif /* unix */
+@@ -204,11 +175,7 @@ void charmode_on() {
+ void charmode_off() {
+ #ifdef unix
+ if (tty_charmode) {
+-#ifdef HAVE_TERMIO_H
+- ioctl(0,TCSETA,(char *)(&tty_cooked));
+-#else /* !HAVE_TERMIO_H */
+- ioctl(0,TIOCSETP,(char *)(&tty_cooked));
+-#endif /* HAVE_TERMIO_H */
++ tcsetattr(0, TCSANOW, &tty_cooked);
+ tty_charmode = 0;
+ }
+ #endif /* unix */