⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 termcap.5

📁 早期freebsd实现
💻 5
📖 第 1 页 / 共 4 页
字号:
Numeric capabilities are followed by the character `#' then the value.In the example above.Sy \&co ,which indicates the number of columns the display has,gives the value `80' for the Concept..PpFinally, string-valued capabilities, such as.Sy \&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.Xr tputsafter the remainder of the string is sent to provide this delay.The delay can be either a number,such as `20', or a number followed byan `*',such as `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.Em linesaffected;this is always 1 unless the terminal has.Sy \&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..Sy \&\eEmaps to an.Dv ESCcharacter,.Sy \&^Xmaps to a control-X for any appropriate X,and the sequences.Sy \&\en.Sy \&\er.Sy \&\et.Sy \&\eb.Sy \&\efmap to linefeed, return, tab, backspace, and formfeed, respectively.Finally, characters may be given as three octal digits after a.Sy \&\e ,and the characters.Sy \&^and.Sy \&\emay be given as.Sy \&\e^and.Sy \&\e\e .If it is necessary to place a.Sy \&:in a capability it must be escaped inoctal as.Sy \&\e072 .If it is necessary to place a.Dv NULcharacter in a string capability itmust be encoded as.Sy \&\e200 .(The routines that deal with.Nm termcapuse C strings and strip the high bits of the output very late, so thata.Sy \&\e200comes out as a.Sy \&\e000would.).PpSometimes individual capabilities must be commented out.To do this, put a period before the capability name.For example, see the first.Sy \&crand.Sy \&tain the example above..Ss Preparing DescriptionsThe most effective way to prepare a terminal description is by imitatingthe description of a similar terminal in.Nm termcapand to build up a description gradually, using partial descriptionswith.Xr \&vito check that they are correct.Be aware that a very unusual terminal may expose deficiencies inthe ability of the.Nm termcapfile to describe itor bugs in.Xr \&vi .To easily test a new terminal description you are working onyou can put it in your home directory in a file called.Pa .termcapand programs will look there before looking in.Pa /usr/share/misc/termcap .You can also set the environment variable.Ev TERMPATHto a list of absolute file pathnames (separated by spaces or colons),one of which contains the description you are working on,and programs will search them in the order listed, and nowhere else.See.Xr termcap 3 .The.Ev TERMCAPenvironment variable is usually set to the.Nm termcapentry itselfto avoid reading files 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.Xr \&vito edit.Pa /etc/passwdat 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..Ss Basic CapabilitiesThe number of columns on each line of the display is given by the.Sy \&conumeric capability.If the display is a.Tn CRT ,then thenumber of lines on the screen is given by the.Sy \&licapability.If the display wraps around to the beginning of the next line whenthe cursor reaches the right margin, then it should have the.Sy \&amcapability.If the terminal can clear its screen,the code to do this is given by the.Sy \&clstring capability.If the terminal overstrikes(rather than clearing the position when a character is overwritten),it should have the.Sy \&oscapability.If the terminal is a printing terminal,with no soft copy unit,give it both.Sy \&hcand.Sy \&os ..Pf ( Sy \&osapplies to storage scope terminals,such as the Tektronix 4010 series,as well as to hard copy and.Tn APLterminals.)If there is a code to move the cursor to the left edge of the current row,give this as.Sy \&cr .(Normally this will be carriage-return,.Sy \&^M . )If there is a code to produce an audible signal (bell, beep,etc. ) ,give this as.Sy \&bl ..PpIf there is a code (such as backspace)to move the cursor one position to the left,that capability should be given as.Sy \&le .Similarly,codes to move to the right, up, and downshould be given as.Sy \&nd ,.Sy \&up ,and.Sy \&do ,respectively.These.Em local cursor motionsshould not alter the text they pass over;for example, you would not normally use.Dq nd=\ \&unless the terminal has the.Sy \&oscapability,because the space would erase the character moved over..PpA very important point here is that the local cursor motions encodedin.Nm termcaphave undefined behavior at the left and top edges of a.Tn CRTdisplay.Programs should never attempt to backspace around the left edge,unless.Sy \&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.Sy \&sf(index) string.To scroll text down,a program goes to the top left corner of the screen and sends the.Sy \&sr(reverse index) string.The strings.Sy \&sfand.Sy \&srhave undefined behaviorwhen not on their respective corners of the screen.Parameterized versions of the scrolling sequences are.Sy \&SFand.Sy \&SR ,which have the same semantics as.Sy \&sfand.Sy \&srexcept that they take one parameterand scroll that many lines.They also have undefined behaviorexcept at the appropriate corner of the screen..PpThe.Sy \&amcapability tells whether the cursor sticks at the rightedge of the screen when text is output there,but this does not necessarily apply to.Sy \&ndfrom the last column.Leftward local motion is defined from the left edge only when.Sy \&bwis given; then an.Sy \&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.Nm termcapdescription usually assumes that this feature is on,.Em i.e . ,.Sy \&am .If the terminal has a commandthat moves to the first column of the next line,that command can be given as.Sy \&nw(newline).It is permissible for this to clear the remainder of the current line,so if the terminal has no correctly-working.Tn \&CRand.Tn \&LFit may still be possible to craft a working.Sy \&nwout of one or both of them..PpThese capabilities suffice to describe hardcopy and.Dq glass-ttyterminals.Thus the Teletype model 33 is described as.Bd -literal -offset indentT3\||\|tty33\||\|33\||\|tty\||\|Teletype model 33:\e	:bl=^G:co#72:cr=^M:do=^J:hc:os:.Ed.Ppand the Lear Siegler.Tn ADM Ns \-3is described as.Bd -literal -offset indentl3\||\|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:.Ed.Ss Parameterized StringsCursor addressing and other strings requiring parametersare described by aparameterized string capability, with.Xr printf 3 Ns \-likeescapes.Sy \&%xin it,while other characters are passed through unchanged.For example, to address the cursor the.Sy \&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.Sy \&CMcapability.).PpThe.Sy \&%encodings have the following meanings:.Bl -column xxxxx.It "%%	output `%'".It "%d	output value as in".Xr printf%d.It "%2	output value as in".Xr printf%2d.It "%3	output value as in".Xr printf%3d.It "%.	output value as in".Xr printf%c.It "%+" Ns Em x Ta No add.Em xto value, then do %..It "%>" Ns Em \&xy Ta No ifvalue >.Em xthen add.Em y ,no output.It "%r	reverse order of two parameters, no output".It "%i	increment by one, no output".It "%n	exclusive-or all parameters with 0140 (Datamedia 2500)".It "%B" Ta Tn BCD No "(16*(value/10)) + (value%10), no output".It "%D	Reverse coding (value \- 2*(value%16)), no output (Delta Data).".El.PpConsider the Hewlett-Packard 2645, which, to get to row 3 and column 12, needsto be sent.Dq \eE&a12c03Ypadded 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.Sy \&cmcapability is.Dq Li cm=6\eE&%r%2c%2Y ..PpThe Datamedia 2500 needs the current row and column sentencoded in binary using.Dq \&%. .Terminals that use.Dq \&%.need to be able tobackspace the cursor.Po Sy \&le Pcand to move the cursor up one line on the screen.Po Sy \&up Pc .This is necessary because it is not always safe to transmit.Sy \&\en ,.Sy \&^D ,and.Sy \&\er ,as the system may change or discard them.(Programs using.Nm termcapmust set terminal modes so that tabs are not expanded, so.Sy \&\etis safe to send.This turns out to be essential for the Ann Arbor 4080.).PpA final example is the Lear Siegler.Tn ADM Ns \-3a,which offsets row and columnby a blank character, thus.Dq Li cm=\eE=%+ %+\ \& ..PpRow or column absolute cursor addressingcan be given as single parameter capabilities.Sy \&ch(horizontal position absolute) and.Sy \&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.Sy \&cm .If there are parameterized local motions.Pf ( Em e.g . ,move.Ar npositions to the right)these can be given as.Sy \&DO ,.Sy \&LE ,.Sy \&RI ,and.Sy \&UPwith a single parameter indicating how many positions to move.These are primarily useful if the terminal does not have.Sy \&cm ,such as the Tektronix 4025..Ss 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.Sy \&ho .Similarly, a fast way of getting to the lower left-hand cornercan be given as.Sy \&ll ;this may involve going up with.Sy \&upfrom the home position,but a program should never do this itself (unless.Sy \&lldoes), because it canmake no assumption about the effect of moving up from the home position.Note that the home position is the same ascursor address (0,0): to the top left corner of the screen, not of memory.(Therefore, the.Dq \eEHsequence on Hewlett-Packard terminalscannot be used for.Sy \&ho . ).Ss Area ClearsIf the terminal can clear from the current position to the end of theline, leaving the cursor where it is, this should be given as.Sy \&ce .If the terminal can clear from the current position to the end of thedisplay, this should be given as.Sy \&cd ..Sy \&cdmust only be invoked from the first column of a line.(Therefore,it can be simulated by a request to delete a large number of lines,if a true.Sy \&cdis not available.).Ss Insert/Delete LineIf the terminal can open a new blank linebefore the line containing the cursor,this should be given as.Sy \&al ;this must be invoked only from the firstposition of a line.The cursor must then appear at the left of the newly blank line.If the terminal can delete the line that the cursor is on, thisshould be given as.Sy \&dl ;this must only be used from the first position onthe line to be deleted.Versions of.Sy \&aland.Sy \&dlwhich take a single parameterand insert or delete that many linescan be given as.Sy \&ALand.Sy \&DL .If the terminal has a settable scrolling region

⌨️ 快捷键说明

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