Fri Sep 12 03:54:13 2014 UTC ()
Rip out struct sgttyb. And <termio.h>. 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.


(dholland)
diff -r1.14 -r1.15 pkgsrc/editors/beav/Makefile
diff -r1.9 -r1.10 pkgsrc/editors/beav/distinfo
diff -r1.5 -r1.6 pkgsrc/editors/beav/patches/patch-ab
diff -r1.2 -r1.3 pkgsrc/editors/beav/patches/patch-ac

cvs diff -r1.14 -r1.15 pkgsrc/editors/beav/Makefile (expand / switch to unified diff)

--- pkgsrc/editors/beav/Makefile 2012/10/03 11:43:30 1.14
+++ pkgsrc/editors/beav/Makefile 2014/09/12 03:54:13 1.15
@@ -1,17 +1,18 @@ @@ -1,17 +1,18 @@
1# $NetBSD: Makefile,v 1.14 2012/10/03 11:43:30 asau Exp $ 1# $NetBSD: Makefile,v 1.15 2014/09/12 03:54:13 dholland Exp $
2 2
3DISTNAME= beav_1.40.orig 3DISTNAME= beav_1.40.orig
4PKGNAME= beav-1.40.18 4PKGNAME= beav-1.40.18
 5PKGREVISION= 1
5CATEGORIES= editors 6CATEGORIES= editors
6MASTER_SITES= ${MASTER_SITE_DEBIAN:=pool/main/b/beav/} 7MASTER_SITES= ${MASTER_SITE_DEBIAN:=pool/main/b/beav/}
7 8
8PATCHFILES= beav_1.40-18.diff.gz 9PATCHFILES= beav_1.40-18.diff.gz
9PATCH_SITES= ${MASTER_SITE_DEBIAN:=pool/main/b/beav/} 10PATCH_SITES= ${MASTER_SITE_DEBIAN:=pool/main/b/beav/}
10PATCH_DIST_STRIP= -p1 11PATCH_DIST_STRIP= -p1
11 12
12MAINTAINER= bad@NetBSD.org 13MAINTAINER= bad@NetBSD.org
13COMMENT= Binary Editor And Viewer, a full featured binary file editor 14COMMENT= Binary Editor And Viewer, a full featured binary file editor
14 15
15INSTALLATION_DIRS= bin ${PKGMANDIR}/man1 16INSTALLATION_DIRS= bin ${PKGMANDIR}/man1
16 17
17WRKSRC= ${WRKDIR}/beav-140 18WRKSRC= ${WRKDIR}/beav-140

cvs diff -r1.9 -r1.10 pkgsrc/editors/beav/distinfo (expand / switch to unified diff)

