2002-09-26 05:03:02 +04:00
|
|
|
.\" $NetBSD: termcap.3,v 1.27 2002/09/26 01:03:02 wiz Exp $
|
1995-02-27 13:18:34 +03:00
|
|
|
.\"
|
|
|
|
.\" Copyright (c) 1980, 1991, 1993
|
|
|
|
.\" The Regents of the University of California. All rights reserved.
|
1993-03-21 12:45:37 +03:00
|
|
|
.\"
|
|
|
|
.\" 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.
|
|
|
|
.\"
|
1995-02-27 13:18:34 +03:00
|
|
|
.\" @(#)termcap.3 8.2 (Berkeley) 12/11/93
|
1993-03-21 12:45:37 +03:00
|
|
|
.\"
|
1999-10-05 03:16:50 +04:00
|
|
|
.Dd September 30, 1999
|
1993-03-21 12:45:37 +03:00
|
|
|
.Dt TERMCAP 3
|
1999-03-22 22:44:33 +03:00
|
|
|
.Os
|
1993-03-21 12:45:37 +03:00
|
|
|
.Sh NAME
|
|
|
|
.Nm tgetent ,
|
|
|
|
.Nm tgetnum ,
|
|
|
|
.Nm tgetflag ,
|
|
|
|
.Nm tgetstr ,
|
|
|
|
.Nm tgoto ,
|
|
|
|
.Nm tputs
|
|
|
|
.Nd terminal independent operation routines
|
1998-02-05 21:45:17 +03:00
|
|
|
.Sh LIBRARY
|
|
|
|
.Lb libtermcap
|
1993-03-21 12:45:37 +03:00
|
|
|
.Sh SYNOPSIS
|
2002-02-07 10:00:09 +03:00
|
|
|
.Fd #include \*[Lt]termcap.h\*[Gt]
|
1993-03-21 12:45:37 +03:00
|
|
|
.Vt char PC;
|
|
|
|
.Vt char *BC;
|
|
|
|
.Vt char *UP;
|
|
|
|
.Vt short ospeed;
|
1999-08-15 14:59:01 +04:00
|
|
|
.Vt struct tinfo *info;
|
1997-10-13 20:11:41 +04:00
|
|
|
.Ft int
|
2002-08-19 14:11:42 +04:00
|
|
|
.Fn tgetent "char *bp" "const char *name"
|
1997-10-13 20:11:41 +04:00
|
|
|
.Ft int
|
2002-08-19 14:11:42 +04:00
|
|
|
.Fn tgetnum "const char *id"
|
1997-10-13 20:11:41 +04:00
|
|
|
.Ft int
|
2002-08-19 14:11:42 +04:00
|
|
|
.Fn tgetflag "const char *id"
|
1993-03-21 12:45:37 +03:00
|
|
|
.Ft char *
|
2002-08-19 14:11:42 +04:00
|
|
|
.Fn tgetstr "const char *id" "char **area"
|
1993-03-21 12:45:37 +03:00
|
|
|
.Ft char *
|
2002-08-19 14:11:42 +04:00
|
|
|
.Fn tgoto "const char *cm" "int destcol" "int destline"
|
1995-06-05 23:45:48 +04:00
|
|
|
.Ft void
|
2002-08-19 14:11:42 +04:00
|
|
|
.Fn tputs "const char *cp" "int affcnt" "int (*outc)(int)"
|
1999-08-15 14:59:01 +04:00
|
|
|
.Ft int
|
2002-08-19 14:11:42 +04:00
|
|
|
.Fn t_getent "struct tinfo **info" "const char *name"
|
1999-08-15 14:59:01 +04:00
|
|
|
.Ft int
|
2002-08-19 14:11:42 +04:00
|
|
|
.Fn t_getnum "struct tinfo *info" "const char *id"
|
1999-08-15 14:59:01 +04:00
|
|
|
.Ft int
|
2002-08-19 14:11:42 +04:00
|
|
|
.Fn t_getflag "struct tinfo *info" "const char *id"
|
1999-08-15 14:59:01 +04:00
|
|
|
.Ft char *
|
2002-08-19 14:11:42 +04:00
|
|
|
.Fn t_getstr "struct tinfo *info" "const char *id" "char **area" "size_t *limit"
|
2000-05-20 17:55:10 +04:00
|
|
|
.Ft char *
|
2002-08-19 14:11:42 +04:00
|
|
|
.Fn t_agetstr "struct tinfo *info" "const char *id"
|
1999-08-15 14:59:01 +04:00
|
|
|
.Ft int
|
2000-04-19 17:41:28 +04:00
|
|
|
.Fn t_getterm "struct tinfo *info" "char **area" "size_t *limit"
|
|
|
|
.Ft int
|
2002-08-19 14:11:42 +04:00
|
|
|
.Fn t_goto "struct tinfo *info" "const char *id" "int destcol" "int destline" "char *buffer" "size_t limit"
|
1999-08-15 14:59:01 +04:00
|
|
|
.Ft int
|
2002-08-19 14:11:42 +04:00
|
|
|
.Fn t_puts "struct tinfo *info" "const char *cp" "int affcnt" "void (*outc)(char, void *)" "void *args"
|
1999-08-15 14:59:01 +04:00
|
|
|
.Ft void
|
2002-08-19 14:11:42 +04:00
|
|
|
.Fn t_freent "struct tinfo *info"
|
2000-05-28 13:58:15 +04:00
|
|
|
.Ft int
|
|
|
|
.Fn t_setinfo "struct tinfo **info" "const char *entry"
|
1993-03-21 12:45:37 +03:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
These functions extract and use capabilities from a terminal capability data
|
|
|
|
base, usually
|
|
|
|
.Pa /usr/share/misc/termcap ,
|
|
|
|
the format of which is described in
|
|
|
|
.Xr termcap 5 .
|
|
|
|
These are low level routines;
|
|
|
|
see
|
|
|
|
.Xr curses 3
|
|
|
|
for a higher level package.
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fn tgetent
|
|
|
|
function
|
|
|
|
extracts the entry for terminal
|
|
|
|
.Fa name
|
|
|
|
into the buffer at
|
|
|
|
.Fa bp .
|
|
|
|
The
|
|
|
|
.Fa bp
|
|
|
|
argument
|
|
|
|
should be a character buffer of size
|
|
|
|
1024 and must be retained through all subsequent calls to
|
|
|
|
.Fn tgetnum ,
|
|
|
|
.Fn tgetflag ,
|
|
|
|
and
|
|
|
|
.Fn tgetstr .
|
|
|
|
The
|
|
|
|
.Fn tgetent
|
|
|
|
function
|
|
|
|
returns \-1 if none of the
|
|
|
|
.Nm 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
|
|
|
|
.Ev TERMCAP
|
|
|
|
variable.
|
2000-05-10 15:13:35 +04:00
|
|
|
If found, and the value does not begin with a slash, the value does
|
|
|
|
not contain the ZZ capability (see
|
|
|
|
.Em NOTES
|
2002-01-15 05:53:28 +03:00
|
|
|
for a description of this capability),
|
1993-03-21 12:45:37 +03:00
|
|
|
and the terminal type
|
|
|
|
.Fa name
|
|
|
|
is the same as the environment string
|
|
|
|
.Ev TERM ,
|
|
|
|
the
|
|
|
|
.Ev TERMCAP
|
|
|
|
string is used instead of reading a
|
|
|
|
.Nm termcap
|
2002-09-26 05:03:02 +04:00
|
|
|
file.
|
|
|
|
If the value does contain the ZZ capability then the
|
2000-05-10 15:13:35 +04:00
|
|
|
.Ev TERM
|
2002-01-15 05:53:28 +03:00
|
|
|
environment string is used to read
|
2000-05-10 15:13:35 +04:00
|
|
|
.Nm termcap ,
|
|
|
|
if the read fails for any reason the value of
|
|
|
|
.Ev TERMCAP
|
|
|
|
will be used despite it containing ZZ.
|
2002-01-15 05:53:28 +03:00
|
|
|
If
|
2000-05-10 15:13:35 +04:00
|
|
|
.Ev TERMCAP
|
|
|
|
does begin with a slash, the string is used as a path name
|
1993-03-21 12:45:37 +03:00
|
|
|
of the
|
|
|
|
.Nm termcap
|
|
|
|
file to search.
|
|
|
|
If
|
|
|
|
.Ev TERMCAP
|
|
|
|
does not begin with a slash and
|
|
|
|
.Fa name
|
|
|
|
is different from
|
|
|
|
.Ev TERM ,
|
|
|
|
.Fn tgetent
|
|
|
|
searches the files
|
|
|
|
.Pa $HOME/.termcap
|
|
|
|
and
|
|
|
|
.Pa /usr/share/misc/termcap ,
|
|
|
|
in that order, unless the environment variable
|
|
|
|
.Ev 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
|
|
|
|
.Sy 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
|
|
|
|
.Fn tgetent ,
|
|
|
|
as well as help debug new terminal descriptions
|
|
|
|
or make one for your terminal if you can't write the file
|
|
|
|
.Pa /usr/share/misc/termcap .
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fn tgetnum
|
|
|
|
function
|
|
|
|
gets the numeric value of capability
|
|
|
|
.Fa id ,
|
1995-02-27 13:18:34 +03:00
|
|
|
returning \-1 if it is not given for the terminal.
|
1993-03-21 12:45:37 +03:00
|
|
|
The
|
|
|
|
.Fn tgetflag
|
|
|
|
function
|
|
|
|
returns 1 if the specified capability is present in
|
|
|
|
the terminal's entry, 0 if it is not.
|
|
|
|
The
|
|
|
|
.Fn tgetstr
|
|
|
|
function
|
|
|
|
returns the string value of the capability
|
|
|
|
.Fa id ,
|
|
|
|
places it in the buffer at
|
|
|
|
.Fa area ,
|
|
|
|
and advances the
|
|
|
|
.Fa area
|
|
|
|
pointer.
|
|
|
|
It decodes the abbreviations for this field described in
|
|
|
|
.Xr termcap 5 ,
|
|
|
|
except for cursor addressing and padding information.
|
|
|
|
The
|
|
|
|
.Fn tgetstr
|
|
|
|
function
|
|
|
|
returns
|
|
|
|
.Dv NULL
|
|
|
|
if the capability was not found.
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fn tgoto
|
|
|
|
function
|
|
|
|
returns a cursor addressing string decoded from
|
|
|
|
.Fa cm
|
|
|
|
to go to column
|
|
|
|
.Fa destcol
|
|
|
|
in line
|
|
|
|
.Fa destline .
|
|
|
|
It uses the external variables
|
|
|
|
.Va UP
|
|
|
|
(from the
|
|
|
|
.Sy up
|
|
|
|
capability)
|
|
|
|
and
|
|
|
|
.Va BC
|
|
|
|
(if
|
|
|
|
.Sy bc
|
|
|
|
is given rather than
|
|
|
|
.Sy bs )
|
|
|
|
if necessary to avoid placing
|
|
|
|
.Sy \en ,
|
|
|
|
.Sy ^D
|
|
|
|
or
|
|
|
|
.Sy ^@
|
|
|
|
in
|
|
|
|
the returned string.
|
|
|
|
(Programs which call
|
|
|
|
.Fn tgoto
|
|
|
|
should be sure to turn off the
|
|
|
|
.Dv XTABS
|
|
|
|
bit(s),
|
|
|
|
since
|
|
|
|
.Fn tgoto
|
|
|
|
may now output a tab.
|
|
|
|
Note that programs using termcap should in general turn off
|
|
|
|
.Dv XTABS
|
|
|
|
anyway since some terminals use control-I for other functions,
|
|
|
|
such as nondestructive space.)
|
|
|
|
If a
|
|
|
|
.Sy %
|
|
|
|
sequence is given which is not understood, then
|
|
|
|
.Fn tgoto
|
|
|
|
returns
|
|
|
|
.Pq Dv OOPS .
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fn tputs
|
|
|
|
function
|
|
|
|
decodes the leading padding information of the string
|
|
|
|
.Fa cp ;
|
|
|
|
.Fa affcnt
|
|
|
|
gives the number of lines affected by the operation, or 1 if this is
|
|
|
|
not applicable,
|
|
|
|
.Fa outc
|
|
|
|
is a routine which is called with each character in turn.
|
|
|
|
The external variable
|
|
|
|
.Va ospeed
|
|
|
|
should contain the output speed of the terminal as encoded by
|
|
|
|
.Xr stty 3 .
|
|
|
|
The external variable
|
|
|
|
.Va PC
|
|
|
|
should contain a pad character to be used (from the
|
1998-04-28 11:19:28 +04:00
|
|
|
.Sy pc
|
1993-03-21 12:45:37 +03:00
|
|
|
capability)
|
|
|
|
if a null
|
|
|
|
.Pq Sy ^@
|
|
|
|
is inappropriate.
|
1999-08-15 14:59:01 +04:00
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fn t_getent
|
|
|
|
function operates in a similar manner to the
|
|
|
|
.Fn tgetent
|
2002-01-15 05:53:28 +03:00
|
|
|
function excepting that the
|
1999-08-15 14:59:01 +04:00
|
|
|
.Fa info
|
|
|
|
argument is a pointer to a pointer of the opaque type
|
|
|
|
.Va tinfo .
|
|
|
|
If the call to
|
|
|
|
.Fn t_getent
|
|
|
|
succeeds then the argument
|
|
|
|
.Fa info
|
|
|
|
will be updated with the address of an object that contains the termcap
|
2002-09-26 05:03:02 +04:00
|
|
|
entry.
|
|
|
|
This pointer can then be passed to calls of
|
1999-08-15 14:59:01 +04:00
|
|
|
.Fn t_getnum ,
|
2002-01-15 05:53:28 +03:00
|
|
|
.Fn t_getflag
|
1999-08-15 14:59:01 +04:00
|
|
|
and
|
|
|
|
.Fn t_getstr .
|
|
|
|
When the information pointed to by
|
|
|
|
.Fa info
|
|
|
|
is no longer required any storage associated with the object can be
|
|
|
|
released by calling
|
|
|
|
.Fn t_freent .
|
2000-05-28 13:58:15 +04:00
|
|
|
.Pp
|
2002-01-15 05:53:28 +03:00
|
|
|
The functions
|
2000-05-28 13:58:15 +04:00
|
|
|
.Fn t_getnum
|
|
|
|
and
|
|
|
|
.Fn t_getflag
|
|
|
|
operate in the same manner as
|
|
|
|
.Fn tgetnum
|
|
|
|
and
|
|
|
|
.Fn tgetflag
|
|
|
|
with the exception that the pointer to the termcap object is passed along
|
|
|
|
with the id of the capability required.
|
|
|
|
.Pp
|
|
|
|
The function
|
|
|
|
.Fn t_getstr
|
2002-01-15 05:53:28 +03:00
|
|
|
performs the same function as
|
2000-05-28 13:58:15 +04:00
|
|
|
.Fn tgetstr
|
|
|
|
but has a
|
|
|
|
.Fa limit
|
|
|
|
parameter that gives the number of characters that can be inserted in to
|
|
|
|
the array pointed to by
|
|
|
|
.Fa area .
|
2002-01-15 05:53:28 +03:00
|
|
|
The
|
2000-05-28 13:58:15 +04:00
|
|
|
.Fa limit
|
2002-01-15 05:53:28 +03:00
|
|
|
argument is updated by the
|
2000-05-28 13:58:15 +04:00
|
|
|
.Fn t_getstr
|
|
|
|
call to give the number of characters that remain available in
|
|
|
|
.Fa area .
|
2002-01-15 05:53:28 +03:00
|
|
|
If the t_getstr call fails then
|
2002-09-26 05:03:02 +04:00
|
|
|
.Dv NULL
|
|
|
|
will be returned and errno set to indicate the failure,
|
|
|
|
.Er ENOENT
|
|
|
|
indicates there was no termcap entry for the given
|
2000-05-28 13:58:15 +04:00
|
|
|
.Fa id ,
|
2002-09-26 05:03:02 +04:00
|
|
|
.Er E2BIG
|
|
|
|
indicates the retrieved entry would have overflowed
|
2000-05-28 13:58:15 +04:00
|
|
|
.Fa area .
|
2002-01-15 05:53:28 +03:00
|
|
|
If t_getstr is called with
|
2000-05-28 13:58:15 +04:00
|
|
|
.Fa area
|
2002-09-26 05:03:02 +04:00
|
|
|
being
|
|
|
|
.Dv NULL
|
|
|
|
then the size required to hold the capability string will be returned in
|
2000-05-28 13:58:15 +04:00
|
|
|
.Fa limit
|
|
|
|
so the caller can allocate enough storage to hold the capability.
|
|
|
|
.Pp
|
2000-05-20 17:55:10 +04:00
|
|
|
The function
|
|
|
|
.Fn t_agetstr
|
2002-01-15 05:53:28 +03:00
|
|
|
performs the same function as
|
2000-05-20 17:55:10 +04:00
|
|
|
.Fn t_getstr
|
2002-09-26 05:03:02 +04:00
|
|
|
except it handles memory allocation automatically.
|
|
|
|
The memory that
|
2000-05-20 17:55:10 +04:00
|
|
|
.Fn t_agetstr
|
2001-11-02 21:24:20 +03:00
|
|
|
allocates will be freed when
|
|
|
|
.Fn t_freent
|
|
|
|
is called.
|
2000-05-28 13:58:15 +04:00
|
|
|
.Pp
|
|
|
|
The function
|
2000-04-19 17:41:28 +04:00
|
|
|
.Fn t_getterm
|
|
|
|
returns a copy of the termcap name string of the termcap entry
|
2002-01-15 05:53:28 +03:00
|
|
|
associated with
|
2000-04-19 17:41:28 +04:00
|
|
|
.Fa info
|
|
|
|
in the buffer pointed to by
|
|
|
|
.Fa area .
|
|
|
|
.Fn t_getterm
|
2002-09-26 05:03:02 +04:00
|
|
|
returns 0 on success and \-1 on error.
|
|
|
|
On error errno will be set to
|
|
|
|
.Er EINVAL
|
|
|
|
if the termcap entry in
|
2000-04-19 17:41:28 +04:00
|
|
|
.Fa info
|
2002-09-26 05:03:02 +04:00
|
|
|
is malformed or
|
|
|
|
.Er E2BIG
|
|
|
|
if the size of the name exceeds the size specified by
|
2000-04-19 17:41:28 +04:00
|
|
|
.Fa limit .
|
2002-01-15 05:53:28 +03:00
|
|
|
If
|
2000-04-19 17:41:28 +04:00
|
|
|
.Fa area
|
2002-09-26 05:03:02 +04:00
|
|
|
is
|
|
|
|
.Dv NULL
|
|
|
|
then the size required to hold the terminal name will be returned in
|
2000-04-19 17:41:28 +04:00
|
|
|
.Fa limit
|
2002-09-26 05:03:02 +04:00
|
|
|
allowing sufficient storage to be allocated.
|
|
|
|
If
|
2000-04-19 17:41:28 +04:00
|
|
|
.Fa limit
|
2002-09-26 05:03:02 +04:00
|
|
|
is
|
|
|
|
.Dv NULL
|
|
|
|
then no bounds checking will be performed.
|
1999-08-15 14:59:01 +04:00
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fn t_goto
|
|
|
|
function is the same as the
|
|
|
|
.Fn tgoto
|
|
|
|
function excepting that the capabilities for
|
|
|
|
.Sy up
|
|
|
|
and
|
|
|
|
.Sy bc
|
|
|
|
are extracted from the
|
|
|
|
.Fa info
|
|
|
|
object and that the string formed by
|
|
|
|
.Fn t_goto
|
|
|
|
is placed in the
|
|
|
|
.Fa buffer
|
|
|
|
argument, the number of characters allowed to be placed in
|
|
|
|
.Fa buffer
|
|
|
|
is controlled by
|
|
|
|
.Fa limit .
|
|
|
|
If the expansion performed by
|
|
|
|
.Fn t_goto
|
|
|
|
would exceed the space in
|
|
|
|
.Fa buffer
|
2002-01-15 05:53:28 +03:00
|
|
|
then
|
1999-08-15 14:59:01 +04:00
|
|
|
.Fn t_goto
|
2002-09-26 05:03:02 +04:00
|
|
|
will return \-1 and set errno to
|
|
|
|
.Er E2BIG .
|
1999-08-15 14:59:01 +04:00
|
|
|
The function
|
|
|
|
.Fn t_puts
|
|
|
|
is similar to the
|
|
|
|
.Fn tputs
|
2002-01-15 05:53:28 +03:00
|
|
|
function excepting that
|
1999-08-15 14:59:01 +04:00
|
|
|
.Fa info
|
|
|
|
holds a pointer to the termcap object that was returned by a previous
|
|
|
|
.Fn t_getent
|
|
|
|
call, this object will be used to retrieve the
|
|
|
|
.Sy pc
|
2002-09-26 05:03:02 +04:00
|
|
|
attribute for the terminal.
|
|
|
|
The
|
1999-08-15 14:59:01 +04:00
|
|
|
.Fa outc
|
|
|
|
function is a pointer to a function that will be called by
|
|
|
|
.Fn t_puts
|
|
|
|
to output each character in the
|
|
|
|
.Fa cp
|
2002-09-26 05:03:02 +04:00
|
|
|
string.
|
|
|
|
The
|
1999-08-15 14:59:01 +04:00
|
|
|
.Fa outc
|
2002-09-26 05:03:02 +04:00
|
|
|
function will be called with two parameters.
|
|
|
|
The first is the character
|
1999-08-15 14:59:01 +04:00
|
|
|
to be printed and the second is an optional argument that was passed to
|
|
|
|
.Fn t_puts
|
2002-01-15 05:53:28 +03:00
|
|
|
in the
|
1999-08-15 14:59:01 +04:00
|
|
|
.Fa args
|
2002-09-26 05:03:02 +04:00
|
|
|
argument.
|
|
|
|
The interpretation of the contents of
|
1999-08-15 14:59:01 +04:00
|
|
|
.Fa args
|
2001-01-06 02:05:08 +03:00
|
|
|
is dependent solely on the implementation of
|
2002-02-20 14:35:21 +03:00
|
|
|
.Fa outc .
|
1999-08-15 14:59:01 +04:00
|
|
|
.Pp
|
2000-05-28 13:58:15 +04:00
|
|
|
The
|
|
|
|
.Fn t_setinfo
|
|
|
|
function allows the termcap entry contained in the
|
|
|
|
.Fa entry
|
2002-01-15 05:53:28 +03:00
|
|
|
string to be inserted into the the
|
2000-05-28 13:58:15 +04:00
|
|
|
.Fa info
|
2002-09-26 05:03:02 +04:00
|
|
|
structure.
|
|
|
|
Memory sufficient to hold the contents of
|
2000-05-28 13:58:15 +04:00
|
|
|
.Fa entry
|
2002-09-26 05:03:02 +04:00
|
|
|
is automatically allocated.
|
|
|
|
This allows the programmer to provide a fail over terminal capability
|
|
|
|
string if fetching the termcap entry from the termcap database fails.
|
|
|
|
The format of the string
|
2000-05-28 13:58:15 +04:00
|
|
|
.Fa entry
|
|
|
|
is assumed to be a valid termcap entry.
|
|
|
|
.Pp
|
2002-01-15 05:53:28 +03:00
|
|
|
NOTE: A special capability of
|
1999-08-15 14:59:01 +04:00
|
|
|
.Fa ZZ
|
2002-09-26 05:03:02 +04:00
|
|
|
is added to the end of the termcap entry retrieved.
|
|
|
|
The number that follows this entry is the address of the buffer allocated
|
|
|
|
to hold the full termcap entry.
|
|
|
|
The caller may retrieve the pointer to the extended buffer by performing a
|
1999-08-15 14:59:01 +04:00
|
|
|
.Fn tgetstr
|
|
|
|
to retrieve the
|
|
|
|
.Fa ZZ
|
2002-01-15 05:53:28 +03:00
|
|
|
capability, the string is the output of a
|
1999-08-15 14:59:01 +04:00
|
|
|
.Fn printf
|
|
|
|
%p and may be converted back to a pointer using
|
|
|
|
.Fn sscanf
|
2002-09-26 05:03:02 +04:00
|
|
|
or similar.
|
|
|
|
The ZZ capability is only necessary if the caller wishes to
|
1999-08-15 14:59:01 +04:00
|
|
|
directly manipulate the termcap entry, all the termcap function calls
|
|
|
|
automatically use the extended buffer to retrieve terminal capabilities.
|
1993-03-21 12:45:37 +03:00
|
|
|
.Sh FILES
|
|
|
|
.Bl -tag -width /usr/share/misc/termcap -compact
|
|
|
|
.It Pa /usr/lib/libtermcap.a
|
1997-01-06 07:38:41 +03:00
|
|
|
.Fl l Ar termcap
|
1993-03-21 12:45:37 +03:00
|
|
|
library (also known as
|
1997-01-06 07:38:41 +03:00
|
|
|
.Fl l Ar termlib )
|
1993-03-21 12:45:37 +03:00
|
|
|
.It Pa /usr/share/misc/termcap
|
|
|
|
standard terminal capability data base
|
|
|
|
.It Pa $HOME/.termcap
|
|
|
|
user's terminal capability data base
|
|
|
|
.El
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr ex 1 ,
|
|
|
|
.Xr curses 3 ,
|
|
|
|
.Xr termcap 5
|
|
|
|
.Sh HISTORY
|
|
|
|
The
|
1997-10-13 20:11:41 +04:00
|
|
|
.Nm termcap
|
2001-01-06 02:05:08 +03:00
|
|
|
t_*() functions appeared in
|
|
|
|
.Nx 1.5 .
|
2002-01-15 05:53:28 +03:00
|
|
|
The rest of the
|
2001-01-06 02:05:08 +03:00
|
|
|
.Nm termcap
|
1999-07-02 19:46:05 +04:00
|
|
|
functions appeared in
|
1993-03-21 12:45:37 +03:00
|
|
|
.Bx 4.0 .
|