This switches the editors/beav port from old 4.3BSD tty ioctls to
termios.  While there, I also did a general overhaul of the port:
* Use the latest (2004) Debian version as upstream.
* Improved description, from Debian.
* Miscellaneous clean-up.

I don't know if Kevin still wants to be listed as maintainer...

ok?

Index: Makefile
===================================================================
RCS file: /cvs/ports/editors/beav/Makefile,v
retrieving revision 1.26
diff -u -p -r1.26 Makefile
--- Makefile    11 Mar 2013 11:02:49 -0000      1.26
+++ Makefile    11 Dec 2013 20:40:06 -0000
@@ -2,23 +2,37 @@
 
 COMMENT=       binary editor and viewer
 
-DISTNAME=      beav_1.40-15
-PKGNAME=       beav-1.40.15
+VERSION=       1.40
+# Debian
+REV=           18
+
+DISTNAME=      beav-140
+PKGNAME=       beav-${VERSION}.${REV}
 CATEGORIES=    editors
 
 MAINTAINER=    Kevin Lo <ke...@openbsd.org>
 
+# GPLv2+
 PERMIT_PACKAGE_CDROM=  Yes
-WANTLIB=               c curses
+
+WANTLIB=       c ncurses
 
 MASTER_SITES=  ${MASTER_SITE_DEBIAN:=main/b/beav/}
 
-WRKDIST=       ${WRKDIR}/beav-1.40
+DISTFILES=     beav_${VERSION}.orig.tar.gz
+PATCHFILES=    beav_${VERSION}-${REV}.diff.gz
+PATCH_DIST_STRIP=-p1
+
+ALL_TARGET=    beav
+MAKE_FLAGS=    CC="${CC}" CFLAGS="${CFLAGS} -DUNIX -DBSD"
 
-USE_GROFF =    Yes
 NO_TEST=       Yes
 
-post-install:
+do-install:
+       ${INSTALL_PROGRAM} ${WRKBUILD}/beav ${PREFIX}/bin
+       ${INSTALL_MAN} ${WRKSRC}/beav.1 ${PREFIX}/man/man1
+       ${INSTALL_DATA_DIR} ${PREFIX}/share/doc/beav
+       ${INSTALL_DATA} ${WRKSRC}/beav140.txt ${PREFIX}/share/doc/beav/beav.txt
        @perl -i -pe 's:%%PREFIX%%:${TRUEPREFIX}:' ${PREFIX}/man/man1/beav.1
 
 .include <bsd.port.mk>
