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.
69 lines
1.3 KiB
Text
69 lines
1.3 KiB
Text
$NetBSD: patch-ac,v 1.3 2014/09/12 03:54:13 dholland Exp $
|
|
|
|
- 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
|
|
*/
|
|
|
|
-#include <term.h>
|
|
#include <stdlib.h>
|
|
#include "def.h"
|
|
#include "prototyp.h"
|
|
@@ -41,11 +40,7 @@ char *UP, PC, *CM, *CE, *CL, *SO, *SE, *
|
|
|
|
#ifdef BSD
|
|
#include <sys/ioctl.h>
|
|
-struct winsize ttysize;
|
|
#endif /* BSD */
|
|
-#ifdef ULTRIX
|
|
-struct winsize ttysize;
|
|
-#endif
|
|
|
|
void
|
|
putpad (str)
|
|
@@ -62,8 +57,10 @@ tcapopen ()
|
|
char tcbuf[1024];
|
|
char *tv_stype;
|
|
char err_str[NCOL];
|
|
-#ifdef ULTRIX
|
|
+#if defined(TIOCGWINSZ)
|
|
struct winsize ttysize;
|
|
+#elif defined(TIOCGSIZE)
|
|
+ struct ttysize ttysize;
|
|
#endif
|
|
|
|
nrow = NROW;
|
|
@@ -88,25 +85,22 @@ tcapopen ()
|
|
}
|
|
|
|
|
|
-#ifdef BSD
|
|
-#ifdef ULTRIX
|
|
+#ifndef OS2
|
|
+#if defined(TIOCGWINSZ)
|
|
if (ioctl (0, TIOCGWINSZ, &ttysize) == 0
|
|
&& ttysize.ws_row > 0)
|
|
{
|
|
nrow = ttysize.ws_row;
|
|
}
|
|
else
|
|
-#else
|
|
+#elif defined(TIOCGSIZE)
|
|
if (ioctl (0, TIOCGSIZE, &ttysize) == 0
|
|
&& ttysize.ts_lines > 0)
|
|
{
|
|
nrow = ttysize.ts_lines;
|
|
}
|
|
else
|
|
-#endif /* ULTRIX */
|
|
-#endif /* BSD */
|
|
-
|
|
-#ifndef OS2
|
|
+#endif /* TIOCGWINSZ */
|
|
if ((nrow = (short) tgetnum ("li") - 1) == -1)
|
|
{
|
|
puts ("termcap entry incomplete (lines)\r");
|