1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-20 20:09:11 +00:00

Convert to staging, clean up the sgtty/termios mess, and generally

overhaul the port.
This commit is contained in:
Christian Weisgerber 2013-12-12 16:27:03 +00:00
parent 10e420075f
commit d504c20899
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=336277
7 changed files with 152 additions and 60 deletions

View File

@ -3,7 +3,7 @@
PORTNAME= beav
PORTVERSION= 1.40.18
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= editors
MASTER_SITES= ${MASTER_SITE_DEBIAN_POOL}
DISTNAME= ${PORTNAME}_${PORTVERSION:R}.orig
@ -18,23 +18,14 @@ COMMENT= Binary Editor And Viewer, a full featured binary file editor
WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION:R:S/.//}
ALL_TARGET= beav
MAN1= beav.1
NO_STAGE= yes
post-patch:
@${REINPLACE_CMD} -e 's|^CFLAGS=|CFLAGS+=-DUNIX -DBSD -DNOPROTO#|g ; \
s|^CC=|CC?=|g ; \
s|^(|\$$(|g' ${WRKSRC}/Makefile
@${REINPLACE_CMD} -e 's|/usr/share/doc/beav|${DOCSDIR}|g ; \
s|beav140.txt.gz|beav.txt|' ${WRKSRC}/beav.1
MAKE_ARGS= CC="${CC}" CFLAGS="${CFLAGS} -DUNIX -DBSD -DNOPROTO"
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/beav ${PREFIX}/bin/beav
${INSTALL_MAN} ${WRKSRC}/beav.1 ${MANPREFIX}/man/man1/beav.1
.if !defined(NOPORTDOCS)
@${MKDIR} ${DOCSDIR}
${INSTALL_DATA} ${WRKSRC}/beav140.txt ${DOCSDIR}/beav.txt
.endif
${INSTALL_PROGRAM} ${WRKSRC}/beav ${STAGEDIR}${PREFIX}/bin/beav
${INSTALL_MAN} ${WRKSRC}/beav.1 ${STAGEDIR}${PREFIX}/man/man1/beav.1
@${MKDIR} ${STAGEDIR}${DOCSDIR}
${INSTALL_DATA} ${WRKSRC}/beav140.txt ${STAGEDIR}${DOCSDIR}/beav.txt
@${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' \
${STAGEDIR}${PREFIX}/man/man1/beav.1
.include <bsd.port.mk>

View File

@ -0,0 +1,18 @@
--- beav.1.orig 2013-12-12 17:16:34.000000000 +0100
+++ beav.1 2013-12-12 17:17:40.000000000 +0100
@@ -23,7 +23,7 @@ These commands can be used to navigate a
.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
If there is any data that has not been saved you will be warned.
.PP
.SH FILES
-/usr/share/doc/beav/beav140.txt.gz
+%%PREFIX%%/share/doc/beav/beav.txt

View File

@ -0,0 +1,11 @@
--- def.h.orig 2013-12-12 17:16:34.000000000 +0100
+++ def.h 2013-12-12 17:17:40.000000000 +0100
@@ -13,6 +13,8 @@
#define DEF_DEF
#define LINT_ARGS 1 /* enable lint type checking */
#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#ifdef UNIX
#include <sys/types.h>

View File

@ -1,11 +1,46 @@
--- tcap.c
+++ tcap.c
@@ -89,7 +89,7 @@
--- tcap.c.orig 2013-12-12 17:16:34.000000000 +0100
+++ tcap.c 2013-12-12 17:17:40.000000000 +0100
@@ -41,11 +41,12 @@ char *UP, PC, *CM, *CE, *CL, *SO, *SE, *
#ifdef BSD
#include <sys/ioctl.h>
+#ifdef TIOCGWINSZ
struct winsize ttysize;
-#endif /* BSD */
-#ifdef ULTRIX
-struct winsize ttysize;
+#else
+struct ttysize ttysize;
#endif
+#endif /* BSD */
void
putpad (str)
@@ -62,9 +63,6 @@ tcapopen ()
char tcbuf[1024];
char *tv_stype;
char err_str[NCOL];
-#ifdef ULTRIX
- struct winsize ttysize;
-#endif
nrow = NROW;
@@ -89,7 +87,7 @@ tcapopen ()
#ifdef BSD
-#ifdef ULTRIX
+#if 1
+#ifdef TIOCGWINSZ
if (ioctl (0, TIOCGWINSZ, &ttysize) == 0
&& ttysize.ws_row > 0)
{
@@ -103,7 +101,7 @@ tcapopen ()
nrow = ttysize.ts_lines;
}
else
-#endif /* ULTRIX */
+#endif /* TIOCGWINSZ */
#endif /* BSD */
#ifndef OS2

View File

@ -1,96 +1,130 @@
--- termio.c
+++ termio.c
@@ -14,6 +14,9 @@
#include <signal.h>
#ifdef BSD
#include <sys/ioctl.h>
+#if defined(__OpenBSD__) || defined(__NetBSD__)
+#include <sys/ioctl_compat.h>
--- termio.c.orig 2013-12-12 17:16:34.000000000 +0100
+++ termio.c 2013-12-12 17:17:40.000000000 +0100
@@ -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
+#if defined(BSD) && !defined(TERMIOS)
#include <sys/ioctl.h>
#else
#ifdef OS2
#ifndef __EMX__
@@ -44,7 +47,7 @@
@@ -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 0
+#if defined(BSD) && !defined(TERMIOS)
struct sgttyb otermb;
struct sgttyb ntermb;
#else
@@ -58,8 +61,8 @@
@@ -58,7 +64,7 @@ struct sgttyb otermio; /* original term
struct sgttyb ntermio; /* charactoristics to use inside */
struct tchars tchars, tcharsorig;
#else
-#ifdef __GLIBC__
-#include <sys/ioctl.h>
+#if 1
+#include <termios.h>
+#ifdef TERMIOS
#include <sys/ioctl.h>
struct termios otermio;
struct termios ntermio;
#else
@@ -86,7 +89,7 @@
@@ -86,8 +92,8 @@ int ncol; /* Terminal size, columns.
void
ttopen ()
{
-#ifdef BSD
+#if 0
#ifdef ULTRIX
-#ifdef ULTRIX
+#if defined(BSD) && !defined(TERMIOS)
+#ifdef TIOCGWINSZ
struct winsize ttysize;
#else
@@ -137,7 +140,9 @@
struct ttysize ttysize;
@@ -104,7 +110,7 @@ ttopen ()
of the cursor */
ttrow = 999;
ttcol = 999;
-#ifdef ULTRIX
+#ifdef TIOCGWINSZ
if (ioctl (0, TIOCGWINSZ, &ttysize) == 0)
{
nrow = ttysize.ws_row;
@@ -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 winsize ttysize;
+
+#if 1
+#endif
tcgetattr(0,&otermio);
+ ntermio.c_ispeed = otermio.c_ispeed;
+ ntermio.c_ospeed = otermio.c_ospeed;
#else
ioctl (0, TCGETA, &otermio);/* save old settings */
@@ -149,7 +154,7 @@
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__
+#if 1
+#ifdef TERMIOS
tcsetattr(0,TCSANOW,&ntermio);
#else
ioctl (0, TCSETAW, &ntermio); /* and activate them */
@@ -161,8 +166,14 @@
@@ -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.ws_row;
+ ncol = ttysize.ws_col;
+ } else {
+ } else
+#endif
+ {
+ nrow = NROW;
+ ncol = NCOL;
+ }
#endif /* BSD */
}
@@ -174,7 +185,7 @@
@@ -174,7 +194,7 @@ ttopen ()
void
ttclose ()
{
-#ifdef BSD
+#if 0
+#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 +197,7 @@
@@ -186,7 +206,7 @@ ttclose ()
ioctl (0, TIOCSETC, &tcharsorig) == -1)
printf ("closing ioctl on dev 0 failure, error = %d\n", errno);
#else
-#ifdef __GLIBC__
+#if 1
+#ifdef TERMIOS
if( tcsetattr(0,TCSANOW,&otermio) == -1)
#else
if (ioctl (0, TCSETAW, &otermio) == -1) /* restore terminal settings */

View File

@ -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.

View File

@ -1,3 +1,4 @@
bin/beav
man/man1/beav.1.gz
%%PORTDOCS%%%%DOCSDIR%%/beav.txt
%%PORTDOCS%%@dirrm %%DOCSDIR%%