zsh-workers
 help / color / mirror / code / Atom feed
* zsh: can't find terminal definition on vt100
@ 2002-02-05 19:01 rangarao.ragavendran
  2002-02-12 16:55 ` PATCH: " Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: rangarao.ragavendran @ 2002-02-05 19:01 UTC (permalink / raw)
  To: zsh-workers

I am running zsh on HPUX 11.0 and when I execute
     export TERM=vt100

I get the following error:

zsh: can't find terminal definition on vt100

Other shells (ksh, sh) works fine. Any help is appreciated

Thanks
Raga


^ permalink raw reply	[flat|nested] 4+ messages in thread

* PATCH: Re: zsh: can't find terminal definition on vt100
  2002-02-05 19:01 zsh: can't find terminal definition on vt100 rangarao.ragavendran
@ 2002-02-12 16:55 ` Bart Schaefer
  2002-02-12 17:16   ` Zefram
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2002-02-12 16:55 UTC (permalink / raw)
  To: rangarao.ragavendran, zsh-workers

[I meant to respond to some of this stuff a while ago, but then started
having trouble with my ISP again, so I couldn't use my mail from home.]

On Feb 5,  1:01pm, rangarao.ragavendran@abbott.com wrote:
}
} I am running zsh on HPUX 11.0 and when I execute
}      export TERM=vt100
} 
} I get the following error:
} 
} zsh: can't find terminal definition on vt100

The short answer was given on zsh-users a few weeks ago:

On Jan 22,  5:07pm, a normal guy wrote:
} Subject: Re: zsh 4.0.4 on HP-UX?
} 
} I fought this problem too, and the fix was similar.  In HP-UX
} 11.00, they redefined the output values of tgetent to 0 (OK) and
} -1 (ERR).  0 used to mean there was no such term capability.
} 
} The old tgetent is still available in the libHcurses library. 
} Putting LDFLAGS='-lHcurses' fixed the problem for me.
} 
} Scott

The long answer is that we need to change configure to detect this.
Here's a potential patch (against current 4.1.x from CVS, but I think
it'll apply to 4.0.4).  I don't have access to HP-UX 11 to test it,
but it works for the "normal" tgetent() on my RedHat Linux box.


Index: acconfig.h
===================================================================
diff -u -r1.8 acconfig.h
--- acconfig.h	2001/10/17 14:38:20	1.8
+++ acconfig.h	2002/02/12 16:36:41
@@ -187,6 +187,9 @@
 /* Define to 1 if tgetent() accepts NULL as a buffer */
 #undef TGETENT_ACCEPTS_NULL
 
+/* Define to 1 if tgetent() returns 0 on success (HP-UX X/Open curses) */
+#undef TGETENT_ZERO_SUCCESS
+
 /* Define to 1 if you use POSIX style signal handling */
 #undef POSIX_SIGNALS
 
Index: zshconfig.ac
===================================================================
diff -u -r1.11 zshconfig.ac
--- zshconfig.ac	2002/01/07 15:18:18	1.11
+++ zshconfig.ac	2002/02/12 16:34:38
@@ -963,14 +963,16 @@
 [AC_TRY_RUN([
 main()
 {
-    int i = tgetent((char*)0,"vt100");
-    if (i > 0) {
-	char tbuf[1024], *u;
-    	u = tbuf;
+    char buf[4096];
+    int r1 = tgetent(buf, "vt100");
+    int r2 = tgetent((char*)0,"vt100");
+    if (r1 >= 0 && r1 == r2) {
+        char tbuf[1024], *u;
+        u = tbuf;
     	tgetstr("cl", &u);
 	creat("conftest.tgetent", 0640);
     }
-    exit(!i || i == -1);
+    exit((r1 != r2) || r2 == -1);
 }
 ],
   if test -f conftest.tgetent; then
@@ -982,6 +984,33 @@
   zsh_cv_func_tgetent_accepts_null=no)])
 if test $zsh_cv_func_tgetent_accepts_null = yes; then
   AC_DEFINE(TGETENT_ACCEPTS_NULL)
+fi
+AC_CACHE_CHECK(if tgetent returns 0 on success,
+zsh_cv_func_tgetent_zero_success,
+[AC_TRY_RUN([
+main()
+{
+    char buf[4096];
+    int r1 = tgetent(buf, "!@#$%^&*");
+    int r2 = tgetent(buf, "vt100");
+    if (r1 < 0 && r2 == 0) {
+        char tbuf[1024], *u;
+        u = tbuf;
+    	tgetstr("cl", &u);
+	creat("conftest.tgetent0", 0640);
+    }
+    exit(r1 == r2);
+}
+],
+  if test -f conftest.tgetent0; then
+    zsh_cv_func_tgetent_zero_success=yes
+  else
+    zsh_cv_func_tgetent_zero_success=no
+  fi,
+  zsh_cv_func_tgetent_zero_success=no,
+  zsh_cv_func_tgetent_zero_success=no)])
+if test $zsh_cv_func_tgetent_zero_success = yes; then
+  AC_DEFINE(TGETENT_ZERO_SUCCESS)
 fi
 
 AC_FUNC_MMAP
Index: Src/init.c
===================================================================
diff -u -r1.7 Src/init.c
--- Src/init.c	2001/10/22 17:03:58	1.7
+++ Src/init.c	2002/02/12 16:40:47
@@ -535,11 +535,15 @@
 
 #ifdef TGETENT_ACCEPTS_NULL
     /* If possible, we let tgetent allocate its own termcap buffer */
-    if (tgetent(NULL, term) != 1) {
+# ifdef TGETENT_ZERO_SUCCESS
+    if (tgetent(NULL, term) != 0)
+# else
+    if (tgetent(NULL, term) != 1)
+# endif
 #else
-    if (tgetent(termbuf, term) != 1) {
+    if (tgetent(termbuf, term) != 1)
 #endif
-
+    {
 	if (isset(INTERACTIVE))
 	    zerr("can't find terminal definition for %s", term, 0);
 	errflag = 0;

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: PATCH: Re: zsh: can't find terminal definition on vt100
  2002-02-12 16:55 ` PATCH: " Bart Schaefer