Index: distinfo
===================================================================
RCS file: /cvs/ports/editors/beav/distinfo,v
retrieving revision 1.4
diff -u -p -r1.4 distinfo
--- distinfo    5 Apr 2007 15:38:07 -0000       1.4
+++ distinfo    11 Dec 2013 20:40:06 -0000
@@ -1,5 +1,4 @@
-MD5 (beav_1.40-15.tar.gz) = smFBn67WFcUAwwr0ZPzgHQ==
-RMD160 (beav_1.40-15.tar.gz) = m/QcFl1y7HYmFAQrIe6FirDzqmM=
-SHA1 (beav_1.40-15.tar.gz) = ig6SLfKVUEOrKYJEsUmL2viaLhs=
-SHA256 (beav_1.40-15.tar.gz) = 3ANhHD0dn8KN6VVr2j+tAADWys5/9EAbeRv8ToUMfBE=
-SIZE (beav_1.40-15.tar.gz) = 131476
+SHA256 (beav_1.40-18.diff.gz) = eQRiTnHK1MOtybAgAnjoQXLxNog9bi/Mytl3+Q0XY6M=
+SHA256 (beav_1.40.orig.tar.gz) = etkF5BJL8QXKDiE9ghK+0jFVmCWsEViHlLm+epE5ndw=
+SIZE (beav_1.40-18.diff.gz) = 14218
+SIZE (beav_1.40.orig.tar.gz) = 128103
Index: patches/patch-Makefile
===================================================================
RCS file: patches/patch-Makefile
diff -N patches/patch-Makefile
--- patches/patch-Makefile      22 May 2010 15:05:29 -0000      1.4
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,32 +0,0 @@
-$OpenBSD: patch-Makefile,v 1.4 2010/05/22 15:05:29 espie Exp $
---- Makefile.orig      Sat Dec 13 09:34:59 1997
-+++ Makefile   Sat May 22 16:56:49 2010
-@@ -1,7 +1,6 @@
- # This is the makefile for BSD UNIX
- #CFLAGS=     -g -DUNIX
--CFLAGS=     -O2 -DUNIX
--CC=gcc
-+CFLAGS+=     -DUNIX -DBSD
- 
- OFILES=               basic.o ebcdic.o fileio.o region.o text.o wangpc.o \
-       buffer.o echo.o language.o main.o search.o tty.o window.o \
-@@ -16,10 +15,16 @@ CFILES=     basic.c ebcdic.c fileio.c region.c text.c 
- 
- HFILES=     def.h prototyp.h
- 
--beav:     $(OFILES)
--      $(CC) $(CFLAGS) $(OFILES) -lncurses -o beav
-+all beav:     $(OFILES)
-+      $(CC) $(CFLAGS) $(OFILES) -lcurses -o beav
- 
-+install: beav
-+      $(BSD_INSTALL_PROGRAM) beav $(PREFIX)/bin
-+      mkdir -p $(PREFIX)/share/doc/beav
-+      $(BSD_INSTALL_DATA) beav140.txt $(PREFIX)/share/doc/beav/beav.txt
-+      $(BSD_INSTALL_MAN) beav.1 $(PREFIX)/man/man1
-+
- clean:
-       rm -f *.o beav
- 
--(OFILES):  $(HFILES)
-+$(OFILES):  $(HFILES)
Index: patches/patch-beav_1
===================================================================
RCS file: /cvs/ports/editors/beav/patches/patch-beav_1,v
retrieving revision 1.3
diff -u -p -r1.3 patch-beav_1
--- patches/patch-beav_1        22 May 2010 15:05:29 -0000      1.3
+++ patches/patch-beav_1        11 Dec 2013 20:40:06 -0000
@@ -1,10 +1,19 @@
 $OpenBSD: patch-beav_1,v 1.3 2010/05/22 15:05:29 espie Exp $
---- beav.1.orig        Sun Aug 20 20:05:22 1995
-+++ beav.1     Sat May 22 16:56:49 2010
+--- beav.1.orig        Wed Dec 11 16:58:55 2013
++++ beav.1     Wed Dec 11 17:12:31 2013
+@@ -23,7 +23,7 @@ These commands can be used to navigate around the wind
+ .br
+ \fImove-back-line\fB      Ctl-P\fB     moves up\fR
+ .br
+-\fImove-forw-char\fb      Ctl-F\fB     moves right\fR
++\fImove-forw-char\fB      Ctl-F\fB     moves right\fR
+ .br
+ \fImove-forw-line\fB      Ctl-N\fB     moves down\fR
+ .br
 @@ -59,5 +59,5 @@ The \fIquit-no-save\fR command,\fB Ctl-X Ctl-C\fR, wil
  If there is any data that has not been saved you will be warned.
  .PP
  .SH FILES
--/usr/doc/beav/beav.txt
+-/usr/share/doc/beav/beav140.txt.gz
 +%%PREFIX%%/share/doc/beav/beav.txt
  
Index: patches/patch-def_h
===================================================================
RCS file: /cvs/ports/editors/beav/patches/patch-def_h,v
retrieving revision 1.2
diff -u -p -r1.2 patch-def_h
--- patches/patch-def_h 22 May 2010 15:05:29 -0000      1.2
+++ patches/patch-def_h 11 Dec 2013 20:40:06 -0000
@@ -1,32 +1,12 @@
 $OpenBSD: patch-def_h,v 1.2 2010/05/22 15:05:29 espie Exp $
---- def.h.orig Sat Dec 13 09:34:59 1997
-+++ def.h      Sat May 22 16:59:41 2010
-@@ -12,10 +12,12 @@
- #ifndef DEF_DEF
+--- def.h.orig Wed Dec 11 17:22:35 2013
++++ def.h      Wed Dec 11 17:23:14 2013
+@@ -13,6 +13,8 @@
  #define DEF_DEF
  #define LINT_ARGS   1         /* enable lint type checking */
