Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ tput(1) — Reliant UNIX 5.44c4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

clear(1)

stty(1)

tabs(1)

infocmp(1M)

profile(4)

term(4)

terminfo(4)

term(5)

tput(1)                                                             tput(1)

NAME
     tput - initialize a terminal or query the terminfo database

SYNOPSIS
     tput [-T type] capname [parameter ...]                        Format 1

     tput [-T type] -S <<!
     > capname [parameter]
     ...
     > !                                                           Format 2

     tput [-T type] init                                           Format 3

     tput [-T type] reset                                          Format 4

     tput [-T type] longname                                       Format 5

DESCRIPTION
     You can use tput to

     -  indicate one capability of a terminal (Format 1)

     -  list a number of capabilities of a terminal (Format 2)

     -  initialize a terminal (Format 3)

     -  reset a terminal (Format 4)

     -  display the long name of a terminal (Format 5).

OPTIONS
   Format 1:Indicating one capability of a terminal

     tput [-T type] capname [parameter ...]

     tput indicates capabilities of a terminal as defined in the terminfo
     database [see terminfo(4)].

     -T type
          type indicates the type of terminal whose capabilities are to be
          queried. If the -T type option is specified, the shell variables
          LINES and COLUMNS and the layer size will not be referenced.

          -T type not specified:

          type defaults to the value of the environment variable TERM.

     capname
          capname is the alias (abbreviated form) of a terminal capability
          as defined in the terminfo source file. To find out whether your
          terminal has a particular capability (attribute), you specify the
          appropriate alias capname [see terminfo(4)]. Depending on the



Page 1                       Reliant UNIX 5.44                Printed 11/98

tput(1)                                                             tput(1)

          type of attribute, tput responds as follows:

          -  Boolean type attribute: tput simply sets an exit status (0 for
             true is the terminal has the attribute, 1 for false if it does
             not).

             In the Bourne and Korn shells you can inspect the exit status
             with echo $?.

          -  string type attribute: tput returns the appropriate string.

          -  integer type attribute: tput returns an integer.

          If capname is an attribute for which no value is assigned to the
          specified terminal type in the terminfo database, tput returns
          -1.

     parameter
          If the capname attribute is a string that takes parameters, you
          can enter the parameters in parameter. capname and parameter are
          passed to tput as a compound string. An all numeric parameter is
          passed as a number.

   Format 2: Listing a number of capabilities of a terminal

     tput [-T type] -S <<!
     >  capname [parameter]
       ...
     > !

     tput can be used to list multiple capabilities of the user's terminal.
     You pass the capabilities from standard input rather than from the
     command line (see Example 4). Only one terminal capability is permit-
     ted per line. If the -T type option is specified, the shell variables
     LINES and COLUMNS will not be referenced. The meanings of the exit
     statuses 0 and 1 change (see ERROR MESSAGES).

     -T type
          type indicates the type of terminal whose capabilities are to be
          queried. If the -T type option is specified, the shell variables
          LINES and COLUMNS and the layer size generated with the layers
          command remain unchanged.

          -T type not specified:

          type defaults to the value of the TERM environment variable.

     capname
          capname is the alias (abbreviated form) of a terminal capability
          as defined in the terminfo source file. To find out whether your
          terminal has a particular capability (attribute), you specify the
          appropriate alias capname [see terminfo(4)]. Depending on the


Page 2                       Reliant UNIX 5.44                Printed 11/98

