[Top][All Lists]

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

Re: mvwprintw

From: Thomas Dickey
Subject: Re: mvwprintw
Date: Mon, 3 Apr 2006 18:09:14 -0400 (EDT)

On Mon, 3 Apr 2006, Bob Rossi wrote:

OK, I've got more info. I've tracked it down to here
tputs(buffer, 1, _nc_outch);

If I put a _nc_flush () call before that, there is no error. An
_nc_flush () after that line produces the corrupted terminal.

(tgdb) p buffer
$1 =   "."

For some reason, I can't step into tputs to debug it. Any idea why?

There are two tputs() functions - one in ncurses, one in the termcap library. Perhaps the debugger is confused.

On the other hand, it might be that termcap's tputs() is being called.
I don't see any tputs in your trace either.

tputs() is supposed to handle time-delays that might be embedded in a
terminfo string (the numbers in angle-brackets, e.g., in vt100 entry).

termcap/terminfo syntax for padding is not compatible...

Aside from that, the two functions should be interchangeable.

However, I can set a breakpoint on _nc_outch. From the tputs call,
_nc_outch get's called with
(tgdb) p ch
$1 = 49
(tgdb) p (char)ch
$2 = 49 '1'

and it goes into the branch

putc(ch, NC_OUTPUT);
(tgdb) p ch
$3 = 67
(tgdb) p (char)ch
$4 = 67 'C'

and it goes into the branch

putc(ch, NC_OUTPUT);

That sounds like the case from your trace on Friday: what I expected to see as a \E[1C, but only a 1C in the output typescript.

Reading termcap 1.3.1's source (termcap.c), I see this chunk in tputs():

  if (*str == '.')
      padcount += *str++ - '0';
  if (*str == '*')
      padcount *= nlines;
  while (*str)
    (*outfun) (*str++);

So that '.' character causes termcap's tputs() to step over the null
terminating the string, and then write bytes til the next null.

The larger context for it is that the function is expecting a padding
number to precede the string.  Its handling of '.' is incorrect, since
it should only check for it if there were digits preceding the '.'.

Thomas E. Dickey

reply via email to

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