📄 termcap.3
字号:
.\" 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.\".Dd December 11, 1993.Dt TERMCAP 3.Os BSD 4.Sh NAME.Nm tgetent ,.Nm tgetnum ,.Nm tgetflag ,.Nm tgetstr ,.Nm tgoto ,.Nm tputs.Nd terminal independent operation routines.Sh SYNOPSIS.Vt char PC;.Vt char *BC;.Vt char *UP;.Vt short ospeed;.Fn tgetent "char *bp" "char *name".Fn tgetnum "char *id".Fn tgetflag "char *id".Ft char *.Fn tgetstr "char *id" "char **area".Ft char *.Fn tgoto "char *cm" destcol destline.Fn tputs "register char *cp" "int affcnt" "int (*outc)()".Sh DESCRIPTIONThese functions extract and use capabilities from a terminal capability database, usually.Pa /usr/share/misc/termcap ,the format of which is described in.Xr termcap 5 .These are low level routines;see.Xr curses 3for a higher level package..PpThe.Fn tgetentfunctionextracts the entry for terminal.Fa nameinto the buffer at.Fa bp .The.Fa bpargumentshould be a character buffer of size1024 and must be retained through all subsequent calls to.Fn tgetnum ,.Fn tgetflag ,and.Fn tgetstr .The.Fn tgetentfunctionreturns \-1 if none of the.Nm termcapdata 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 TERMCAPvariable.If found, and the value does not begin with a slash,and the terminal type.Fa nameis the same as the environment string.Ev TERM ,the.Ev TERMCAPstring is used instead of reading a.Nm termcapfile.If it does begin with a slash, the string is used as a path nameof the.Nm termcapfile to search.If.Ev TERMCAPdoes not begin with a slash and.Fa nameis different from.Ev TERM ,.Fn tgetentsearches the files.Pa $HOME/.termcapand.Pa /usr/share/misc/termcap ,in that order, unless the environment variable.Ev TERMPATHexists,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 tcfield occurs in the requested entry, the entry it names must be foundin 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 descriptionsor make one for your terminal if you can't write the file.Pa /usr/share/misc/termcap ..PpThe.Fn tgetnumfunctiongets the numeric value of capability.Fa id ,returning \-1 if it is not given for the terminal.The.Fn tgetflagfunctionreturns 1 if the specified capability is present inthe terminal's entry, 0 if it is not.The.Fn tgetstrfunctionreturns the string value of the capability.Fa id ,places it in the buffer at.Fa area ,and advances the.Fa areapointer.It decodes the abbreviations for this field described in.Xr termcap 5 ,except for cursor addressing and padding information.The.Fn tgetstrfunctionreturns.Dv NULLif the capability was not found..PpThe.Fn tgotofunctionreturns a cursor addressing string decoded from.Fa cmto go to column.Fa destcolin line.Fa destline .It uses the external variables.Va UP(from the.Sy upcapability)and.Va BC(if.Sy bcis given rather than.Sy bs )if necessary to avoid placing.Sy \en ,.Sy ^Dor.Sy ^@inthe returned string.(Programs which call.Fn tgotoshould be sure to turn off the.Dv XTABSbit(s),since.Fn tgotomay now output a tab.Note that programs using termcap should in general turn off.Dv XTABSanyway 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 tgotoreturns.Pq Dv OOPS ..PpThe.Fn tputsfunctiondecodes the leading padding information of the string.Fa cp ;.Fa affcntgives the number of lines affected by the operation, or 1 if this isnot applicable,.Fa outcis a routine which is called with each character in turn.The external variable.Va ospeedshould contain the output speed of the terminal as encoded by.Xr stty 3 .The external variable.Va PCshould contain a pad character to be used (from the.SY pccapability)if a null.Pq Sy ^@is inappropriate..Sh FILES.Bl -tag -width /usr/share/misc/termcap -compact.It Pa /usr/lib/libtermcap.a.Fl l Ar ltermcaplibrary (also known as.Fl l Ar ltermlib ).It Pa /usr/share/misc/termcapstandard terminal capability data base.It Pa $HOME/.termcapuser's terminal capability data base.El.Sh SEE ALSO.Xr ex 1 ,.Xr curses 3 ,.Xr termcap 5.Sh HISTORYThe.Nmfunctions appeared in .Bx 4.0 .
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -