NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/39883 (tput support for setaf terminfo sequence is broken)



The following reply was made to PR bin/39883; it has been noted by GNATS.

From: David Holland <dholland-bugs%netbsd.org@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: jnemeth%NetBSD.org@localhost
Subject: Re: bin/39883 (tput support for setaf terminfo sequence is broken)
Date: Sat, 29 May 2010 19:41:59 +0000

 On Mon, Mar 15, 2010 at 02:00:08AM +0000, John Nemeth wrote:
  >  } I suppose tput should exit 1 when asked for an unknown capability
  >  } though; would fixing that be sufficient?
  >  
  >       That would be sufficient.  I seem to recall more discussion
  >  on the issue, but I guess it was on a mailing list.  I think the
  >  idea was that if somebody asked for a capability more then two
  >  letters long that tput would exit with an error.  The problem was
  >  that tgetstr() simply truncated to two characters, so "setaf" became
  >  "se" (standout end).
 
 Like this? It seems to do the trick.
 
 Index: tput.c
 ===================================================================
 RCS file: /cvsroot/src/usr.bin/tput/tput.c,v
 retrieving revision 1.19
 diff -u -p -r1.19 tput.c
 --- tput.c     21 Jul 2008 14:19:27 -0000      1.19
 +++ tput.c     29 May 2010 19:39:38 -0000
 @@ -105,7 +105,9 @@ main(int argc, char **argv)
                        break;
                }
                cptr = buf;
 -              if (tgetstr(p, &cptr))
 +              if (strlen(p) > 2)
 +                      exitval = 1;
 +              else if (tgetstr(p, &cptr))
                        argv = process(p, buf, argv);
                else if ((n = tgetnum(p)) != -1)
                        (void)printf("%d\n", n);
 
 
 -- 
 David A. Holland
 dholland%netbsd.org@localhost
 


Home | Main Index | Thread Index | Old Index