From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15369 invoked from network); 12 Feb 2002 16:56:10 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 12 Feb 2002 16:56:10 -0000 Received: (qmail 17949 invoked by alias); 12 Feb 2002 16:56:05 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 16613 Received: (qmail 17935 invoked from network); 12 Feb 2002 16:56:02 -0000 From: "Bart Schaefer" Message-Id: <1020212165549.ZM15901@candle.brasslantern.com> Date: Tue, 12 Feb 2002 16:55:49 +0000 In-Reply-To: Comments: In reply to rangarao.ragavendran@abbott.com "zsh: can't find terminal definition on vt100" (Feb 5, 1:01pm) References: X-Mailer: Z-Mail (5.0.0 30July97) To: rangarao.ragavendran@abbott.com, zsh-workers@sunsite.dk Subject: PATCH: Re: zsh: can't find terminal definition on vt100 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii [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