From 0aff4e053fe2f4f695c804c96f11852e02ae851a Mon Sep 17 00:00:00 2001 From: dholland Date: Fri, 12 Sep 2014 03:54:13 +0000 Subject: Rip out struct sgttyb. And . This is 2014. Should fix the build on Solaris and most other OSes that don't keep a museum of historical BSD curiosities on tap. Also, make the termios code already present actually work instead of zeroing some things, using uninitialized values for others, and thereby hanging up the tty. Given that some of the logic apparently came from Debian patches, I'm not impressed. (I suppose Linux probably doesn't honor hangup via setting the speed to 0.) While here also fix up the window size handling. Input now works properly for me (on NetBSD) and it didn't before I started mucking around, so it seems like generally a step forward. PKGREVISION -> 1. --- editors/beav/Makefile | 3 +- editors/beav/distinfo | 6 +- editors/beav/patches/patch-ab | 230 ++++++++++++++++++++++++++++++++++++++++-- editors/beav/patches/patch-ac | 60 +++++++++-- 4 files changed, 281 insertions(+), 18 deletions(-) (limited to 'editors') diff --git a/editors/beav/Makefile b/editors/beav/Makefile index 33ace1b8239..8dd3e50c188 100644 --- a/editors/beav/Makefile +++ b/editors/beav/Makefile @@ -1,7 +1,8 @@ -# $NetBSD: Makefile,v 1.14 2012/10/03 11:43:30 asau Exp $ +# $NetBSD: Makefile,v 1.15 2014/09/12 03:54:13 dholland Exp $ DISTNAME= beav_1.40.orig PKGNAME= beav-1.40.18 +PKGREVISION= 1 CATEGORIES= editors MASTER_SITES= ${MASTER_SITE_DEBIAN:=pool/main/b/beav/} diff --git a/editors/beav/distinfo b/editors/beav/distinfo index 048f3ac6449..d31a345f4f9 100644 --- a/editors/beav/distinfo +++ b/editors/beav/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.9 2013/07/18 12:07:24 joerg Exp $ +$NetBSD: distinfo,v 1.10 2014/09/12 03:54:13 dholland Exp $ SHA1 (beav_1.40-18.diff.gz) = 9cd82a3b8de391e1f001d241be1c2c3fadb3efb9 RMD160 (beav_1.40-18.diff.gz) = 0e7b19fdc7ea16e1e24e8302d81dfb247e947603 @@ -7,8 +7,8 @@ SHA1 (beav_1.40.orig.tar.gz) = c610a0c3581c681c26726c8e1e19bf7e38ca8a6a RMD160 (beav_1.40.orig.tar.gz) = 621df359860a8ec9205413520961d4366b1ad8ea Size (beav_1.40.orig.tar.gz) = 128103 bytes SHA1 (patch-aa) = 59a2043fa5da8c326dc0732701b3377ed7422a44 -SHA1 (patch-ab) = 7cb7c7712ed6942ba90a3555879da9eaf894dc72 -SHA1 (patch-ac) = 6c575aa6e69fc4281956310176c12a086c6ae400 +SHA1 (patch-ab) = 3d18ee1e757e96392acc554c131e9174276252b2 +SHA1 (patch-ac) = d232aa9fdd53c42e4e12408605fd82f28ca90843 SHA1 (patch-ad) = 4cb29fa7dab5d5fc7ccff1dff090b189146e32c8 SHA1 (patch-ae) = 9377308aac390dd0130df3fd970f56e2e4826398 SHA1 (patch-af) = 9ff674374a96878a6fbb1babf50620a92aa6a34b diff --git a/editors/beav/patches/patch-ab b/editors/beav/patches/patch-ab index 31fc5dd7a3e..ea4c2761454 100644 --- a/editors/beav/patches/patch-ab +++ b/editors/beav/patches/patch-ab @@ -1,15 +1,229 @@ -$NetBSD: patch-ab,v 1.5 2013/07/18 12:07:24 joerg Exp $ +$NetBSD: patch-ab,v 1.6 2014/09/12 03:54:13 dholland Exp $ ---- termio.c.orig 2013-07-17 14:36:18.000000000 +0000 +Rip out struct sgttyb and termio and other prehistoric stuff. Use only +termios, except leave the OS2 and MINIX cases alone. The latter +probably should be removed too, but let's wait to hear from some Minix +users. + +Also, make the termios code that was already here actually work. + +--- termio.c.orig 2014-09-12 03:38:15.000000000 +0000 +++ termio.c -@@ -14,6 +14,10 @@ +@@ -12,9 +12,6 @@ + #include + #include #include - #ifdef BSD - #include -+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__APPLE__) -+#include +-#ifdef BSD +-#include +-#else + #ifdef OS2 + #ifndef __EMX__ + #define INCL_NOPM +@@ -28,15 +25,10 @@ + #include + #define O_NDELAY O_NONBLOCK + #else +-#ifdef __GLIBC__ ++#include + #include +-#else +-#include +-#endif /* __GLIBC__ */ + #endif /* MINIX */ + #endif /* OS2 */ +-#endif /* BSD */ +-#include + #include + #include "def.h" + int kbdflgs; /* saved keyboard fd flags */ +@@ -44,10 +36,6 @@ int kbdpoll; /* in O_NDELAY mode + int kbdqp; /* there is a char in kbdq */ + char kbdq; /* char we've already read */ + +-#ifdef BSD +-struct sgttyb otermb; +-struct sgttyb ntermb; +-#else + #ifdef OS2 + #ifndef __EMX__ + KBDINFO kbst, kbst_std; +@@ -58,21 +46,12 @@ struct sgttyb otermio; /* original term + struct sgttyb ntermio; /* charactoristics to use inside */ + struct tchars tchars, tcharsorig; + #else +-#ifdef __GLIBC__ +-#include +#include + struct termios otermio; + struct termios ntermio; +-#else +-struct termio otermio; /* original terminal characteristics */ +-struct termio ntermio; /* charactoristics to use inside */ +-#endif /* __GLIBC__ */ + #endif /* MINIX */ + #endif /* OS2 */ +-#endif /* BSD */ + +-#ifndef OS2 +-//extern errno; /* System error number -- Necessary when compiling in BSD 1.13 */ +-#endif + + int nrow; /* Terminal size, rows. */ + int ncol; /* Terminal size, columns. */ +@@ -86,42 +65,37 @@ int ncol; /* Terminal size, columns. + void + ttopen () + { +-#ifdef BSD +-#ifdef ULTRIX ++#if !defined(OS2) && !defined(MINIX) ++ ++#if defined(TIOCGWINSZ) + struct winsize ttysize; +-#else ++#elif defined(TIOCGSIZE) + struct ttysize ttysize; + #endif + +- ioctl (0, TIOCGETP, &otermb); /* save settings */ +- ntermb = otermb; /* setup new settings */ +- ntermb.sg_flags &= ~ECHO; +- ntermb.sg_flags |= RAW; +- ioctl (0, TIOCSETP, &ntermb); /* and activate them */ +- kbdpoll = FALSE; +- + /* on all screens we are not sure of the initial position + of the cursor */ + ttrow = 999; + ttcol = 999; +-#ifdef ULTRIX ++#if defined(TIOCGWINSZ) + if (ioctl (0, TIOCGWINSZ, &ttysize) == 0) + { + nrow = ttysize.ws_row; + ncol = ttysize.ws_col; +-#else ++ } else ++#elif defined(TIOCGSIZE) + if (ioctl (0, TIOCGSIZE, &ttysize) == 0) + { + nrow = ttysize.ts_lines; + ncol = ttysize.ts_cols; ++ } else + #endif /* ULTRIX */ +- } +- else + { + nrow = NROW; + ncol = NCOL; + } +-#else ++#endif /* not OS2 or MINIX */ ++ + #ifdef OS2 + setmode (1, O_BINARY); + #else +@@ -137,33 +111,23 @@ ttopen () + tchars.t_stopc = tchars.t_eofc = tchars.t_brkc = -1; + ioctl (0, TIOCSETC, &tchars); + #else +-#ifdef __GLIBC__ + tcgetattr(0,&otermio); +-#else +- ioctl (0, TCGETA, &otermio);/* save old settings */ +- ntermio.c_line = otermio.c_line; +-#endif ++#if 0 /* horribly wrong -- never do this! */ + ntermio.c_iflag = 0; /* setup new settings */ + ntermio.c_oflag = 0; + ntermio.c_cflag = otermio.c_cflag; + ntermio.c_lflag = 0; ++#else ++ ntermio = otermio; ++ ntermio.c_lflag &= ~(ECHO|ECHONL|ECHOCTL|ISIG|ICANON); +#endif + ntermio.c_cc[VMIN] = 1; + ntermio.c_cc[VTIME] = 0; +-#ifdef __GLIBC__ + tcsetattr(0,TCSANOW,&ntermio); +-#else +- ioctl (0, TCSETAW, &ntermio); /* and activate them */ +-#endif + #endif /* MINIX */ + kbdflgs = fcntl (0, F_GETFL, 0); + kbdpoll = FALSE; + #endif /* OS2 */ +- /* on all screens we are not sure of the initial position of the cursor */ +- ttrow = 999; +- ttcol = 999; +- nrow = NROW; +- ncol = NCOL; +-#endif /* BSD */ + } + + /* +@@ -174,10 +138,6 @@ ttopen () + void + ttclose () + { +-#ifdef BSD +- if (ioctl (0, TIOCSETP, &otermb) == -1) /* restore terminal settings */ +- printf ("closing ioctl on dev 0 failure, error = %d\n", errno); +-#else + #ifdef OS2 + setmode (1, O_TEXT); #else +@@ -186,17 +146,12 @@ ttclose () + ioctl (0, TIOCSETC, &tcharsorig) == -1) + printf ("closing ioctl on dev 0 failure, error = %d\n", errno); + #else +-#ifdef __GLIBC__ + if( tcsetattr(0,TCSANOW,&otermio) == -1) +-#else +- if (ioctl (0, TCSETAW, &otermio) == -1) /* restore terminal settings */ +-#endif + printf ("closing ioctl on dev 0 failure, error = %d\n", errno); + #endif /* MINIX */ + if (fcntl (0, F_SETFL, kbdflgs) == -1) + printf ("closing fcntl on dev 0 failure, error = %d\n", errno); + #endif /* OS2 */ +-#endif /* BSD */ + } + #ifdef OS2 - #ifndef __EMX__ +@@ -235,7 +190,7 @@ ttcooked (void) + #endif + } + +-#endif ++#endif /* OS2 */ + + /* + * Write a character to the display. On VMS, terminal output is buffered, and +@@ -336,7 +291,7 @@ int ttgetc () + kbdqp = FALSE; + else + { +-#ifdef BSD ++#if defined(FIONREAD) + int count; + + if (kbdpoll && (ioctl (0, FIONREAD, &count), count == 0)) +@@ -372,7 +327,7 @@ int ttkeyready () + #else + if (!kbdqp) + { +-#ifdef BSD ++#if defined(FIONREAD) + int count; + + if (!kbdpoll && (ioctl (0, FIONREAD, &count), count == 0)) +@@ -389,7 +344,7 @@ int ttkeyready () + kbdpoll = TRUE; /* fix in 1.13 */ + kbdqp = (1 == read (0, &kbdq, 1)); + #endif /* MINIX */ +-#endif /* BSD */ ++#endif /* FIONREAD */ + + } + return (kbdqp); diff --git a/editors/beav/patches/patch-ac b/editors/beav/patches/patch-ac index 1d7f485032a..d69d1ec28e9 100644 --- a/editors/beav/patches/patch-ac +++ b/editors/beav/patches/patch-ac @@ -1,6 +1,9 @@ -$NetBSD: patch-ac,v 1.2 2007/11/25 12:15:53 wiz Exp $ +$NetBSD: patch-ac,v 1.3 2014/09/12 03:54:13 dholland Exp $ ---- tcap.c.orig 2007-11-25 12:10:44.000000000 +0000 +- Avoid , which only exists where terminfo is in use. +- Fix use of struct winsize/ttysize. + +--- tcap.c.orig 2014-09-12 02:45:55.000000000 +0000 +++ tcap.c @@ -2,7 +2,6 @@ for beav @@ -10,12 +13,57 @@ $NetBSD: patch-ac,v 1.2 2007/11/25 12:15:53 wiz Exp $ #include #include "def.h" #include "prototyp.h" -@@ -41,7 +40,7 @@ char *UP, PC, *CM, *CE, *CL, *SO, *SE, * +@@ -41,11 +40,7 @@ char *UP, PC, *CM, *CE, *CL, *SO, *SE, * #ifdef BSD #include -struct winsize ttysize; -+struct ttysize ttysize; #endif /* BSD */ - #ifdef ULTRIX - struct winsize ttysize; +-#ifdef ULTRIX +-struct winsize ttysize; +-#endif + + void + putpad (str) +@@ -62,8 +57,10 @@ tcapopen () + char tcbuf[1024]; + char *tv_stype; + char err_str[NCOL]; +-#ifdef ULTRIX ++#if defined(TIOCGWINSZ) + struct winsize ttysize; ++#elif defined(TIOCGSIZE) ++ struct ttysize ttysize; + #endif + + nrow = NROW; +@@ -88,25 +85,22 @@ tcapopen () + } + + +-#ifdef BSD +-#ifdef ULTRIX ++#ifndef OS2 ++#if defined(TIOCGWINSZ) + if (ioctl (0, TIOCGWINSZ, &ttysize) == 0 + && ttysize.ws_row > 0) + { + nrow = ttysize.ws_row; + } + else +-#else ++#elif defined(TIOCGSIZE) + if (ioctl (0, TIOCGSIZE, &ttysize) == 0 + && ttysize.ts_lines > 0) + { + nrow = ttysize.ts_lines; + } + else +-#endif /* ULTRIX */ +-#endif /* BSD */ +- +-#ifndef OS2 ++#endif /* TIOCGWINSZ */ + if ((nrow = (short) tgetnum ("li") - 1) == -1) + { + puts ("termcap entry incomplete (lines)\r"); -- cgit v1.2.3