[Top][All Lists]

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

Re: tput(1) -T without a tty

From: Thomas Dickey
Subject: Re: tput(1) -T without a tty
Date: Thu, 5 Oct 2017 04:27:06 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, Oct 05, 2017 at 08:11:46AM +0300, Lauri Tirkkonen wrote:
> On Wed, Oct 04 2017 20:59:02 -0400, Thomas Dickey wrote:
> > > But using ncurses tput, which requires a tty, the illumos build cannot
> > > be run from cron. I've thrown together the following quick patch to
> > > avoid opening a tty if -T is given; is this a reasonable use case?
> > 
> > hmm - rather than special-case "-T", why not a new option to tell it
> > to not attempt to modify the terminal modes?
> My thinking here was that if you're using -T, you're not looking to
> update terminal modes but just querying the terminfo database (after all

I don't agree: the intent of "-T" was to override $TERM

       tput [-Ttype] capname [parms ... ]
       tput [-Ttype] init
       tput [-Ttype] reset
       tput [-Ttype] longname
       tput -S  <<
       tput -V

The first usage is for querying, while init/reset initialze the terminal.
(longname also is for querying).  Neither capname or longname have to
modify the terminal modes, but init/reset aren't complete unless they
do the modifications.

> the first line of the manpage reads "initialize a terminal or query
> terminfo database"). I'm ok with a new option too, but on the off chance
> that there's any other software that expects to be able to query the
> database without a tty, it'll have to be modified to use this new option
> for ncurses tput too.
> > Offhand, neither tset/tput has a "-f" (force) option...
> > 
> > Solaris tput doesn't special-case "-T", it simply ignores the failure
> > to update the terminal modes.
> Interesting. I'm not sure what's the correct approach here.

I'd expect scripts such as you're talking about to use the capname
(capabilities _other_ than init/reset) to obtain specific capabilities.
After all, these are terminfo names:

       reset_1string                 rs1        r1        reset string
       reset_2string                 rs2        r2        reset string
       reset_3string                 rs3        r3        reset string

       init_1string                  is1        i1        initialization
       init_2string                  is2        is        initialization
       init_3string                  is3        i3        initialization

while init/reset are combinations of capabilities.

I'd expect more discussion about this one, but haven't seen any constructive
comments to date:

       clear_screen                  clear      cl        clear screen and
                                                          home cursor (P*)
Thomas E. Dickey <address@hidden>

Attachment: signature.asc
Description: Digital signature

reply via email to

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