--#include        "stdio.h"
-+#include        <stdio.h>
+ #include        <stdio.h>
++#include        <stdlib.h>
 +#include        <string.h>
-+#include      <stdlib.h>
  
  #ifdef UNIX
--#include        "sys/types.h"
-+#include        <sys/types.h>
- #endif /* UNIX */
- 
- #define BACKUP  1             /* Make backup file.            */
-@@ -562,13 +564,6 @@ extern int auto_update;
- extern int flush_count;
- extern int rowb;
- extern char file_off_bad;
--
--/*
-- * Standard I/O.
-- */
--extern char *malloc ();
--extern char *strcpy ();
--extern char *strcat ();
- 
- #ifndef NOPROTO
- #include "prototyp.h"
+ #include        <sys/types.h>
Index: patches/patch-file_c
===================================================================
RCS file: /cvs/ports/editors/beav/patches/patch-file_c,v
retrieving revision 1.1
diff -u -p -r1.1 patch-file_c
--- patches/patch-file_c        22 May 2010 15:05:29 -0000      1.1
+++ patches/patch-file_c        11 Dec 2013 20:40:06 -0000
@@ -1,7 +1,7 @@
 $OpenBSD: patch-file_c,v 1.1 2010/05/22 15:05:29 espie Exp $
---- file.c.orig        Sat May 22 17:01:04 2010
-+++ file.c     Sat May 22 17:01:12 2010
-@@ -9,7 +9,6 @@
+--- file.c.orig        Wed Dec 11 20:07:15 2013
++++ file.c     Wed Dec 11 20:07:15 2013
+@@ -10,7 +10,6 @@
  char load_file ();
  char readin ();
  void makename ();
Index: patches/patch-random_c
===================================================================
RCS file: /cvs/ports/editors/beav/patches/patch-random_c,v
retrieving revision 1.1
diff -u -p -r1.1 patch-random_c
--- patches/patch-random_c      22 May 2010 15:05:29 -0000      1.1
+++ patches/patch-random_c      11 Dec 2013 20:40:06 -0000
@@ -1,7 +1,7 @@
 $OpenBSD: patch-random_c,v 1.1 2010/05/22 15:05:29 espie Exp $
---- random.c.orig      Sat May 22 17:01:30 2010
-+++ random.c   Sat May 22 17:01:47 2010
-@@ -72,7 +72,6 @@ extern bool read_pat_mode;
+--- random.c.orig      Wed Dec 11 20:07:15 2013
++++ random.c   Wed Dec 11 20:07:15 2013
+@@ -73,7 +73,6 @@ extern bool read_pat_mode;
  extern bool dont_repeat;
  extern BUFFER sav_buf;
  
Index: patches/patch-symbol_c
===================================================================
RCS file: /cvs/ports/editors/beav/patches/patch-symbol_c,v
retrieving revision 1.2
diff -u -p -r1.2 patch-symbol_c
--- patches/patch-symbol_c      22 May 2010 15:05:29 -0000      1.2
+++ patches/patch-symbol_c      11 Dec 2013 20:40:06 -0000
@@ -1,15 +1,15 @@
 $OpenBSD: patch-symbol_c,v 1.2 2010/05/22 15:05:29 espie Exp $
---- symbol.c.orig      Sat Dec 13 09:34:59 1997
-+++ symbol.c   Sat May 22 17:02:25 2010
-@@ -6,7 +6,6 @@
- */
+--- symbol.c.orig      Wed Dec 11 20:07:15 2013
++++ symbol.c   Wed Dec 11 20:07:15 2013
+@@ -8,7 +8,6 @@
+ #include              <string.h>
  #include              "def.h"
  
 -void keyadd ();
  void keydup ();
  
  
-@@ -219,7 +218,6 @@ extern char save_region ();        /* Save region in named 
bu
+@@ -221,7 +220,6 @@ extern char save_region ();        /* Save region in named 
bu
  * Defined by "spawn.c".
  */
  extern char spawncli ();      /* Run CLI in a subjob.  */
