zsh-workers
 help / color / mirror / code / Atom feed
* echotc and ncurses bugfix
@ 1996-01-08 18:56 Zoltan Hidvegi
  0 siblings, 0 replies; only message in thread
From: Zoltan Hidvegi @ 1996-01-08 18:56 UTC (permalink / raw)
  To: zsh-workers

echotc does not work properly if zsh is linked with ncurses instead of
termcap.  The problem is that ncurses is a more clever program and tgetflag
returns -1 if the requested boolean capability does not exist.  zsh think it
means that this capability exists and is true.  The result:

% echotc k1
yes

(It should print the string sent by the F1 key).

The patch below fixes this bug.  If ncurses is used it print "no" if an
existing boolean capability is off (this is not possible with the termcap
termcap) library.

Cheers,

Zoltan

*** Src/builtin.c	1996/01/03 23:19:33	1.18
--- Src/builtin.c	1996/01/07 23:12:02
***************
*** 4250,4260 ****
  	printf("%d\n", num);
  	return 0;
      }
!     /* if the specified termcap is boolean, and set, say so */
!     if (tgetflag(s)) {
  	puts("yes");
  	return (0);
      }
      /* get a string-type capability */
      u = buf;
      t = tgetstr(s, &u);
--- 4250,4275 ----
  	printf("%d\n", num);
  	return 0;
      }
!     /* if the specified termcap is boolean, and set, say so  *
!      * ncurses can tell if an existing boolean capability is *
!      * off so in this case we print "no".                    */
! #ifndef NCURSES_VERSION
!     if (tgetflag(s) > 0) {
  	puts("yes");
  	return (0);
      }
+ #else
+     switch (tgetflag(s)) {
+     case -1:
+ 	break;
+     case 0:
+ 	puts("no");
+ 	return 0;
+     default:
+ 	puts("yes");
+ 	return 0;
+     }
+ #endif
      /* get a string-type capability */
      u = buf;
      t = tgetstr(s, &u);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1996-01-08 19:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-01-08 18:56 echotc and ncurses bugfix Zoltan Hidvegi

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