--- pkgsrc/editors/beav/distinfo 2013/07/18 12:07:24 1.9
+++ pkgsrc/editors/beav/distinfo 2014/09/12 03:54:13 1.10
@@ -1,16 +1,16 @@ @@ -1,16 +1,16 @@
1$NetBSD: distinfo,v 1.9 2013/07/18 12:07:24 joerg Exp $ 1$NetBSD: distinfo,v 1.10 2014/09/12 03:54:13 dholland Exp $
2 2
3SHA1 (beav_1.40-18.diff.gz) = 9cd82a3b8de391e1f001d241be1c2c3fadb3efb9 3SHA1 (beav_1.40-18.diff.gz) = 9cd82a3b8de391e1f001d241be1c2c3fadb3efb9
4RMD160 (beav_1.40-18.diff.gz) = 0e7b19fdc7ea16e1e24e8302d81dfb247e947603 4RMD160 (beav_1.40-18.diff.gz) = 0e7b19fdc7ea16e1e24e8302d81dfb247e947603
5Size (beav_1.40-18.diff.gz) = 14218 bytes 5Size (beav_1.40-18.diff.gz) = 14218 bytes
6SHA1 (beav_1.40.orig.tar.gz) = c610a0c3581c681c26726c8e1e19bf7e38ca8a6a 6SHA1 (beav_1.40.orig.tar.gz) = c610a0c3581c681c26726c8e1e19bf7e38ca8a6a
7RMD160 (beav_1.40.orig.tar.gz) = 621df359860a8ec9205413520961d4366b1ad8ea 7RMD160 (beav_1.40.orig.tar.gz) = 621df359860a8ec9205413520961d4366b1ad8ea
8Size (beav_1.40.orig.tar.gz) = 128103 bytes 8Size (beav_1.40.orig.tar.gz) = 128103 bytes
9SHA1 (patch-aa) = 59a2043fa5da8c326dc0732701b3377ed7422a44 9SHA1 (patch-aa) = 59a2043fa5da8c326dc0732701b3377ed7422a44
10SHA1 (patch-ab) = 7cb7c7712ed6942ba90a3555879da9eaf894dc72 10SHA1 (patch-ab) = 3d18ee1e757e96392acc554c131e9174276252b2
11SHA1 (patch-ac) = 6c575aa6e69fc4281956310176c12a086c6ae400 11SHA1 (patch-ac) = d232aa9fdd53c42e4e12408605fd82f28ca90843
12SHA1 (patch-ad) = 4cb29fa7dab5d5fc7ccff1dff090b189146e32c8 12SHA1 (patch-ad) = 4cb29fa7dab5d5fc7ccff1dff090b189146e32c8
13SHA1 (patch-ae) = 9377308aac390dd0130df3fd970f56e2e4826398 13SHA1 (patch-ae) = 9377308aac390dd0130df3fd970f56e2e4826398
14SHA1 (patch-af) = 9ff674374a96878a6fbb1babf50620a92aa6a34b 14SHA1 (patch-af) = 9ff674374a96878a6fbb1babf50620a92aa6a34b
15SHA1 (patch-ag) = 6376ad9d23b48bf3249700c9ab8e8361aa497253 15SHA1 (patch-ag) = 6376ad9d23b48bf3249700c9ab8e8361aa497253
16SHA1 (patch-ai) = 83071e6e15bd3875c278660db9038b249ec2f64d 16SHA1 (patch-ai) = 83071e6e15bd3875c278660db9038b249ec2f64d

cvs diff -r1.5 -r1.6 pkgsrc/editors/beav/patches/patch-ab (expand / switch to unified diff)

--- pkgsrc/editors/beav/patches/patch-ab 2013/07/18 12:07:24 1.5
+++ pkgsrc/editors/beav/patches/patch-ab 2014/09/12 03:54:13 1.6
@@ -1,15 +1,229 @@ @@ -1,15 +1,229 @@
1$NetBSD: patch-ab,v 1.5 2013/07/18 12:07:24 joerg Exp $ 1$NetBSD: patch-ab,v 1.6 2014/09/12 03:54:13 dholland Exp $
2 2
3--- termio.c.orig 2013-07-17 14:36:18.000000000 +0000 3Rip out struct sgttyb and termio and other prehistoric stuff. Use only
 4termios, except leave the OS2 and MINIX cases alone. The latter
 5probably should be removed too, but let's wait to hear from some Minix
 6users.
 7
 8Also, make the termios code that was already here actually work.
 9
 10--- termio.c.orig 2014-09-12 03:38:15.000000000 +0000
4+++ termio.c 11+++ termio.c
5@@ -14,6 +14,10 @@ 12@@ -12,9 +12,6 @@
 13 #include <errno.h>
 14 #include <stdio.h>
