Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

stty(1)

tabs(1)

profile(4)

terminfo(4)



  tput(1)                             CLIX                             tput(1)



  NAME

    tput - Initializes a terminal or queries terminfo database

  SYNOPSIS

    tput [-Ttype] capname [parms ... ]

    tput [-Ttype] init

    tput [-Ttype] reset

    tput [-Ttype] longname

  FLAGS

    -Ttype     Indicates the type of terminal.  Normally this flag is
               unnecessary, because the default is taken from the environment
               variable $TERM.  If -T is specified, then the shell variables
               $LINES and $COLUMNS and the layer size (see layers) will not be
               referenced.

    capname    Indicates the attribute from the terminfo database.

    parms      If the attribute is a string that takes parameters, the
               arguments parms will be instantiated into the string.  An all
               numeric argument will be passed to the attribute as a number.

    init       If the terminfo database is present and an entry for the user's
               terminal exists (see -Ttype, above), the following will occur:

               1.  If present, the terminal's initialization strings will be
                   output (is1, is2, is3, if, iprog).

               2.  Any delays (for example, newline) specified in the entry
                   will be set in the tty driver.

               3.  Tabs expansion will be turned on or off according to the
                   specification in the entry.

               4.  If tabs are not expanded, standard tabs will be set (every
                   8 spaces).

    If an entry does not contain the information needed for any of the four
    above activities, that activity will silently be skipped.  Instead of
    putting out initialization strings, the terminal's reset strings will be
    output if present (rs1, rs2, rs3, rf).  If the reset strings are not
    present, but initialization strings are, the initialization strings will
    be output.  Otherwise, reset acts identically to init.  If the terminfo
    database is present and an entry for the user's terminal exists (see -
    Ttype above), then the long name of the terminal will be put out.  The



  2/94 - Intergraph Corporation                                              1






  tput(1)                             CLIX                             tput(1)



    long name is the last name in the first line of the terminal's description
    in the terminfo database (see term).

  DESCRIPTION

    The tput command initializes and resets a terminal.  The command uses the
    terminfo database to make the values of terminal-dependent capabilities
    and information available to the shell (see sh), to initialize or reset
    the terminal, or return the long name of the requested terminal type.  The
    tput command outputs a string if the attribute (capabilityname) is of type
    string, or an integer if the attribute is of type integer.  If the
    attribute is of type boolean, the tput command simply sets the exit code
    (0 for TRUE if the terminal has the capability, 1 for FALSE if it does
    not), and produces no output.  Before using a value returned on stdout,
    the user should test the exit code ($?, see sh) to be sure it is 0.  (See
    EXIT VALUES and DIAGNOSTICS.)  For a complete list of capabilities and the
    capname associated with each, see terminfo.

  EXAMPLES

    1.  Initialize the terminal according to the type of terminal in the
        environmental variable $TERM.  This command should be included in
        everyone's .profile after the environmental variable $TERM has been
        exported, as illustrated on the profile manual page.

        tput init


    2.  Reset an AT&T 5620 terminal, overriding the type of terminal in the
        environmental variable $TERM.

        tput -T5620 reset


    3.  Send the sequence to move the cursor to row 0, column 0 (the upper
        left corner of the screen, usually known as the ``home'' cursor
        position).

        tput cup 0 0


    4.  Echo the clear-screen sequence for the current terminal.

        tput clear


    5.  Display the number of columns for the current terminal.

        tput cols





  2                                              Intergraph Corporation - 2/94






  tput(1)                             CLIX                             tput(1)



    6.  Display the number of columns for the 450 terminal.

        tput -T450 cols


    7.  Set the shell variables bold, to begin stand-out mode sequence, and
        offbold, to end standout mode sequence, for the current terminal.
        This might be followed by a prompt:

        bold=`tput smso`
        "offbold=`tput rmso`"
        echo "${bold}Please type in your name: ${offbold}\c"


    8.  Set exit code to indicate if the current terminal is a hardcopy
        terminal.

        tput hc


    9.  Send the sequence to move the cursor to row 23, column 4.

        tput cup 23 4


    10. Display the long name from the terminfo database for the type of
        terminal specified in the environmental variable $TERM.

        tput longname


  FILES

    /usr/lib/terminfo/?/*   Compiled terminal description database.

    /usr/include/curses.h   curses header file.

    /usr/include/term.h     terminfo header file.

    /usr/lib/tabset/*       Tab settings for some terminals, in a format
                            appropriate to be output to the terminal (escape
                            sequences that set margins and tabs).  For more
                            information, see the Tabs and Initialization
                            section of terminfo.

  DIAGNOSTICS

    The tput command displays the following error messages and sets the
    corresponding exit codes.

    Exit Code   Error Message



  2/94 - Intergraph Corporation                                              3






  tput(1)                             CLIX                             tput(1)



    -1          capname is a numeric variable that is not specified in the
                terminfo database for this terminal type, for example, tput
                -T450 lines and tput -T2621 xmc

    1           No error message is displayed, see EXIT VALUES.

    2           Usage error

    3           Unknown terminal type or no terminfo database

    4           Unknown terminfo capability capname

  EXIT VALUES

    If capname is of type boolean, a value of 0 is set for TRUE and 1 for
    FALSE.

    If capname is of type string, a value of 0 is set if the capname is
    defined for this terminal type (the value of capname is returned on
    stdout); a value of 1 is set if capname is not defined for this terminal
    type (a null value is returned on stdout).

    If capname is of type integer, a value of 0 is always set, whether or not
    capname is defined for this terminal type.  To determine if capname is
    defined for this terminal type, the user must test the value of stdout.  A
    value of -1 means that capname is not defined for this terminal type.

    Any other exit code indicates an error; see DIAGNOSTICS.

    The tput command exits with a nonzero value if it fails.

  RELATED INFORMATION

    Commands:  stty(1), tabs(1)

    Files:  profile(4), terminfo(4)


















  4                                              Intergraph Corporation - 2/94




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