124 lines
5.6 KiB
HTML
124 lines
5.6 KiB
HTML
<HTML>
|
|
<HEAD>
|
|
<TITLE>termcap(3)</TITLE>
|
|
</HEAD>
|
|
<BODY>
|
|
<H1>termcap(3)</H1>
|
|
<HR>
|
|
<PRE>
|
|
|
|
</PRE>
|
|
<H2>NAME</H2><PRE>
|
|
termcap, tgetent, tgetnum, tgetflag, tgetstr, tgoto, tputs - terminal
|
|
independent operation routines
|
|
|
|
|
|
</PRE>
|
|
<H2>SYNOPSIS</H2><PRE>
|
|
<STRONG>#include</STRONG> <STRONG><termcap.h></STRONG>
|
|
|
|
<STRONG>int</STRONG> <STRONG>tgetent(char</STRONG> <STRONG>*</STRONG><EM>bp</EM><STRONG>,</STRONG> <STRONG>char</STRONG> <STRONG>*</STRONG><EM>name</EM><STRONG>)</STRONG>
|
|
<STRONG>int</STRONG> <STRONG>tgetflag(char</STRONG> <STRONG>*</STRONG><EM>id</EM><STRONG>)</STRONG>
|
|
<STRONG>int</STRONG> <STRONG>tgetnum(char</STRONG> <STRONG>*</STRONG><EM>id</EM><STRONG>)</STRONG>
|
|
<STRONG>char</STRONG> <STRONG>*tgetstr(char</STRONG> <STRONG>*</STRONG><EM>id</EM><STRONG>,</STRONG> <STRONG>char</STRONG> <STRONG>**</STRONG><EM>area</EM><STRONG>)</STRONG>
|
|
<STRONG>char</STRONG> <STRONG>*tgoto(char</STRONG> <STRONG>*</STRONG><EM>cm</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>destcol</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>destline</EM><STRONG>)</STRONG>
|
|
<STRONG>int</STRONG> <STRONG>tputs(char</STRONG> <STRONG>*</STRONG><EM>cp</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>affcnt</EM><STRONG>,</STRONG> <STRONG>void</STRONG> <STRONG>(*</STRONG><EM>outc</EM><STRONG>)(int))</STRONG>
|
|
|
|
|
|
</PRE>
|
|
<H2>DESCRIPTION</H2><PRE>
|
|
These functions extract and use capabilities from the terminal capability
|
|
data base <STRONG><A HREF="../man5/termcap.5.html">termcap(5)</A></STRONG>. These are low level routines; see <STRONG><A HREF="../man3/curses.3.html">curses(3)</A></STRONG> for a
|
|
higher level package.
|
|
|
|
<STRONG>Tgetent</STRONG> extracts the entry for terminal <EM>name</EM> into the buffer at <EM>bp</EM>. <EM>Bp</EM>
|
|
should be a character buffer of size 1024 and must be retained through
|
|
all subsequent calls to <STRONG>tgetnum</STRONG>, <STRONG>tgetflag</STRONG>, and <STRONG>tgetstr</STRONG>. <STRONG>Tgetent</STRONG> returns
|
|
-1 if it cannot find a termcap file, 0 if the terminal name given does
|
|
not have an entry, and 1 if all goes well.
|
|
|
|
<STRONG>Tgetent</STRONG> uses the following recipe to find the termcap file and entry
|
|
<EM>name</EM>:
|
|
|
|
if $TERMCAP is itself a termcap entry for <EM>name</EM>
|
|
then
|
|
use $TERMCAP
|
|
elif $TERMCAP names a file
|
|
then
|
|
use entry <EM>name</EM> found in that file
|
|
elif this is Minix-vmd
|
|
then
|
|
if $TERMPATH is defined
|
|
then
|
|
search the termcap files named in $TERMPATH for the first
|
|
occurance of a <EM>name</EM> entry and use that entry
|
|
else
|
|
the path <STRONG>$HOME/.termcap:/etc/termcap:/usr/etc/termcap"</STRONG> is
|
|
searched for entry <EM>name</EM>
|
|
fi
|
|
fi
|
|
|
|
<STRONG>Tgetnum</STRONG> gets the numeric value of capability <EM>id</EM>, returning -1 if is not
|
|
given for the terminal. <STRONG>Tgetflag</STRONG> returns 1 if the specified capability
|
|
is present in the terminal's entry, 0 if it is not. <STRONG>Tgetstr</STRONG> returns the
|
|
string value of the capability <EM>id</EM>, places it in the buffer at <EM>area</EM>, and
|
|
advances the <EM>area</EM> pointer. It decodes the abbreviations for this field
|
|
described in <STRONG><A HREF="../man5/termcap.5.html">termcap(5)</A></STRONG>, except for cursor addressing and padding
|
|
information. <STRONG>Tgetstr</STRONG> returns NULL if the capability was not found.
|
|
|
|
<STRONG>Tgoto</STRONG> returns a cursor addressing string decoded from <EM>cm</EM> to go to column
|
|
<EM>destcol</EM> in line <EM>destline</EM>. It uses the external variables <STRONG>UP</STRONG> (from the <STRONG>up</STRONG>
|
|
capability) and <STRONG>BC</STRONG> (if <STRONG>bc</STRONG> is given rather than <STRONG>bs</STRONG>) if necessary to avoid
|
|
placing <STRONG>\n</STRONG>, <STRONG>^D</STRONG> or <STRONG>^@</STRONG> in the returned string. (Programs which call tgoto
|
|
should be sure to turn off the XTABS bit(s), since <STRONG>tgoto</STRONG> may now output a
|
|
tab. Note that programs using termcap should in general turn off XTABS
|
|
anyway since some terminals use CTRL-I for other functions, such as
|
|
nondestructive space.) If a <STRONG>%</STRONG> sequence is given which is not understood,
|
|
then <STRONG>tgoto</STRONG> returns "OOPS".
|
|
|
|
<STRONG>Tputs</STRONG> decodes the leading padding information of the string <EM>cp</EM>; <EM>affcnt</EM>
|
|
gives the number of lines affected by the operation, or 1 if this is not
|
|
applicable, <EM>outc</EM> is a routine which is called with each character in
|
|
turn. The external variable <STRONG>ospeed</STRONG> should contain the output speed of
|
|
the terminal as encoded by <STRONG><A HREF="../man3/stty.3.html">stty(3)</A></STRONG>. The external variable <STRONG>PC</STRONG> should
|
|
contain a pad character to be used (from the <STRONG>pc</STRONG> capability) if a null
|
|
(<STRONG>^@</STRONG>) is inappropriate.
|
|
|
|
|
|
</PRE>
|
|
<H2>SEE ALSO</H2><PRE>
|
|
<STRONG><A HREF="../man3/curses.3.html">curses(3)</A></STRONG>, <STRONG><A HREF="../man5/termcap.5.html">termcap(5)</A></STRONG>.
|
|
|
|
|
|
</PRE>
|
|
<H2>AUTHOR</H2><PRE>
|
|
William Joy
|
|
|
|
|
|
</PRE>
|
|
<H2>NOTES</H2><PRE>
|
|
The Minix implementation does not support any of the external variables,
|
|
only the functions calls. The Minix-vmd termcap does support it all,
|
|
although noone in his right mind meddles with those variables.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</PRE>
|
|
</BODY>
|
|
</HTML>
|