bug-ncurses
[Top][All Lists]
Advanced

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

Re: %c drops zero byte in ncurses-5.2-20020907


From: Thomas Dickey
Subject: Re: %c drops zero byte in ncurses-5.2-20020907
Date: Fri, 4 Oct 2002 15:55:06 -0400
User-agent: Mutt/1.3.27i

On Fri, Oct 04, 2002 at 08:44:25AM -0700, Frank Henigman wrote:
> The %c code in a string like 
> 
>   cup=X%p1%cY%p2%cZ
> 
> can't produce a zero byte.  Try
> 
>   tput cup 0 0
> 
> and you get XYZ.  Looking at
> 
>  46 MODULE_ID("$Id: lib_tparm.c,v 1.59 2002/09/07 20:50:03 Philippe.Blain Exp 
> $") 
> 
> one sees
> 
> 537             case 'X':           /* FALLTHRU */
> 538             case 'c':           /* FALLTHRU */
> 539                 save_number(format, npop(), len);
> 540                 break;
> 
> and that save_number() uses strlen() to count the output bytes.
> Obviously strlen() won't count a zero byte.  I think the fix is

partly.  But if the output contains nulls it won't work either.  There are
a couple of dozen places where this could occur.  The workaround is to
(until someone finds a terminal that it won't work for ;-) map the null
to 128.
 
> 537             case 'X':           /* FALLTHRU */
> 538                 save_number(format, npop(), len);
> 539                 break;
> 540
> 541             case 'c':
> 542                 save_char(npop());
> 543                 break;
> 
> Frank.
> 
> 
> _______________________________________________
> Bug-ncurses mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/bug-ncurses

-- 
Thomas E. Dickey <address@hidden>
http://invisible-island.net
ftp://invisible-island.net




reply via email to

[Prev in Thread] Current Thread [Next in Thread]