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
On Mar 31, 12:18pm, "Mikel Ward" wrote:
}
} It appears to be ignoring all characters after the first two:
termcap capabilities codes are two characters long by definition.
See this part of termcap(5):
-----
Types of Capabilities
Capabilities in termcap are of three types: Boolean capabilities, which
indicate particular features that the terminal has; numeric capabilities,
giving the size of the display or the size of other attributes; and
string capabilities, which give character sequences that can be used to
perform particular terminal operations. All capabilities have two-letter
codes.
-----
Presumably when you try to use a longer capability string, it just
truncates it. You may be thinking of termlib(3), which can have longer
capabilities.
} Also, tgetnum is returning -1 for all attributes I try, even valid ones!
}
} # this should turn off all attributes according to termcap(5)
} # ./tstr me | od -c
} Warning: me is not a known attribute
me is a string type capability (see termcap(5)), tgetnum should be
returning -1 for it.
} 0000000 033 [ m
} 0000003
} # this is the audible bell
} # ./tstr bl | od -c
} Warning: bl is not a known attribute
bl is also a string type capability.
} 0000000 007
} 0000001
} # terminal can backspace with ^H
} # ./tstr bs | od -c
} Can't happen: tgetnum and tgetflag disagree
This is a bug in your program. bs is a boolean (or flag)
capability. Thus tgetnum is correctly returning -1, and tgetflag is
correctly returning 1 to indicate the terminal does have that
capability.
I think you are misunderstanding what the functions do. tgetstr()
returns the string associated with a string type capability (i.e. how
to initialise the terminal). If the terminal doesn't have the
capability or you ask for a numeric or boolean capability, it will
return NULL. tgetnum() returns the number associated with a numeric
type capability (i.e. how many rows the terminal has). If the terminal
doesn't have the capability or you ask for a string or boolean
capability, it will return -1. tgetflag() returns an indication of if
a terminal has a certain capability (i.e. does it automatically move to
the next line if you go past the right edge of the screen). If the
terminal doesn't have the capability, it will return 0. I don't know
what would happen if you ask for a string or numeric capability.
}-- End of excerpt from "Mikel Ward"
Home |
Main Index |
Thread Index |
Old Index