tput(1)                                                             tput(1)

          type of attribute, tput responds as follows:

          -  Boolean type attribute: tput simply sets an exit status (0 for
             true is the terminal has the attribute, 1 for false if it does
             (not). In the Bourne and Korn shells you can inspect the exit
             status with echo $?.

          -  string type attribute: tput returns the appropriate string.

          -  integer type attribute: tput returns an integer.

          If capname is an attribute for which no value is assigned to the
          specified terminal type in the terminfo database, tput returns
          -1.

     Note:
          Using the command infocmp -I term [see infocmp(1M) and term(4)]
          you can obtain a full description of your terminal. term is the
          name of your terminal as listed in the output of the command

          ls -C /usr/share/lib/terminfo/?.

     parameter
          If the capname attribute is a string that takes parameters, you
          can enter the parameters in parameter. capname and parameter are
          passed to tput as a compound string. An all numeric parameter is
          passed as a number.

   Format 3: Initializing a terminal

     tput [-T type] init

     If the terminfo database contains an entry for the user's terminal,
     tput initializes the terminal in accordance with the terminal type
     specified in -T type. tput performs the following individual activi-
     ties:

     -  If present, the terminal's initialization strings are output
        (capname is1, is2, is3, if, ifprog).

     -  Any delays (e.g. newline) specified in the entry are set in the
        terminal driver.

     -  Tabs expansion is turned on or off according to the specification
        in the entry.

     -  If tabs are not expanded, the standard tabs are set (every 8
        spaces).

     If the terminfo entry does not contain the information needed for any
     of these activities, that activity is silently skipped.



Page 3                       Reliant UNIX 5.44                Printed 11/98

tput(1)                                                             tput(1)

     -T type
          This indicates the type of terminal whose capabilities you want
          to use to initialize your terminal.

          -T type not specified:

          type defaults to the value of the environment variable TERM.

   Format 4: Resetting a terminal

     tput [-T type] reset

     tput outputs the terminal's reset strings (capname rs1, rs2, rs2, rf).
     If the reset strings are not present but initialization strings are,
     the initialization strings are output. Otherwise, reset behaves ident-
     ically to init.

     -T type
          This indicates the type of terminal whose capabilities you want
          to use to reset your terminal.

          -T type not specified:

          type defaults to the value of environment variable TERM.

   Format 5: Displaying the long name of a terminal

     tput [-T type] longname

     If the terminfo database is present and contains an entry for the
     user's terminal (see Format 1, -T type option), the long name of the
     terminal is output. This name is the last name in the first line of
     the description of the terminal in the terminfo database [see
     terminfo(4)].

EXIT STATUS
     When capname is of type boolean and the -S option is not set:

     0    if the specified terminal type has the capability

     1    if the specified terminal type does not have the capability

     When capname is of type string and the -S option is not set:

     0    if the capname capability is defined for the terminal type

     1    if the capname capability is not defined for the terminal type
          (nothing is written to standard output)

     When capname is of type boolean or string and the -S option is set:

     0    if all lines could be processed successfully


Page 4                       Reliant UNIX 5.44                Printed 11/98

tput(1)                                                             tput(1)

     1    exit status 1 can never occur as no indication of which line
          failed can be given

     When capname is of type integer:

     0    The exit status is always 0. You can test the value of the stan-
          dard output to determine whether capname is defined for the
          specified terminal type or not. -1 on standard output indicates
          that capname is not defined.

     Error situations are indicated by the exit status >1:

     2    Application error

     3    There is no information available for the specified terminal.

     4    One of the specified arguments is invalid.

     >4   Another error has occurred.

ERROR MESSAGES
     Depending on the exit status, tput issues one of the following error
     messages:

     tput: unknown terminal type

     Terminal type type unknown or no terminfo database present, exit
     status 3.

     tput: unknown terminfo capability capname

     Self-explanatory, exit status 4.

ENVIRONMENT VARIABLES
     TERM Default value used for the type of terminal when -T type

LOCALE
     The LCMESSAGES environment variable governs the language in which
     message texts are displayed. If LCMESSAGES is undefined or is defined
     as the null string, it defaults to the value of LANG. If LANG is like-
     wise undefined or null, the system acts as if it were not internation-
     alized.

     The LCALL environment variable governs the entire locale. LCALL
     takes precedence over all the other environment variables which affect
     internationalization.








Page 5                       Reliant UNIX 5.44                Printed 11/98

tput(1)                                                             tput(1)

EXAMPLES
     Example 1

     Initializing a terminal

     $ tput init

     A sequence of control characters that initializes the screen is passed
     to the user's terminal. The sequence used is the one appropriate to
     the terminal type defined in the TERM environment variable.

     Example 2

     Displaying the number of columns for the current terminal

     $ tput cols
     80

     Example 3

     Indicating whether the current terminal is a hardcopy terminal

     $ tput hc
     $ echo $?
     1

     Since hc is a Boolean type value, tput simply returns an exit status,
     which you can inspect with echo $?. The returned value of 1 indicates
     that the terminal is not a hardcopy terminal.

     Example 4

     Displaying several capabilities in one tput invocation

     $ tput -S <<!
     > clear
     > cup 10 10
     > bold
     > !

     The screen is cleared, the cursor moved to position 10,10 and bold
     (extra bright) mode turned on. The list is terminated by an exclama-
     tion point in a separate line.

FILES
     /usr/share/lib/terminfo/?/*
          Directory containing binary versions of the terminal type
          descriptions.

     /usr/include/curses.h
          curses(3X) header file



Page 6                       Reliant UNIX 5.44                Printed 11/98

tput(1)                                                             tput(1)

     /usr/include/term.h
          terminfo(4) header file

     /usr/lib/tabset/*
          Information on tab handling (see terminfo(4), section "Tabs and
          initialization").

SEE ALSO
     clear(1), stty(1), tabs(1), infocmp(1M), profile(4), term(4),
     terminfo(4), term(5), termnames(5).












































Page 7                       Reliant UNIX 5.44                Printed 11/98

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026