zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: Andrej Borsenkow <Andrej.Borsenkow@mow.siemens.ru>,
	ZSH Workers Mailing List <zsh-workers@sunsite.dk>
Subject: Re: termcap bug on Linux
Date: Mon, 28 May 2001 22:25:27 +0000	[thread overview]
Message-ID: <1010528222527.ZM7246@candle.brasslantern.com> (raw)
In-Reply-To: <3B10FCA4.2000009@mow.siemens.ru>

On May 27,  5:09pm, Andrej Borsenkow wrote:
} Subject: termcap bug on Linux
}
} Mandrake cooker (currently glibc-2.2.3, termcap-11.0.1-4mdk) compiled 
} with termcap, no ncurses.  tgetflag() returns 0 for both unset and 
} nonexsiting flags, which means that $termcap[cap] returns "no" for 
} almost everything except numeric capabilities.

Does the following patch help?  This duplicates code from echotc() into
gettermcap() -- so the two should at least now agree with each other,
which they might not have before, even if they're both wrong.

Does something similar need to go into scantermcap() ?

(There are a bunch of extra hunks that just delete whitespace, sorry.)

Common subdirectories: zsh-forge/current/Src/Modules/CVS and zsh-4.0/Src/Modules/CVS
diff -u zsh-forge/current/Src/Modules/termcap.c zsh-4.0/Src/Modules/termcap.c
--- zsh-forge/current/Src/Modules/termcap.c	Thu Apr 26 09:08:03 2001
+++ zsh-4.0/Src/Modules/termcap.c	Mon May 28 15:21:21 2001
@@ -109,7 +109,7 @@
     /* get a string-type capability */
     u = buf;
     t = tgetstr(s, &u);
-    if (!t || !*t) {
+    if (t == (char *)-1 || !t || !*t) {
 	/* capability doesn't exist, or (if boolean) is off */
 	zwarnnam(name, "no such capability: %s", s, 0);
 	return 1;
@@ -225,15 +225,34 @@
     pm->level = 0;
     u = buf;
 
+    /* logic in the following cascade copied from echotc, above */
+
     if ((num = tgetnum(name)) != -1) {
 	pm->u.val = num;
 	pm->flags |= PM_INTEGER;
+	return (HashNode) pm;
+    }
+#if !defined(NCURSES_VERSION) || !defined(COLOR_PAIR)
+    if ((num = tgetflag(name)) > 0) {
+	pm->u.str = dupstring("yes");
+	pm->flags |= PM_SCALAR;
+	return (HashNode) pm;
     }
-    else if ((num = tgetflag(name)) != -1) {
-	pm->u.str = num ? dupstring("yes") : dupstring("no");
+#else /* NCURSES_VERSION && COLOR_PAIR */
+    switch (tgetflag(name)) {
+    case -1:
+	break;
+    case 0:
+	pm->u.str = dupstring("no");
+	pm->flags |= PM_SCALAR;
+	return (HashNode) pm;
+    default:
+	pm->u.str = dupstring("yes");
 	pm->flags |= PM_SCALAR;
+	return (HashNode) pm;
     }
-    else if ((tcstr = (char *)tgetstr(name,&u)) != NULL && tcstr != (char *)-1)
+#endif /* NCURSES_VERSION && COLOR_PAIR */
+    if ((tcstr = tgetstr(name, &u)) != NULL && tcstr != (char *)-1)
     {
 	pm->u.str = dupstring(tcstr);
 	pm->flags |= PM_SCALAR;
@@ -262,7 +281,7 @@
 	"mi", "ms", "nx", "xb", "NP", "ND", "NR", "os", "5i", "YD", "YE",
 	"es", "hz", "ul", "xo", NULL};
 #endif
-    
+
 #ifndef HAVE_NUMCODES
     static char *numcodes[] = {
 	"co", "it", "lh", "lw", "li", "lm", "sg", "ma", "Co", "pa", "MW",
@@ -322,7 +341,7 @@
     pm->ename = NULL;
     pm->old = NULL;
     u = buf;
-    
+
     pm->flags = PM_READONLY | PM_SCALAR;
     for (capcode = (char **)boolcodes; *capcode; capcode++) {
 	if ((num = tgetflag(*capcode)) != -1) {
@@ -331,7 +350,7 @@
 	    func((HashNode) pm, flags);
 	}
     }
-    
+
     pm->flags = PM_READONLY | PM_INTEGER;
     for (capcode = (char **)numcodes; *capcode; capcode++) {
 	if ((num = tgetnum(*capcode)) != -1) {
@@ -340,7 +359,7 @@
 	    func((HashNode) pm, flags);
 	}
     }
-    
+
     pm->flags = PM_READONLY | PM_SCALAR;
     for (capcode = (char **)strcodes; *capcode; capcode++) {
 	if ((tcstr = (char *)tgetstr(*capcode,&u)) != NULL &&

-- 
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   


  reply	other threads:[~2001-05-28 22:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-27 13:09 Andrej Borsenkow
2001-05-28 22:25 ` Bart Schaefer [this message]
2001-05-29 16:05   ` Bart Schaefer
2001-05-29 18:56     ` Clint Adams
2001-05-30  6:24     ` Andrej Borsenkow
2001-05-30  7:41       ` Bart Schaefer
2001-05-30  8:03         ` Andrej Borsenkow
2001-05-30 14:00       ` Clint Adams
2001-05-30 15:29         ` Bart Schaefer
2001-05-30 19:54           ` PATCH (again) " Bart Schaefer
2001-05-29 18:06   ` Andrej Borsenkow
2001-05-29 20:12     ` Clint Adams
2001-05-29 18:48   ` Clint Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1010528222527.ZM7246@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=Andrej.Borsenkow@mow.siemens.ru \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).