Index: patches/patch-tcap_c
===================================================================
RCS file: /cvs/ports/editors/beav/patches/patch-tcap_c,v
retrieving revision 1.2
diff -u -p -r1.2 patch-tcap_c
--- patches/patch-tcap_c        22 May 2010 15:05:29 -0000      1.2
+++ patches/patch-tcap_c        11 Dec 2013 20:40:06 -0000
@@ -1,7 +1,7 @@
 $OpenBSD: patch-tcap_c,v 1.2 2010/05/22 15:05:29 espie Exp $
---- tcap.c.orig        Sat Dec 13 09:34:59 1997
-+++ tcap.c     Sat May 22 16:56:49 2010
-@@ -39,7 +39,7 @@ char *UP, PC, *CM, *CE, *CL, *SO, *SE, *TI, *TE;     /* DR
+--- tcap.c.orig        Wed Dec 11 17:17:29 2013
++++ tcap.c     Wed Dec 11 17:17:29 2013
+@@ -41,7 +41,7 @@ char *UP, PC, *CM, *CE, *CL, *SO, *SE, *TI, *TE;     /* DR
  
  #ifdef BSD
  #include <sys/ioctl.h>
Index: patches/patch-termio_c
===================================================================
RCS file: /cvs/ports/editors/beav/patches/patch-termio_c,v
retrieving revision 1.1
diff -u -p -r1.1 patch-termio_c
--- patches/patch-termio_c      2 Aug 2002 03:45:19 -0000       1.1
+++ patches/patch-termio_c      11 Dec 2013 20:40:06 -0000
@@ -1,13 +1,120 @@
-$OpenBSD: patch-termio_c,v 1.1 2002/08/02 03:45:19 kevlo Exp $
---- termio.c.orig      Sat Jul 21 13:35:05 2001
-+++ termio.c   Thu Aug  1 15:26:10 2002
-@@ -12,6 +12,9 @@
+$OpenBSD$
+--- termio.c.orig      Wed Dec 11 21:35:47 2013
++++ termio.c   Wed Dec 11 21:36:39 2013
+@@ -8,11 +8,16 @@
+ 
+ #ifdef UNIX                   /* System V */
+ 
++#if defined(__GLIBC__) || \
++    defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
++#define TERMIOS 1
++#endif
++
+ #include    <unistd.h>
+ #include    <errno.h>
+ #include    <stdio.h>
  #include    <signal.h>
- #ifdef BSD
+-#ifdef BSD
++#if defined(BSD) && !defined(TERMIOS)
  #include    <sys/ioctl.h>
-+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
-+#include <sys/ioctl_compat.h>
-+#endif
  #else
  #ifdef OS2
