pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/editors/beav Rip out struct sgttyb. And <termio.h>. Th...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/4deba31ceda5
branches:  trunk
changeset: 639380:4deba31ceda5
user:      dholland <dholland%pkgsrc.org@localhost>
date:      Fri Sep 12 03:54:13 2014 +0000

description:
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.

diffstat:

 editors/beav/Makefile         |    3 +-
 editors/beav/distinfo         |    6 +-
 editors/beav/patches/patch-ab |  232 ++++++++++++++++++++++++++++++++++++++++-
 editors/beav/patches/patch-ac |   60 +++++++++-
 4 files changed, 282 insertions(+), 19 deletions(-)

diffs (truncated from 352 to 300 lines):

diff -r babb20a02e49 -r 4deba31ceda5 editors/beav/Makefile
--- a/editors/beav/Makefile     Thu Sep 11 22:00:55 2014 +0000
+++ b/editors/beav/Makefile     Fri Sep 12 03:54:13 2014 +0000
@@ -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 -r babb20a02e49 -r 4deba31ceda5 editors/beav/distinfo
--- a/editors/beav/distinfo     Thu Sep 11 22:00:55 2014 +0000
+++ b/editors/beav/distinfo     Fri Sep 12 03:54:13 2014 +0000
@@ -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 @@
 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 -r babb20a02e49 -r 4deba31ceda5 editors/beav/patches/patch-ab
--- a/editors/beav/patches/patch-ab     Thu Sep 11 22:00:55 2014 +0000
+++ b/editors/beav/patches/patch-ab     Fri Sep 12 03:54:13 2014 +0000
@@ -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 $
+
+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.
 
---- termio.c.orig      2013-07-17 14:36:18.000000000 +0000
+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    <errno.h>
+ #include    <stdio.h>
  #include    <signal.h>
- #ifdef BSD
- #include    <sys/ioctl.h>
-+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__APPLE__)
-+#include <sys/ioctl_compat.h>
-+#include <termios.h>
-+#endif
+-#ifdef BSD
+-#include    <sys/ioctl.h>
+-#else
+ #ifdef OS2
+ #ifndef __EMX__
+ #define INCL_NOPM
+@@ -28,15 +25,10 @@
+ #include    <sgtty.h>
+ #define O_NDELAY O_NONBLOCK
  #else
+-#ifdef __GLIBC__
++#include <sys/ioctl.h>
+ #include <termios.h>
+-#else 
+-#include <termio.h>
+-#endif /* __GLIBC__ */
+ #endif /* MINIX */
+ #endif /* OS2 */
+-#endif /* BSD */
+-#include    <errno.h>
+ #include    <fcntl.h>
+ #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 <sys/ioctl.h>
++#include <termios.h>
+ 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
+@@ -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 -r babb20a02e49 -r 4deba31ceda5 editors/beav/patches/patch-ac
--- a/editors/beav/patches/patch-ac     Thu Sep 11 22:00:55 2014 +0000
+++ b/editors/beav/patches/patch-ac     Fri Sep 12 03:54:13 2014 +0000
@@ -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 <term.h>, 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 @@
  #include <stdlib.h>
  #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 <sys/ioctl.h>
 -struct winsize ttysize;



Home | Main Index | Thread Index | Old Index