6 #include <signal.h> 15 #include <signal.h>
7 #ifdef BSD 16-#ifdef BSD
8 #include <sys/ioctl.h> 17-#include <sys/ioctl.h>
9+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__APPLE__) 18-#else
10+#include <sys/ioctl_compat.h> 19 #ifdef OS2
 20 #ifndef __EMX__
 21 #define INCL_NOPM
 22@@ -28,15 +25,10 @@
 23 #include <sgtty.h>
 24 #define O_NDELAY O_NONBLOCK
 25 #else
 26-#ifdef __GLIBC__
 27+#include <sys/ioctl.h>
 28 #include <termios.h>
 29-#else
 30-#include <termio.h>
 31-#endif /* __GLIBC__ */
 32 #endif /* MINIX */
 33 #endif /* OS2 */
 34-#endif /* BSD */
 35-#include <errno.h>
 36 #include <fcntl.h>
 37 #include "def.h"
 38 int kbdflgs; /* saved keyboard fd flags */
 39@@ -44,10 +36,6 @@ int kbdpoll; /* in O_NDELAY mode
 40 int kbdqp; /* there is a char in kbdq */
 41 char kbdq; /* char we've already read */
 42
 43-#ifdef BSD
 44-struct sgttyb otermb;
 45-struct sgttyb ntermb;
 46-#else
 47 #ifdef OS2
 48 #ifndef __EMX__
 49 KBDINFO kbst, kbst_std;
 50@@ -58,21 +46,12 @@ struct sgttyb otermio; /* original term
 51 struct sgttyb ntermio; /* charactoristics to use inside */
 52 struct tchars tchars, tcharsorig;
 53 #else
 54-#ifdef __GLIBC__
 55-#include <sys/ioctl.h>
11+#include <termios.h> 56+#include <termios.h>
 57 struct termios otermio;
 58 struct termios ntermio;
 59-#else
 60-struct termio otermio; /* original terminal characteristics */
 61-struct termio ntermio; /* charactoristics to use inside */
 62-#endif /* __GLIBC__ */
 63 #endif /* MINIX */
 64 #endif /* OS2 */
 65-#endif /* BSD */
 66
 67-#ifndef OS2
 68-//extern errno; /* System error number -- Necessary when compiling in BSD 1.13 */
 69-#endif
 70
 71 int nrow; /* Terminal size, rows. */
 72 int ncol; /* Terminal size, columns. */
 73@@ -86,42 +65,37 @@ int ncol; /* Terminal size, columns.
 74 void
 75 ttopen ()
 76 {
 77-#ifdef BSD
 78-#ifdef ULTRIX
 79+#if !defined(OS2) && !defined(MINIX)
 80+
 81+#if defined(TIOCGWINSZ)
 82 struct winsize ttysize;
 83-#else
 84+#elif defined(TIOCGSIZE)
 85 struct ttysize ttysize;
 86 #endif
 87
 88- ioctl (0, TIOCGETP, &otermb); /* save settings */
 89- ntermb = otermb; /* setup new settings */
 90- ntermb.sg_flags &= ~ECHO;
 91- ntermb.sg_flags |= RAW;
 92- ioctl (0, TIOCSETP, &ntermb); /* and activate them */
 93- kbdpoll = FALSE;
 94-
 95 /* on all screens we are not sure of the initial position
 96 of the cursor */
 97 ttrow = 999;
 98 ttcol = 999;
 99-#ifdef ULTRIX
 100+#if defined(TIOCGWINSZ)
 101 if (ioctl (0, TIOCGWINSZ, &ttysize) == 0)
 102 {
 103 nrow = ttysize.ws_row;
 104 ncol = ttysize.ws_col;
 105-#else
 106+ } else
 107+#elif defined(TIOCGSIZE)
 108 if (ioctl (0, TIOCGSIZE, &ttysize) == 0)
 109 {
 110 nrow = ttysize.ts_lines;
 111 ncol = ttysize.ts_cols;
 112+ } else
 113 #endif /* ULTRIX */
 114- }
 115- else
 116 {
 117 nrow = NROW;
 118 ncol = NCOL;
 119 }
 120-#else
 121+#endif /* not OS2 or MINIX */
 122+
 123 #ifdef OS2
 124 setmode (1, O_BINARY);
 125 #else
 126@@ -137,33 +111,23 @@ ttopen ()
 127 tchars.t_stopc = tchars.t_eofc = tchars.t_brkc = -1;
 128 ioctl (0, TIOCSETC, &tchars);
 129 #else
 130-#ifdef __GLIBC__
 131 tcgetattr(0,&otermio);
 132-#else
 133- ioctl (0, TCGETA, &otermio);/* save old settings */
 134- ntermio.c_line = otermio.c_line;
 135-#endif
 136+#if 0 /* horribly wrong -- never do this! */
 137 ntermio.c_iflag = 0; /* setup new settings */
 138 ntermio.c_oflag = 0;
 139 ntermio.c_cflag = otermio.c_cflag;
 140 ntermio.c_lflag = 0;
 141+#else
 142+ ntermio = otermio;
 143+ ntermio.c_lflag &= ~(ECHO|ECHONL|ECHOCTL|ISIG|ICANON);
