terminfo.5

来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· 5 代码 · 共 1,365 行 · 第 1/4 页

5
1,365
字号
   smcup=\eEU\eEv  8p\eEp\er, smir=\eE^P, smkx=\eEX, smso=\eEE\eED,   smul=\eEG, tabs, ul, vt#8, xenl,\s+2.EEEntries can continue onto multiple lines by placing white space atthe beginning of each line, with the exception of the first line.Comments can be included, as long as the comment is preceded by a number sign (#).  The following list describes terminal capabilities in more detail..PP.B Types of Capabilities.IP "Boolean capabilities" 22Indicate that the terminal hassome particular feature.  For example, the Concept\-100 has automaticmargins (an automatic return and linefeed when the end-of-line is reached).  This is described in the Boolean capabilities columnas an .B am..IP "Numeric capabilities"Provide the size of the terminalor the size of particular delays.  Numeric capabilities are followedby a number sign (#) and then the value.  Hence, the \fBcols\fR,which indicates the number of column the terminal has, providesthe value 80 for the Concept..IP "String capabilities"Provide a sequence that can be used to perform particularterminal operations.  Hence, string-valued capabilities such as \fBel\fR (clear to the end-of-line sequence are described the 2-character code (an equal sign (=) and then a stringending at the next comma (,).  A delay in milliseconds can appearanywhere in such a capability, enclosed in $<..> brackets,and padding characters are supplied by.PN tputsto provide this delay..IPA delay can be either a number, such as 20, or a number followed byan asterisk (*), such as 3*.  The asterisk (*) indicates that the padding required is proportional to the number of lines affected by the operation, and the amount given is the per-affected-unit padding required.(In the case of the insert character, the factor is still the number oflines affected.This is always one, unless the terminal has \fBxenl\fP and the software uses it.)When an asterisk (*) is specified, it is sometimes useful to give a delay of the form3.5, which indicates a delay per unit to tenths of milliseconds.(Only one decimal place is allowed.).PPEscape sequences are provided in the string-valued capabilitiesfor easy encoding of characters there.  Both \fB\eE\fR and \fB\ee\fRmap to an \s-1ESCAPE\s0 character,\fB^x\fR maps to a control-x for any appropriate x, and the sequences\fB\en \el \er \et \eb \ef \es\fR givea newline, linefeed, return, tab, backspace, formfeed, and space.Other escapes include \e^ for ^, \e\e for \e, \e, for comma, \e: for :,and \e0 for null.(\e0 will produce \e200, which does not terminate a string but behavesas a null character on most terminals.)Finally, characters may be given as three octal digits after a \fB\e\fR..PPSometimes individual capabilities must be commented out.To do this, put a period before the capability name.For example, see the second.B indin the previous Sample Entry..br.ne 5.PP.B Preparing Descriptions.PPThis section describes how to prepare a description of a terminal.The most effective way to prepare a terminal description is by imitatingthe description of a similar terminal in.PN  terminfoand to build up a description gradually.A very unusual terminal may expose deficiencies in the ability of the.PN terminfofile to describe the terminal..PPTo test a new terminal description, set the environment variableTERMINFO to a pathname of a directory containing thecompiled description you are working on.  The programs can searchthis directory rather than search.IR /usr/lib/terminfo .To get the padding for insert line right (if the terminal manufacturerdid not document it), edit /etc/passwd at 9600 baud,delete 16 or so lines from the middle of the screen, then type the character u several times quickly.If the terminal behaves erratically, more padding is usually needed.A similar test can be used for the insert character..PP.B Basic Capabilities.PPThe number of columns on each line for the terminal is specified by the\fBcols\fR numeric capability.  If the terminal is a \s-1CRT\s0, then thenumber of lines on the screen is given by the \fBlines\fR capability.If the terminal wraps around to the beginning of the next line whenit reaches the right margin, then it should have the \fBam\fR capability.If the terminal can clear its screen, leaving the cursor in the homeposition, then this is given by the \fBclear\fR string capability.If the terminal overstrikes(rather than clearing a position when a character is struck over),then it should have the \fBos\fR capability.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 \s-1TEKTRONIX\s+1 4010series, as well as hard copy and APL terminals.)If there is a code to move the cursor to the left edge of the currentrow, give this as.BR cr .(Normally this will be carriage return, control M.)If there is a code to produce an audible signal (bell, beep, etc),give this as.BR bel ..PPIf there is a code to move the cursor one position to the left(such as backspace) that capability should be given as.BR cub1 .Similarly, codes to move to the right, up, and down should begiven as.BR cuf1 ,.BR cuu1 ,and.BR cud1 .These local cursor motions should not alter the text they pass over;for example, you would not normally use `\fBcuf1\fP=\ ' because thespace would erase the character moved over..NTThe local cursor motions encodedin.PN  terminfoare undefined at the left and top edges of a \s-1CRT\s0 terminal.Programs should never attempt to backspace around the left edge,unless.B bwis given,and never attempt to go up locally off the top.In order to scroll text up, a program will go to the bottom left cornerof the screen and send the.B ind(index) string..NE.PPTo scroll text down, a program goes to the top left cornerof the screen and sends the.B ri(reverse index) string.The strings.B indand.B riare undefined when not on their respective corners of the screen..PPParameterized versions of the scrolling sequences are.B indnand.BR rin ,which have the same semantics as.B indand.BR ri ,except that they take one parameter and scroll that many lines.They are also undefined, except at the appropriate edge of the screen..PPThe \fBam\fR capability tells whether the cursor sticks at the rightedge of the screen when text is output, but this does not necessarilyapply to a.B cuf1from the last column.The only local motion that is defined from the left edge is if.B bwis given, then a.B cub1from the left edge will move to the right edge of the previous row.If.B bwis not given, the effect is undefined.This is useful for drawing a box around the edge of the screen, for example.If the terminal has switch-selectable automatic margins,the.PN terminfofile usually assumes that this is on; that is, \fBam\fR.If the terminal has a command which moves to the first column of the nextline, that command can be given as.B nel(newline).It does not matter if the command clears the remainder of the current line,so, if the terminal has no.B crand.BR lf ,it may still be possible to craft a working.B nelout of one or both of them..PPThese capabilities suffice to describe hardcopy and glass-tty terminals.Thus, the Model 33 Teletype is described as:.EX\s-133\||\|tty33\||\|tty\||\|model 33 teletype,bel=^G, cols#72, cr=^M, cud1=^J, hc, ind=^J, os,\s+1.EEThe Lear Siegler \s-1ADM\-3\s0 is described as:.EX\s-1adm3\||\|3\||\|lsi adm3,am, bel=^G, clear=^Z, cols#80, cr=^M, cub1=^H, cud1=^J,ind=^J, lines#24,\s+1.EE.B Parameterized Strings.PPCursor addressing and other strings requiring parametersin the terminal are described by aparameterized string capability, with .MS printf 3s ,such as escapes like \fB%x\fR.For example, to address the cursor, the.B cupcapability is given, using two parameters:the row and column to address to.(Rows and columns are numbered from zero and refer to thephysical screen visible to the user, not to any unseen memory.)If the terminal has memory-relative cursor addressing,that can be indicated by.BR mrcup ..PPThe parameter mechanism uses a stack and special \fB%\fP codesto manipulate it.  Typically a sequence pushes one of theparameters onto the stack and then prints it in some format.Often, more complex operations are necessary..PPThe percent sign (\fB%\fR) encodings have the following meanings:.PP.DT.nf.ta .5i 1.5i	\s-1%%	outputs `%'	%d	print pop() as in printf	%2d	print pop() like %2d	%3d	print pop() like %3d	%02d	%03d	as in printf	%c	print pop() gives %c	%s	print pop() gives %s	%p[1-9]	push ith parm	%P[a-z]	set variable [a-z] to pop()	%g[a-z]	get variable [a-z] and push it	%'c'	char constant c	%{nn}	integer constant nn	%+ %- %* %/ %m		arithmetic (%m is mod): push(pop() op pop())	%& %| %^	bit operations: push(pop() op pop())	%= %> %<	logical operations: push(pop() op pop())	%! %~	unary operations push(op pop())	%i	add 1 to first two parms (for ANSI terminals)	%? expr %t thenpart %e elsepart %;		if-then-else, %e elsepart is optional.		else-if's are possible ala Algol 68:		%? c\d1\u %t b\d1\u %e c\d2\u %t b\d2\u %e c\d3\u %t b\d3\u %e c\d4\u %t b\d4\u %e %;\s+1		c\di\u are conditions, b\di\u are bodies..fi.PPBinary operations are in postfix form with the operands in the usual order.That is, to get x-5, use %gx%{5}%-..PPConsider the HP2645, which, to get to row 3 and column 12, needsto be sent \eE&a12c03Y padded for 6 milliseconds.  Note that the orderof the rows and columns is inverted here, and that the row and columnare printed as two digits.Thus, its \fBcup\fR capability is cup=6\eE&%p2%2dc%p1%2dY..PPThe Microterm \s-1ACT-IV\s0 needs the current row and column sentpreceded by a \fB^T\fR, with the row and column simply encoded in binary,cup=^T%p1%c%p2%c.Terminals that use %c need to be able tobackspace the cursor (\fBcub1\fR),and to move the cursor up one line on the screen (\fBcuu1\fR).This is necessary because it is not always safe to transmit \fB\en\fR\fB^D\fR and \fB\er\fR, as the system may change or discard them.(The library routines dealing with terminfo set tty modes so thattabs are never expanded, so \et is safe to send.This turns out to be essential for the Ann Arbor 4080.).PPA final example is the \s-1LSI ADM\s0-3a, which uses row and columnoffset by a blank character; thus cup=\eE=%p1%' '%+%c%p2%' '%+%.After sending \eE=, this pushes the first parameter, pushes theASCII value for a space (32), adds them (pushing the sum on the stackin place of the two previous values), and outputs that value as a character.Then, the same is done for the second parameter.More complex arithmetic is possible using the stack..PPIf the terminal has row or column absolute cursor addressing,these can be given as single parameter capabilities.B hpa(horizontal position absolute)and.B vpa(vertical position absolute).Sometimes, these are shorter than the more general 2-parametersequence (as with the hp2645) and can be used in preference to.B cup .If there are parameterized local motions (for example, move.I nspaces to the right), these can be given as.BR cud ,.BR cub ,.BR cuf ,and.BR cuu ,with a single parameter indicating how many spaces to move.These are primarily useful if the terminal does not have.BR cup ,such as the \s-1TEKTRONIX\s+1 4025..PP.B Cursor Motions.PPIf the terminal has a fast way to home the cursor(to very upper left corner of screen), then this can be given as\fBhome\fR. Similarly, a fast way of getting to the lower left-hand cornercan be given as \fBll\fR. This may involve going up with \fBcuu1\fRfrom the home position,but a program should never do this itself (unless \fBll\fR does), because itcan make no assumption about the effect of moving up from the home position.Note that the home position is the same as addressing to (0,0):the top left corner of the screen, not memory.Thus, the \eEH sequence on HP terminals cannot be used for.BR home ..PP.B Area Clears.PPIf the terminal can clear from the current position to the end of theline, leaving the cursor where it is, this should be given as \fBel\fR.If the terminal can clear from the current position to the end of thedisplay, this should be given as \fBed\fR.\fBEd\fR is only defined from the first column of a line.Thus, it can be simulated by a request to delete a large number of lines,

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?