- #ifndef __EMX__
+@@ -28,7 +33,8 @@
+ #include    <sgtty.h>
+ #define O_NDELAY O_NONBLOCK
+ #else
+-#ifdef __GLIBC__
++#ifdef TERMIOS
++#include <sys/ioctl.h>
+ #include <termios.h>
+ #else 
+ #include <termio.h>
+@@ -44,7 +50,7 @@ int kbdpoll;                 /* in O_NDELAY mode         */
+ int kbdqp;                    /* there is a char in kbdq  */
+ char kbdq;                    /* char we've already read  */
+ 
+-#ifdef BSD
++#if defined(BSD) && !defined(TERMIOS)
+ struct sgttyb otermb;
+ struct sgttyb ntermb;
+ #else
+@@ -58,7 +64,7 @@ struct sgttyb otermio;               /* original terminal 
character
+ struct sgttyb ntermio;                /* charactoristics to use inside */
+ struct tchars tchars, tcharsorig;
+ #else
+-#ifdef __GLIBC__
++#ifdef TERMIOS
+ #include <sys/ioctl.h>
+ struct termios otermio;
+ struct termios ntermio;
+@@ -86,7 +92,7 @@ int ncol;                    /* Terminal size, columns.      
*/
+ void
+ ttopen ()
+ {
+-#ifdef BSD
++#if defined(BSD) && !defined(TERMIOS)
+ #ifdef ULTRIX
+     struct winsize ttysize;
+ #else
+@@ -137,8 +143,13 @@ ttopen ()
+       tchars.t_stopc = tchars.t_eofc = tchars.t_brkc = -1;
+     ioctl (0, TIOCSETC, &tchars);
+ #else
+-#ifdef __GLIBC__
++#ifdef TERMIOS
++#ifdef TIOCGWINSZ
++    struct ttysize ttysize;
++#endif
+     tcgetattr(0,&otermio);
++    ntermio.c_ispeed = otermio.c_ispeed;
++    ntermio.c_ospeed = otermio.c_ospeed;
+ #else
+     ioctl (0, TCGETA, &otermio);/* save old settings */
+     ntermio.c_line = otermio.c_line;
+@@ -149,7 +160,7 @@ ttopen ()
+     ntermio.c_lflag = 0;
+     ntermio.c_cc[VMIN] = 1;
+     ntermio.c_cc[VTIME] = 0;
+-#ifdef __GLIBC__
++#ifdef TERMIOS
+     tcsetattr(0,TCSANOW,&ntermio);
+ #else
+     ioctl (0, TCSETAW, &ntermio);     /* and activate them */
+@@ -161,8 +172,17 @@ ttopen ()
+     /* on all screens we are not sure of the initial position of the cursor */
+     ttrow = 999;
+     ttcol = 999;
+-    nrow = NROW;
+-    ncol = NCOL;
++#if defined(TERMIOS) && defined(TIOCGWINSZ)
++    if (ioctl (0, TIOCGWINSZ, &ttysize) == 0)
++    {
++      nrow = ttysize.ts_lines;
++      ncol = ttysize.ts_cols;
++    } else
++#endif
++    {
++      nrow = NROW;
++      ncol = NCOL;
++    }
+ #endif /* BSD */
+ }
+ 
+@@ -174,7 +194,7 @@ ttopen ()
+ void
+ ttclose ()
+ {
+-#ifdef BSD
++#if defined(BSD) && !defined(TERMIOS)
+     if (ioctl (0, TIOCSETP, &otermb) == -1)   /* restore terminal settings */
+       printf ("closing ioctl on dev 0 failure, error = %d\n", errno);
+ #else
+@@ -186,7 +206,7 @@ ttclose ()
+       ioctl (0, TIOCSETC, &tcharsorig) == -1)
+       printf ("closing ioctl on dev 0 failure, error = %d\n", errno);
+ #else
+-#ifdef __GLIBC__
++#ifdef TERMIOS
+     if( tcsetattr(0,TCSANOW,&otermio) == -1)
+ #else
+     if (ioctl (0, TCSETAW, &otermio) == -1)   /* restore terminal settings */
Index: pkg/DESCR
===================================================================
RCS file: /cvs/ports/editors/beav/pkg/DESCR,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 DESCR
--- pkg/DESCR   15 Nov 1997 00:04:25 -0000      1.1.1.1
+++ pkg/DESCR   11 Dec 2013 20:40:06 -0000
@@ -1,9 +1,11 @@
-BEAV (Binary Editor And Viewer), is a full featured binary file 
-editor.          Just about any operation that you could want to do to a 
binary 
-file is possible with BEAV.   You can insert or delete in the middle of 
-a file thereby changing it's size.   You can edit multiple files in 
-multiple windows and cut and paste between them.   You can display and 
-edit data in hex, octal, decimal, binary, ascii, or ebcdic formats.   You 
-can display data in byte, word, or long word formats in either Intel or 
-Motorola byte ordering.   You can send the formatted display mode to a 
-file or printer.
+beav (Binary Editor And Viewer) is an editor for binary files
+containing arbitrary data. With beav, you can edit a file in HEX,
+ASCII, EBCDIC, OCTAL, DECIMAL, and BINARY. You can display but not
+edit data in FLOAT mode. You can search or search and replace in
+any of these modes. Data can be displayed in BYTE, WORD, or DOUBLE
+WORD formats. While displaying WORDS or DOUBLE WORDS the data can
+be displayed in INTEL's or MOTOROLA's byte ordering. Data of any
+length can be inserted at any point in the file. The source of this
+data can be the keyboard, another buffer, or a file. Any data that
+is being displayed can be sent to a printer in the displayed format.
+Files that are bigger than memory can be handled.

-- 
Christian "naddy" Weisgerber                          na...@mips.inka.de

Reply via email to