12+#endif 144+#endif
 145 ntermio.c_cc[VMIN] = 1;
 146 ntermio.c_cc[VTIME] = 0;
 147-#ifdef __GLIBC__
 148 tcsetattr(0,TCSANOW,&ntermio);
 149-#else
 150- ioctl (0, TCSETAW, &ntermio); /* and activate them */
 151-#endif
 152 #endif /* MINIX */
 153 kbdflgs = fcntl (0, F_GETFL, 0);
 154 kbdpoll = FALSE;
 155 #endif /* OS2 */
 156- /* on all screens we are not sure of the initial position of the cursor */
 157- ttrow = 999;
 158- ttcol = 999;
 159- nrow = NROW;
 160- ncol = NCOL;
 161-#endif /* BSD */
 162 }
 163
 164 /*
 165@@ -174,10 +138,6 @@ ttopen ()
 166 void
 167 ttclose ()
 168 {
 169-#ifdef BSD
 170- if (ioctl (0, TIOCSETP, &otermb) == -1) /* restore terminal settings */
 171- printf ("closing ioctl on dev 0 failure, error = %d\n", errno);
 172-#else
 173 #ifdef OS2
 174 setmode (1, O_TEXT);
13 #else 175 #else
 176@@ -186,17 +146,12 @@ ttclose ()
 177 ioctl (0, TIOCSETC, &tcharsorig) == -1)
 178 printf ("closing ioctl on dev 0 failure, error = %d\n", errno);
 179 #else
 180-#ifdef __GLIBC__
 181 if( tcsetattr(0,TCSANOW,&otermio) == -1)
 182-#else
 183- if (ioctl (0, TCSETAW, &otermio) == -1) /* restore terminal settings */
 184-#endif
 185 printf ("closing ioctl on dev 0 failure, error = %d\n", errno);
 186 #endif /* MINIX */
 187 if (fcntl (0, F_SETFL, kbdflgs) == -1)
 188 printf ("closing fcntl on dev 0 failure, error = %d\n", errno);
 189 #endif /* OS2 */
 190-#endif /* BSD */
 191 }
 192
14 #ifdef OS2 193 #ifdef OS2
15 #ifndef __EMX__ 194@@ -235,7 +190,7 @@ ttcooked (void)
 195 #endif
 196 }
 197
 198-#endif
 199+#endif /* OS2 */
 200
 201 /*
 202 * Write a character to the display. On VMS, terminal output is buffered, and
 203@@ -336,7 +291,7 @@ int ttgetc ()
 204 kbdqp = FALSE;
 205 else
 206 {
 207-#ifdef BSD
 208+#if defined(FIONREAD)
 209 int count;
 210
 211 if (kbdpoll && (ioctl (0, FIONREAD, &count), count == 0))
 212@@ -372,7 +327,7 @@ int ttkeyready ()
 213 #else
 214 if (!kbdqp)
 215 {
 216-#ifdef BSD
 217+#if defined(FIONREAD)
 218 int count;
 219
 220 if (!kbdpoll && (ioctl (0, FIONREAD, &count), count == 0))
 221@@ -389,7 +344,7 @@ int ttkeyready ()
 222 kbdpoll = TRUE; /* fix in 1.13 */
 223 kbdqp = (1 == read (0, &kbdq, 1));
 224 #endif /* MINIX */
 225-#endif /* BSD */
 226+#endif /* FIONREAD */
 227
 228 }
 229 return (kbdqp);

