Search code examples
c++cterminalcursesterminfo

Can I use tparm() without tputs or putp


My understanding is that the function char *tparm(char *str, ...); just converts the given string str to an expanded parameterized version which will be fine to use with stdout outputting functions like printf or cout. But the man page mentions -

Parameterized strings should be passed through tparm to instantiate them. All terminfo strings [including the output of tparm] should be printed with tputs or putp.

So can I parse terminfo entries and use tparm() on them passing appropriate parameters and output them using stdout output functions? Also I'm doing the checks of non-tty output and ignoring these methods so I got that base covered.


Solution

  • Sure, you can. But some capability strings include padding and time delays, which tparm assumes will be interpreted by tputs.

    For instance, the flash capability would use time-delays, which are passed along to tputs (using the syntax described in the terminfo(5) manual page).