gno/lib/libtermcap/termcap.3

301 lines
7.1 KiB
Groff
Raw Normal View History

1997-09-30 06:24:04 +00:00
.\" Copyright (c) 1980, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)termcap.3 8.2 (Berkeley) 12/11/93
.\"
.\" $Id: termcap.3,v 1.2 1997/10/03 04:52:59 gdr Exp $
.\"
1997-09-30 06:24:04 +00:00
.TH TERMCAP 3 "September 1997" GNO "Library Routines"
.SH NAME
.BR tgetent ,
.BR tgetnum ,
.BR tgetflag ,
.BR tgetstr ,
.BR tgoto ,
.BR tputs ,
.BR tparm ,
.BR _set_ospeed
\- terminal independent operation routines
.SH SYNOPSIS
#include <termcap.h>
.sp 1
char
.BR PC ;
.br
.RB "char *" BC ;
.br
.RB "char *" UP ;
.br
short
.BR ospeed ;
.sp 1
int \fBtgetent\fR (char *\fIbp\fR, const char *\fIname\fR);
.br
int \fBtgetnum\fR (const char *\fIid\fR);
.br
int \fBtgetflag\fR (const char *\fIid\fR);
.br
char *\fBtgetstr\fR (const char *\fIid\fR, char **\fIarea\fR);
.br
char *\fBtgoto\fR (const char *\fIcm\fR, int \fIdestcol\fR, int \fIdestline\fR);
.br
int \fBtputs\fR (const char *\fIcp\fR, int \fIaffcnt\fR, int (*\fIoutc\fR)(int));
.br
char *\fBtparm\fR (const char *\fIcp\fR, ...);
.br
void \fB_set_ospeed\fR (long \fIspeed\fR);
.SH DESCRIPTION
These functions extract and use capabilities from a terminal capability data
base, usually
.\" /usr/share/misc/termcap ,
.BR /etc/termcap ,
1997-09-30 06:24:04 +00:00
the format of which is described in
.BR termcap (5).
These are low level routines;
see
.BR curses (3)
for a higher level package.
.LP
The
.BR tgetent
function
extracts the entry for terminal
.I name
into the buffer at
.IR bp .
The
.I bp
argument
should be a character buffer of size
1024 and must be retained through all subsequent calls to
.BR tgetnum ,
.BR tgetflag ,
and
.BR tgetstr .
The
.BR tgetent
function
returns \-1 if none of the
.BR termcap
data base files could be opened,
0 if the terminal name given does not have an entry, and 1 if all goes well.
It will look in the environment for a
.BR TERMCAP
variable.
If found, and the value does not begin with a slash,
and the terminal type
.I name
is the same as the environment string
.BR TERM ,
the
.BR TERMCAP
string is used instead of reading a
.BR termcap
file.
If it does begin with a slash, the string is used as a path name
of the
.BR termcap
file to search.
If
.BR TERMCAP
does not begin with a slash and
.I name
is different from
.BR TERM ,
.BR tgetent
searches the files
.BR $HOME/.termcap
and
.\" /usr/share/misc/termcap ,
.BR /etc/termcap ,
1997-09-30 06:24:04 +00:00
in that order, unless the environment variable
.BR TERMPATH
exists,
in which case it specifies a list of file pathnames
(separated by spaces or colons) to be searched instead.
Whenever multiple files are searched and a
.B tc
field occurs in the requested entry, the entry it names must be found
in the same file or one of the succeeding files.
This can speed up entry into programs that call
.BR tgetent ,
as well as help debug new terminal descriptions
or make one for your terminal if you can't write the file
.\" /usr/share/misc/termcap .
.BR /etc/termcap .
1997-09-30 06:24:04 +00:00
.LP
The
.BR tgetnum
function
gets the numeric value of capability
.IR id ,
returning \-1 if it is not given for the terminal.
The
.BR tgetflag
function
returns 1 if the specified capability is present in
the terminal's entry, 0 if it is not.
The
.BR tgetstr
function
returns the string value of the capability
.IR id ,
places it in the buffer at
.IR area ,
and advances the
.I area
pointer.
It decodes the abbreviations for this field described in
.BR termcap (5),
except for cursor addressing and padding information.
The
.BR tgetstr
function
returns
.BR NULL
if the capability was not found.
.LP
The
.BR tgoto
function
returns a cursor addressing string decoded from
.I cm
to go to column
.I destcol
in line
.IR destline .
It uses the external variables
.B UP
(from the
.B up
capability)
and
.B BC
(if
.B bc
is given rather than
.BR bs )
if necessary to avoid placing
.B \en ,
.BR ^D
or
.BR ^@
in
the returned string.
(Programs which call
.BR tgoto
should be sure to turn off the
.BR XTABS
bit(s),
since
.BR tgoto
may now output a tab.
Note that programs using termcap should in general turn off
.BR XTABS
anyway since some terminals use control-I for other functions,
such as nondestructive space.)
If a
.BR %
sequence is given which is not understood, then
.BR tgoto
returns
.BR OOPS .
.LP
The
.BR tputs
function
decodes the leading padding information of the string
.IR cp ,
.I affcnt
gives the number of lines affected by the operation, or 1 if this is
not applicable,
.I outc
is a routine which is called with each character in turn.
The external variable
.IR ospeed
should contain the output speed of the terminal as encoded by
.BR stty (3).
The
.BR _set_ospeed
functions converts any (not exactly matched only) numeric speed to
.BR stty (3)
encoded speed and set
.IR ospeed
variable.
The external variable
.IR PC
should contain a pad character to be used (from the
.B pc
capability)
if a null
.B ^@
is inappropriate.
.LP
The
.BR tparm
function
instantiates the string
.I cp
with given parameters.
A pointer is returned which points to
the result of
.I cp
with the parameters applied.
If a
.B %
sequence is given which is not understood, then
.BR tparm
returns
.BR OOPS .
.SH FILES
.RS
.\" \fB/usr/lib/libtermcap.a\fR
.IP \fB/usr/lib/libtermcap\fR
1997-09-30 06:24:04 +00:00
The
.BR ltermcap
library (also known as
.BR ltermlib ).
.\" \fB/usr/share/misc/termcap\fR
.IP \fB/etc/termcap\fR
1997-09-30 06:24:04 +00:00
standard terminal capability data base
.\" \fB$HOME/.termcap\fR
.IP \fB$HOME/termcap\fR
1997-09-30 06:24:04 +00:00
user's terminal capability data base
.RE
.SH SEE ALSO
.BR ex (1),
.BR curses (3),
.BR termcap (5)
.SH HISTORY
The
.BR termcap
functions appeared in 4.0BSD.