1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-20 04:02:27 +00:00

Make editors/beav use termios instead of sgtty.

The editors/beav port got broken on -CURRENT by the removal of the sgtty
programming interface. Patch this port to use termios. The source code
already contained support for termios, but was mistakenly covered by
#ifdef __GLIBC__.

Approved by:	philip (mentor)
This commit is contained in:
Ed Schouten 2008-06-19 08:07:27 +00:00
parent 1867f1355f
commit 556374bb28
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=215243
3 changed files with 98 additions and 13 deletions

View File

@ -7,6 +7,7 @@
PORTNAME= beav
PORTVERSION= 1.40.18
PORTREVISION= 1
CATEGORIES= editors
MASTER_SITES= ${MASTER_SITE_DEBIAN_POOL}
DISTNAME= ${PORTNAME}_${PORTVERSION:R}.orig

View File

@ -1,11 +1,11 @@
--- tcap.c.orig Sat Dec 13 17:34:59 1997
+++ tcap.c Thu Mar 21 03:53:02 2002
@@ -39,7 +39,7 @@
--- tcap.c
+++ tcap.c
@@ -89,7 +89,7 @@
#ifdef BSD
#include <sys/ioctl.h>
-struct winsize ttysize;
+struct ttysize ttysize;
#endif /* BSD */
#ifdef ULTRIX
struct winsize ttysize;
-#ifdef ULTRIX
+#if 1
if (ioctl (0, TIOCGWINSZ, &ttysize) == 0
&& ttysize.ws_row > 0)
{

View File

@ -1,12 +1,96 @@
--- termio.c.orig Sat Jul 21 22:35:05 2001
+++ termio.c Thu Mar 21 03:52:16 2002
@@ -12,6 +12,9 @@
--- termio.c
+++ termio.c
@@ -14,6 +14,9 @@
#include <signal.h>
#ifdef BSD
#include <sys/ioctl.h>
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
+#if defined(__OpenBSD__) || defined(__NetBSD__)
+#include <sys/ioctl_compat.h>
+#endif
#else
#ifdef OS2
#ifndef __EMX__
@@ -44,7 +47,7 @@
int kbdqp; /* there is a char in kbdq */
char kbdq; /* char we've already read */
-#ifdef BSD
+#if 0
struct sgttyb otermb;
struct sgttyb ntermb;
#else
@@ -58,8 +61,8 @@
struct sgttyb ntermio; /* charactoristics to use inside */
struct tchars tchars, tcharsorig;
#else
-#ifdef __GLIBC__
-#include <sys/ioctl.h>
+#if 1
+#include <termios.h>
struct termios otermio;
struct termios ntermio;
#else
@@ -86,7 +89,7 @@
void
ttopen ()
{
-#ifdef BSD
+#if 0
#ifdef ULTRIX
struct winsize ttysize;
#else
@@ -137,7 +140,9 @@
tchars.t_stopc = tchars.t_eofc = tchars.t_brkc = -1;
ioctl (0, TIOCSETC, &tchars);
#else
-#ifdef __GLIBC__
+ struct winsize ttysize;
+
+#if 1
tcgetattr(0,&otermio);
#else
ioctl (0, TCGETA, &otermio);/* save old settings */
@@ -149,7 +154,7 @@
ntermio.c_lflag = 0;
ntermio.c_cc[VMIN] = 1;
ntermio.c_cc[VTIME] = 0;
-#ifdef __GLIBC__
+#if 1
tcsetattr(0,TCSANOW,&ntermio);
#else
ioctl (0, TCSETAW, &ntermio); /* and activate them */
@@ -161,8 +166,14 @@
/* on all screens we are not sure of the initial position of the cursor */
ttrow = 999;
ttcol = 999;
- nrow = NROW;
- ncol = NCOL;
+ if (ioctl (0, TIOCGWINSZ, &ttysize) == 0)
+ {
+ nrow = ttysize.ws_row;
+ ncol = ttysize.ws_col;
+ } else {
+ nrow = NROW;
+ ncol = NCOL;
+ }
#endif /* BSD */
}
@@ -174,7 +185,7 @@
void
ttclose ()
{
-#ifdef BSD
+#if 0
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 @@
ioctl (0, TIOCSETC, &tcharsorig) == -1)
printf ("closing ioctl on dev 0 failure, error = %d\n", errno);
#else
-#ifdef __GLIBC__
+#if 1
if( tcsetattr(0,TCSANOW,&otermio) == -1)
#else
if (ioctl (0, TCSETAW, &otermio) == -1) /* restore terminal settings */