@ 2002-02-12 17:16   ` Zefram
  2002-02-12 17:40     ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Zefram @ 2002-02-12 17:16 UTC (permalink / raw)
  To: zsh-workers

Bart Schaefer wrote:
>--- Src/init.c	2001/10/22 17:03:58	1.7
>+++ Src/init.c	2002/02/12 16:40:47
>@@ -535,11 +535,15 @@
> 
> #ifdef TGETENT_ACCEPTS_NULL
>     /* If possible, we let tgetent allocate its own termcap buffer */
>-    if (tgetent(NULL, term) != 1) {
>+# ifdef TGETENT_ZERO_SUCCESS
>+    if (tgetent(NULL, term) != 0)
>+# else
>+    if (tgetent(NULL, term) != 1)
>+# endif
> #else
>-    if (tgetent(termbuf, term) != 1) {
>+    if (tgetent(termbuf, term) != 1)
> #endif
>-
>+    {

Surely these two conditions are orthogonal -- your configure tests are
orthogonal -- so we really want code like

      if (
  #ifdef TGETENT_ACCEPTS_NULL
          tgetent(NULL, term)
  #else
          tgetent(termbuf, term)
  #endif
  #ifdef TGETENT_ZERO_SUCCESS
                              != 0
  #else
                              != 1
  #endif
                                  ) {

Or, of course, make it clearer by defining macros for TGETENT_SUCCESS etc.

-zefram


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: PATCH: Re: zsh: can't find terminal definition on vt100
  2002-02-12 17:16   ` Zefram
@ 2002-02-12 17:40     ` Bart Schaefer
  0 siblings, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 2002-02-12 17:40 UTC (permalink / raw)
  To: Zefram, zsh-workers

On Feb 12,  5:16pm, Zefram wrote:
} Subject: Re: PATCH: Re: zsh: can't find terminal definition on vt100
}
} Bart Schaefer wrote:
} > #ifdef TGETENT_ACCEPTS_NULL
} >+# ifdef TGETENT_ZERO_SUCCESS
} >+# else
} >+# endif
} > #else
} > #endif
} 
} Surely these two conditions are orthogonal

Theoretically, yes; practically, no.  TGETENT_ZERO_SUCCESS only applies
to a slightly twisted interpretation of the X/Open standard, as far as
I know; and that same implementation does accept a NULL buffer, as far
as I know.

} -- your configure tests are orthogonal --

Only because it was easier to write them that way ...

} Or, of course, make it clearer by defining macros for TGETENT_SUCCESS etc.

I would have done that if there'd been more than one place in the code
where they were needed.

Based on previous discussions, there may already be macros for this in
the HP-UX curses package; but I don't know, and don't have access to it.
I haven't committed the patch and it'd be better if somebody who does
have HP-UX 11 does so, or at least posts a revised and known-working
patch.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-02-12 17:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-05 19:01 zsh: can't find terminal definition on vt100 rangarao.ragavendran
2002-02-12 16:55 ` PATCH: " Bart Schaefer
2002-02-12 17:16   ` Zefram
2002-02-12 17:40     ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).