📄 termcap.5
字号:
.PP.B A Sample Entry.PPThe following entry, which describes the Concept\-100, is among the morecomplex entries in the.B termcap\^file as of this writing..PP.nf.if t .ta 8n +8n.if n .ta 2n +2nca\||\|concept100\||\|c100\||\|concept\||\|c104\||\|concept100-4p\||\|HDS Concept\-100:\e :al=3*\eE^R:am:bl=^G:cd=16*\eE^C:ce=16\eE^U:cl=2*^L:cm=\eEa%+ %+ :\e :co#80:.cr=9^M:db:dc=16\eE^A:dl=3*\eE^B:do=^J:ei=\eE\e200:eo:im=\eE^P:in:\e :ip=16*:is=\eEU\eEf\eE7\eE5\eE8\eEl\eENH\eEK\eE\e200\eEo&\e200\eEo\e47\eE:k1=\eE5:\e :k2=\eE6:k3=\eE7:kb=^h:kd=\eE<:ke=\eEx:kh=\eE?:kl=\eE>:kr=\eE=:ks=\eEX:\e :ku=\eE;:le=^H:li#24:mb=\eEC:me=\eEN\e200:mh=\eEE:mi:mk=\eEH:mp=\eEI:\e :mr=\eED:nd=\eE=:pb#9600:rp=0.2*\eEr%.%+ :se=\eEd\eEe:sf=^J:so=\eEE\eED:\e :.ta=8\et:te=\eEv \e200\e200\e200\e200\e200\e200\eEp\er\en:\e :ti=\eEU\eEv 8p\eEp\er:ue=\eEg:ul:up=\eE;:us=\eEG:\e :vb=\eEk\e200\e200\e200\e200\e200\e200\e200\e200\e200\e200\e200\e200\e200\e200\eEK:\e :ve=\eEw:vs=\eEW:vt#8:xn:\e :bs:cr=^M:dC#9:dT#8:nl=^J:ta=^I:pt:.fi.PPEntries may continue onto multiple lines by giving a \e as the lastcharacter of a line, and empty fieldsmay be included for readability (here between the last field on a lineand the first field on the next).Comments may be included on lines beginning with \*(lq#\*(rq..br.ne 5.PP.B Types of Capabilities.PPCapabilities in.B termcap\^are of three types: Boolean capabilities,which indicate particular features that the terminal has;numeric capabilities,giving the size of the display or the size of other attributes;and string capabilities,which give character sequences that can be used to perform particularterminal operations.All capabilities have two-letter codes.For instance, the fact thatthe Concept has.I automatic margins.RI ( i.e. ,an automatic return and linefeedwhen the end of a line is reached) is indicated by the Boolean capability.BR am .Hence the description of the Concept includes.BR am ..PPNumeric capabilities are followed by the character `#' then the value.In the example above.BR co ,which indicates the number of columns the display has,gives the value `80' for the Concept..PPFinally, string-valued capabilities, such as.B ce(clear-to-end-of-linesequence) are given by the two-letter code, an `=', then a stringending at the next following `:'.A delay in milliseconds may appear afterthe `=' in such a capability,which causes padding characters to be supplied by.B tputs\^after the remainder of the string is sent to provide this delay.The delay can be either a number,.I e.g.`20', or a number followed byan `*',.IR i.e. ,`3*'.An `*' indicates that the padding required is proportionalto the number of lines affected by the operation, and the amount given isthe per-affected-line padding required.(In the case of insert-character,the factor is still the number of.I lines\^affected;this is always 1 unless the terminal has.B inand the software uses it.)When an `*' is specified, it is sometimes useful to give a delay of the form`3.5' to specify a delay per line to tenths of milliseconds.(Only one decimal place is allowed.).PPA number of escape sequences are provided in the string-valued capabilitiesfor easy encoding of control characters there..B \eEmaps to an \s-2ESC\s0character,.B ^Xmaps to a control-X for any appropriate X,and the sequences.B \en.B \er.B \et.B \eb.B \efmap to linefeed, return, tab, backspace, and formfeed, respectively.Finally, characters may be given as three octal digits after a.BR \e ,and the characters.B ^and.B \emay be given as.B \e^and.BR \e\e .If it is necessary to place a.B :in a capability it must be escaped inoctal as.BR \e072 .If it is necessary to place a \s-2NUL\s0character in a string capability itmust be encoded as.BR \e200 .(The routines that deal with.B termcap\^use C strings and strip the high bits of the output very late, so thata.B \e200comes out as a.B \e000would.).PPSometimes individual capabilities must be commented out.To do this, put a period before the capability name.For example, see the first.B crand.B tain the example above..br.ne 5.PP.B Preparing Descriptions.PPWe now outline how to prepare descriptions of terminals.The most effective way to prepare a terminal description is by imitatingthe description of a similar terminal in.B termcap\^and to build up a description gradually, using partial descriptionswith.B vi\^to check that they are correct.Be aware that a very unusual terminal may expose deficiencies inthe ability of the.B termcap\^file to describe itor bugs in.BR vi\^ .To easily test a new terminal description you can set the environment variable.B.SM TERMCAPto the absolute pathname of a file containing the description you are workingon and programs will look there rather than in.BR /etc/termcap\^ ..B.SM TERMCAPcan also be set to the.B termcap\^entry itselfto avoid reading the file when starting up a program..PPTo get the padding for insert-line right(if the terminal manufacturer did not document it),a severe test is to use.B vi\^to edit.B /etc/passwd\^at 9600 baud, delete roughly 16 lines from the middle of the screen,then hit the `u' key several times quickly.If the display messes up, more padding is usually needed.A similar test can be used for insert-character..br.ne 5.PP.B Basic Capabilities.PPThe number of columns on each line of the display is given by the.B conumeric capability.If the display is a \s-1CRT\s0, then thenumber of lines on the screen is given by the.B licapability.If the display wraps around to the beginning of the next line whenthe cursor reaches the right margin, then it should have the.B amcapability.If the terminal can clear its screen,the code to do this is given by the.B clstring capability.If the terminal overstrikes(rather than clearing the position when a character is overwritten),it should have the.B oscapability.If the terminal is a printing terminal,with no soft copy unit,give it both.B hcand.BR os ..RB ( osapplies to storage scope terminals,such as the Tektronix 4010 series,as well as to hard copy and.SM APLterminals.)If there is a code to move the cursor to the left edge of the current row,give this as.BR cr .(Normally this will be carriage-return,.BR ^M .)If there is a code to produce an audible signal (bell, beep,.IR etc.\^ ),give this as.BR bl ..PPIf there is a code (such as backspace)to move the cursor one position to the left,that capability should be given as.BR le .Similarly,codes to move to the right, up, and downshould be given as.BR nd ,.BR up ,and.BR do ,respectively.These.I local cursor motions\^should not alter the text they pass over;for example, you would not normally use\*(lqnd=\ \*(rqunless the terminal has the.B oscapability,because the space would erase the character moved over..PPA very important point here is that the local cursor motions encodedin.B termcap\^have undefined behavior at the left and top edges of a.SM CRTdisplay.Programs should never attempt to backspace around the left edge,unless.B bwis given, and never attempt to go up off the topusing local cursor motions..PPIn order to scroll text up,a program goes to the bottom left corner of the screen and sends the.B sf(index) string.To scroll text down,a program goes to the top left corner of the screen and sends the.B sr(reverse index) string.The strings.B sfand.B srhave undefined behaviorwhen not on their respective corners of the screen.Parameterized versions of the scrolling sequences are.B SFand.BR SR ,which have the same semantics as.B sfand.B srexcept that they take one parameterand scroll that many lines.They also have undefined behaviorexcept at the appropriate corner of the screen..PPThe.B amcapability tells whether the cursor sticks at the rightedge of the screen when text is output there,but this does not necessarily apply to.B ndfrom the last column.Leftward local motion is defined from the left edge only when.B bwis given; then an.B lefrom the left edge will move to the right edge of the previous row.This is useful for drawing a box around the edge of the screen,for example.If the terminal has switch-selectable automatic margins,the.B termcap\^description usually assumes that this feature is on,.IR i.e. ,.BR am .If the terminal has a commandthat moves to the first column of the next line,that command can be given as.B nw(newline).It is permissible for this to clear the remainder of the current line,so if the terminal has no correctly-working \s-2CR\s0 and \s-2LF\s0it may still be possible to craft a working.B nwout of one or both of them..PPThese capabilities suffice to describe hardcopy and \*(lqglass-tty\*(rq terminals.Thus the Teletype model 33 is described as.PP.nf T3\||\|tty33\||\|33\||\|tty\||\|Teletype model 33:\e :bl=^G:co#72:cr=^M:do=^J:hc:os:.fi.PPand the Lear Siegler \s-1ADM\s0\-3 is described as.PP.nf l3\||\|adm3\||\|3\||\|LSI \s-1ADM\s0-3:\e :am:bl=^G:cl=^Z:co#80:cr=^M:do=^J:le=^H:li#24:sf=^J:.fi.br.ne 5.PP.B Parameterized Strings.PPCursor addressing and other strings requiring parametersare described by aparameterized string capability, with .BR printf\^ (3)-likeescapes.B %xin it,while other characters are passed through unchanged.For example, to address the cursor the.B cmcapability is given, using two parameters: the row and column to move to.(Rows and columns are numbered from zero and refer to the physical screenvisible to the user, not to any unseen memory.If the terminal has memory-relative cursor addressing,that can be indicated by an analogous.B CMcapability.).PPThe.B %encodings have the following meanings:.PP.in +16n.ta +8n.ti -8n%% output `%'.ti -8n%d output value as in \fBprintf\^\fP %d.ti -8n%2 output value as in \fBprintf\^\fP %2d.ti -8n%3 output value as in \fBprintf\^\fP %3d.ti -8n%. output value as in \fBprintf\^\fP %c.ti -8n%+\fIx\fP add \fIx\^\fP to value, then do %..ti -8n%>\fIxy\fP if value > \fIx\^\fP then add \fIy\^\fP, no output.ti -8n%r reverse order of two parameters, no output.ti -8n%i increment by one, no output.ti -8n%n exclusive-or all parameters with 0140 (Datamedia 2500).ti -8n%B BCD (16*(value/10)) + (value%10), no output.ti -8n%D Reverse coding (value \- 2*(value%16)), no output (Delta Data).ti -16n.fi.PPConsider the Hewlett-Packard 2645, which, to get to row 3 and column 12, needsto be sent \*(lq\eE&a12c03Y\*(rq padded for 6 milliseconds.Note that the orderof the row and column coordinates is reversed hereand that the row and columnare sent as two-digit integers.Thus its.B cmcapability is \*(lqcm=6\eE&%r%2c%2Y\*(rq..PPThe Microterm.SM ACT-IVneeds the current row and column sentsimply encoded in binarypreceded by a.BR ^T ,\*(lqcm=^T%.%.\*(rq.Terminals that use \*(lq%.\*(rq need to be able tobackspace the cursor.RB ( le )and to move the cursor up one line on the screen.RB ( up ).This is necessary because it is not always safe to transmit.BR \en ,.BR ^D ,and.BR \er ,as the system may change or discard them.(Programs using.B termcap\^must set terminal modes so that tabs are not expanded, so.B \etis safe to send.This turns out to be essential for the Ann Arbor 4080.).PPA final example is the Lear Siegler \s-1ADM\s0\-3a,which offsets row and columnby a blank character, thus \*(lqcm=\eE=%+ %+ \*(rq..PPRow or column absolute cursor addressingcan be given as single parameter capabilities.B ch(horizontal position absolute) and.B cv(vertical position absolute).Sometimes these are shorter than the more general two-parameter sequence(as with the Hewlett-Packard 2645) and can be used in preference to.BR cm .If there are parameterized local motions.RI ( e.g. ,move.I n\^positions to the right)these can be given as.BR DO ,.BR LE ,.BR RI ,and.B UPwith a single parameter indicating how many positions to move.These are primarily useful if the terminal does not have.BR cm ,such as the Tektronix 4025..br.ne 5.PP.B Cursor Motions.PPIf the terminal has a fast way to home the cursor(to the very upper left corner of the screen), this can be given as.BR ho .Similarly, a fast way of getting to the lower left-hand cornercan be given as.BR ll ;this may involve going up with.B up
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -