Hi folks,
this is a followup to my previous mail from 2019-05-07. The patch wasn't
complete as it turned out that HP-UX's tgetflag() does not behave as
documented by the manpage. I have escalated with HPE and the manpage
change is in the works.
A similar patch has been sent to the author of less(1), see attachment
for comparison.
find the patch attached to make GNU readline 8.0:
* respect HP-UX's tgetent(), tgetflag()
* properly create a shared library
It works even better now with bash and friends (especially autowrap).
Regards,
Michael
diff -u -ur configure.ac configure.ac
--- /configure.ac 2019-06-11 20:12:01 +0000
+++ configure.ac 2019-08-27 22:08:08 +0000
@@ -632,7 +632,13 @@
* The value returned from tgetent on success.
* Some HP-UX systems return 0 on success.
*/
-#define TGETENT_OK 1
+#ifdef __hpux
+#define TGETENT_OK 0
+#define TGETFLAG_OK 0
+#else
+#define TGETENT_OK 1
+#define TGETFLAG_OK 1
+#endif
/*
* HAVE_ANSI_PROTOS is 1 if your compiler supports ANSI function prototypes.
diff -u -ur screen.c screen.c
--- screen.c 2019-06-11 20:12:01 +0000
+++ screen.c 2019-08-27 22:07:34 +0000
@@ -674,7 +674,10 @@
return (*s != '\0' && *s != '0');
if (hardcopy)
return (0);
- return (tgetflag(capname));
+ if (tgetflag(capname) == TGETFLAG_OK)
+ return 1;
+ else
+ return 0;
}
static int
diff -u -urw support/shobj-conf support/shobj-conf
--- support/shobj-conf 2016-10-05 22:02:11 +0000
+++ support/shobj-conf 2019-05-07 14:13:40 +0000
@@ -398,21 +398,17 @@
;;
hpux11*)
- SHOBJ_STATUS=unsupported
- SHLIB_STATUS=unsupported
-
- # If you are using the HP ANSI C compiler, you can uncomment and use
- # this code (I have not tested it)
-# SHOBJ_STATUS=supported
-# SHLIB_STATUS=supported
-#
-# SHOBJ_CFLAGS='+z'
-# SHOBJ_LD='ld'
-# SHOBJ_LDFLAGS='-b +s +h $@'
+ SHOBJ_STATUS=supported
+ SHLIB_STATUS=supported
#
-# SHLIB_XLDFLAGS='+b $(libdir)'
-# SHLIB_LIBSUFF='sl'
-# SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+ SHOBJ_CFLAGS='+z'
+ SHOBJ_LD='$(CC)'
+ SHOBJ_LDFLAGS='-b -Wl,+s -Wl,+h,$@'
+
+ SHLIB_XLDFLAGS='-Wl,+b,$(libdir)'
+ SHLIB_LIBSUFF='so'
+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+ SHLIB_LIBS='$(TERMCAP_LIB)'
;;
diff -u -urw tcap.h tcap.h
--- tcap.h 2016-01-25 16:36:15 +0000
+++ tcap.h 2019-08-28 09:32:49 +0000
@@ -41,6 +41,14 @@
# undef PC
#endif
+#if defined(__hpux)
+#define TGETENT_OK 0
+#define TGETFLAG_OK 0
+#else
+#define TGETENT_OK 1
+#define TGETFLAG_OK 1
+#endif
+
extern char PC;
extern char *UP, *BC;
diff -u -urw terminal.c terminal.c
--- terminal.c 2018-10-29 15:56:27 +0000
+++ terminal.c 2019-08-28 09:46:07 +0000
@@ -483,7 +483,7 @@
tgetent_ret = tgetent (term_buffer, term);
}
- if (tgetent_ret <= 0)
+ if (tgetent_ret != TGETENT_OK)
{
FREE (term_string_buffer);
FREE (term_buffer);
@@ -544,7 +544,8 @@
if (!_rl_term_cr)
_rl_term_cr = "\r";
- _rl_term_autowrap = tgetflag ("am") && tgetflag ("xn");
+ _rl_term_autowrap = (tgetflag ("am") == TGETFLAG_OK)
+ && (tgetflag ("xn") == TGETFLAG_OK);
/* Allow calling application to set default height and width, using
rl_set_screen_size */
@@ -559,7 +560,7 @@
/* Check to see if this terminal has a meta key and clear the capability
variables if there is none. */
- term_has_meta = tgetflag ("km") != 0;
+ term_has_meta = (tgetflag ("km") == TGETFLAG_OK);
if (term_has_meta == 0)
_rl_term_mm = _rl_term_mo = (char *)NULL;
#endif /* !__MSDOS__ */
_______________________________________________
Bug-readline mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-readline