cvs diff -r1.2 -r1.3 pkgsrc/editors/beav/patches/patch-ac (expand / switch to unified diff)

--- pkgsrc/editors/beav/patches/patch-ac 2007/11/25 12:15:53 1.2
+++ pkgsrc/editors/beav/patches/patch-ac 2014/09/12 03:54:13 1.3
@@ -1,21 +1,69 @@ @@ -1,21 +1,69 @@
1$NetBSD: patch-ac,v 1.2 2007/11/25 12:15:53 wiz Exp $ 1$NetBSD: patch-ac,v 1.3 2014/09/12 03:54:13 dholland Exp $
2 2
3--- tcap.c.orig 2007-11-25 12:10:44.000000000 +0000 3- Avoid <term.h>, which only exists where terminfo is in use.
 4- Fix use of struct winsize/ttysize.
 5
 6--- tcap.c.orig 2014-09-12 02:45:55.000000000 +0000
4+++ tcap.c 7+++ tcap.c
5@@ -2,7 +2,6 @@ 8@@ -2,7 +2,6 @@
6 for beav 9 for beav
7 */ 10 */
8  11
9-#include <term.h> 12-#include <term.h>
10 #include <stdlib.h> 13 #include <stdlib.h>
11 #include "def.h" 14 #include "def.h"
12 #include "prototyp.h" 15 #include "prototyp.h"
13@@ -41,7 +40,7 @@ char *UP, PC, *CM, *CE, *CL, *SO, *SE, * 16@@ -41,11 +40,7 @@ char *UP, PC, *CM, *CE, *CL, *SO, *SE, *
14  17
15 #ifdef BSD 18 #ifdef BSD
16 #include <sys/ioctl.h> 19 #include <sys/ioctl.h>
17-struct winsize ttysize; 20-struct winsize ttysize;
18+struct ttysize ttysize; 
19 #endif /* BSD */ 21 #endif /* BSD */
20 #ifdef ULTRIX 22-#ifdef ULTRIX
21 struct winsize ttysize; 23-struct winsize ttysize;
 24-#endif
 25
 26 void
 27 putpad (str)
 28@@ -62,8 +57,10 @@ tcapopen ()
 29 char tcbuf[1024];
 30 char *tv_stype;
 31 char err_str[NCOL];
 32-#ifdef ULTRIX
 33+#if defined(TIOCGWINSZ)
 34 struct winsize ttysize;
 35+#elif defined(TIOCGSIZE)
 36+ struct ttysize ttysize;
 37 #endif
 38
 39 nrow = NROW;
 40@@ -88,25 +85,22 @@ tcapopen ()
 41 }
 42
 43
 44-#ifdef BSD
 45-#ifdef ULTRIX
 46+#ifndef OS2
 47+#if defined(TIOCGWINSZ)
 48 if (ioctl (0, TIOCGWINSZ, &ttysize) == 0
 49 && ttysize.ws_row > 0)
 50 {
 51 nrow = ttysize.ws_row;
 52 }
 53 else
 54-#else
 55+#elif defined(TIOCGSIZE)
 56 if (ioctl (0, TIOCGSIZE, &ttysize) == 0
 57 && ttysize.ts_lines > 0)
 58 {
 59 nrow = ttysize.ts_lines;
 60 }
 61 else
 62-#endif /* ULTRIX */
 63-#endif /* BSD */
 64-
 65-#ifndef OS2
 66+#endif /* TIOCGWINSZ */
 67 if ((nrow = (short) tgetnum ("li") - 1) == -1)
 68 {
 69 puts ("termcap entry incomplete (lines)\r");