2.9BSD/usr/man/cat3/termcap.3x


TERMCAP(3X)         UNIX Programmer's Manual          TERMCAP(3X)

NAME
     tgetent, tgetnum, tgetflag, tgetstr, tgoto, tputs - terminal
     independent operation routines

SYNOPSIS
     char PC;
     char *BC;
     char *UP;
     short ospeed;

     tgetent(bp, name)
     char *bp, *name;

     tgetnum(id)
     char *id;

     tgetflag(id)
     char *id;

     char *
     tgetstr(id, area)
     char *id, **area;

     char *
     tgoto(cm, destcol, destline)
     char *cm;

     tputs(cp, affcnt, outc)
     register char *cp;
     int affcnt;
     int (*outc)();

     cc ... -ltermcap

DESCRIPTION
     These functions extract and use capabilities from the termi-
     nal capability data base _t_e_r_m_c_a_p(5).  These are low level
     routines; see _c_u_r_s_e_s(3X) for a higher level package.

     _T_g_e_t_e_n_t extracts the entry for terminal _n_a_m_e into the buffer
     at _b_p. _B_p should be a character buffer of size 1024 and must
     be retained through all subsequent calls to _t_g_e_t_n_u_m, _t_g_e_t_-
     _f_l_a_g, and _t_g_e_t_s_t_r. _T_g_e_t_e_n_t returns -1 if it cannot open the
     _t_e_r_m_c_a_p file, 0 if the terminal name given does not have an
     entry, and 1 if all goes well.  It will look in the environ-
     ment for a TERMCAP variable.  If found, and the value does
     not begin with a slash, and the terminal type name is the
     same as the environment string TERM, the TERMCAP string is
     used instead of reading the termcap file.  If it does begin
     with a slash, the string is used as a path name rather than
     /_e_t_c/_t_e_r_m_c_a_p. This can speed up entry into programs that
     call _t_g_e_t_e_n_t, as well as to help debug new terminal

Printed 7/31/83                                                 1

TERMCAP(3X)         UNIX Programmer's Manual          TERMCAP(3X)

     descriptions or to make one for your terminal if you can't
     write the file /_e_t_c/_t_e_r_m_c_a_p.

     _T_g_e_t_n_u_m gets the numeric value of capability _i_d, returning
     -1 if is not given for the terminal.  _T_g_e_t_f_l_a_g returns 1 if
     the specified capability is present in the terminal's entry,
     0 if it is not.  _T_g_e_t_s_t_r gets the string value of capability
     _i_d, placing it in the buffer at _a_r_e_a, advancing the _a_r_e_a
     pointer.  It decodes the abbreviations for this field
     described in _t_e_r_m_c_a_p(5), except for cursor addressing and
     padding information.

     _T_g_o_t_o returns a cursor addressing string decoded from _c_m to
     go to column _d_e_s_t_c_o_l in line _d_e_s_t_l_i_n_e. It uses the external
     variables UP (from the up capability) and BC (if bc is given
     rather than bs) if necessary to avoid placing \n, ^D or ^@
     in the returned string.  (Programs which call tgoto should
     be sure to turn off the XTABS bit(s), since tgoto may now
     output a tab.  Note that programs using termcap should in
     general turn off XTABS anyway since some terminals use con-
     trol I for other functions, such as nondestructive space.)
     If a % sequence is given which is not understood, then _t_g_o_t_o
     returns OOPS.

     _T_p_u_t_s decodes the leading padding information of the string
     _c_p; _a_f_f_c_n_t gives the number of lines affected by the opera-
     tion, or 1 if this is not applicable, _o_u_t_c is a routine
     which is called with each character in turn.  The external
     variable _o_s_p_e_e_d should contain the output speed of the ter-
     minal as encoded by _s_t_t_y(2).  The external variable PC
     should contain a pad character to be used (from the pc capa-
     bility) if a null (^@) is inappropriate.

FILES
     /usr/lib/libtermcap.a-ltermcap library
     /etc/termcap        data base

SEE ALSO
     ex(1), curses(3X), termcap(5)

AUTHOR
     William Joy

Printed 7/31/83                                                 2