📄 termcap.texi
字号:
the terminal's margin-wrap switch is on; it contains the @samp{am}flag. The implication is that normally the switch is off and theusual description for the terminal says that the switch is off.@item -nam``No automatic margins''. The opposite of @samp{-am}, this names analternative description which lacks the @samp{am} flag. This impliesthat the terminal is normally operated with the margin-wrap switchturned on, and the normal description of the terminal says so.@item -na``No arrows''. This terminal description initializes the terminal tokeep its arrow keys in local mode. This is a user option.@item -rv``Reverse video''. This terminal description causes text output fornormal video to appear as reverse, and text output for reverse videoto come out as normal. Often this description differs from the usualone by interchanging the two strings which turn reverse video on andoff.@refillThis is a user option; you can choose either the ``reverse video''variant terminal type or the normal terminal type, and termcap willobey.@item -s``Status''. Says to enable use of a status line which ordinary outputdoes not touch (@pxref{Status Line}).Some terminals have a special line that is used only as a status line.For these terminals, there is no need for an @samp{-s} variant; thestatus line commands should be defined by default. On otherterminals, enabling a status line means removing one screen line fromordinary use and reducing the effective screen height. For theseterminals, the user can choose the @samp{-s} variant type to requestuse of a status line.@item -@var{nlines}Says to operate with @var{nlines} lines on the screen, for terminalssuch as the Ambassador which provide this as an option. Normally thisis a user option; by choosing the terminal type, you control how manylines termcap will use.@item -@var{npages}pSays that the terminal has @var{npages} pages worth of screen memory,for terminals where this is a hardware option.@item -unkSays that description is not for direct use, but only for reference in@samp{tc} capabilities. Such a description is a kind of subroutine,because it describes the common characteristics of several variantdescriptions that would use other suffixes in place of @samp{-unk}.@end table@node Inheriting, Changing, Naming, Data Base@section Inheriting from Related Descriptions@cindex inheritanceWhen two terminal descriptions are similar, their identical parts do notneed to be given twice. Instead, one of the two can be defined in terms ofthe other, using the @samp{tc} capability. We say that one description@dfn{refers to} the other, or @dfn{inherits from} the other.The @samp{tc} capability must be the last one in the terminal description,and its value is a string which is the name of another terminal type whichis referred to. For example,@exampleN9|aaa|ambassador|aaa-30|ann arbor ambassador/30 lines:\ :ti=\E[2J\E[30;0;0;30p:\ :te=\E[60;0;0;30p\E[30;1H\E[J:\ :li#30:tc=aaa-unk:@end example@noindentdefines the terminal type @samp{aaa-30} (also known as plain @samp{aaa}) interms of @samp{aaa-unk}, which defines everything about the Ambassador thatis independent of screen height. The types @samp{aaa-36}, @samp{aaa-48}and so on for other screen heights are likewise defined to inherit from@samp{aaa-unk}.The capabilities overridden by @samp{aaa-30} include @samp{li}, which sayshow many lines there are, and @samp{ti} and @samp{te}, which configure theterminal to use that many lines.The effective terminal description for type @samp{aaa} consists of the textshown above followed by the text of the description of @samp{aaa-unk}. The@samp{tc} capability is handled automatically by @code{tgetent}, whichfinds the description thus referenced and combines the two descriptions(@pxref{Find}). Therefore, only the implementor of the terminaldescriptions needs to think about using @samp{tc}. Users and applicationprogrammers do not need to be concerned with it.Since the reference terminal description is used last, capabilitiesspecified in the referring description override any specifications of thesame capabilities in the reference description.The referring description can cancel out a capability without specifyingany new value for it by means of a special trick. Write the capability inthe referring description, with the character @samp{@@} after the capabilityname, as follows:@smallexampleNZ|aaa-30-nam|ann arbor ambassador/30 lines/no automatic-margins:\ :am@@:tc=aaa-30:@end smallexample@node Changing, , Inheriting, Data Base@section When Changes in the Data Base Take EffectEach application program must read the terminal description from thedata base, so a change in the data base is effective for all jobs startedafter the change is made.The change will usually have no effect on a job that have been in existencesince before the change. The program probably read the terminal descriptiononce, when it was started, and is continuing to use what it read then.If the program does not have a feature for reexamining the data base, thenyou will need to run it again (probably killing the old job).If the description in use is coming from the @code{TERMCAP} environmentvariable, then the data base file is effectively overridden, and changes init will have no effect until you change the @code{TERMCAP} variable aswell. For example, some users' @file{.login} files automatically copy theterminal description into @code{TERMCAP} to speed startup of applications.If you have done this, you will need to change the @code{TERMCAP} variableto make the changed data base take effect.@node Capabilities, Summary, Data Base, Top@chapter Definitions of the Terminal CapabilitiesThis section is divided into many subsections, each for one aspect ofuse of display terminals. For writing a display program, you usually needonly check the subsections for the operations you want to use. For writinga terminal description, you must read each subsection and fill in thecapabilities described there.String capabilities that are display commands may require numericparameters (@pxref{Parameters}). Most such capabilities do not useparameters. When a capability requires parameters, this is explicitlystated at the beginning of its definition. In simple cases, the first orsecond sentence of the definition mentions all the parameters, in the orderthey should be given, using a name@iftexin italics@end iftex@ifinfoin upper case@end ifinfofor each one. For example, the @samp{rp} capability is a command thatrequires two parameters; its definition begins as follows:@quotationString of commands to output a graphic character @var{c}, repeated @var{n}times.@end quotationIn complex cases or when there are many parameters, they are describedexplicitly.When a capability is described as obsolete, this means that programs shouldnot be written to look for it, but terminal descriptions should still bewritten to provide it.When a capability is described as very obsolete, this means that it shouldbe omitted from terminal descriptions as well.@menu* Basic:: Basic characteristics.* Screen Size:: Screen size, and what happens when it changes.* Cursor Motion:: Various ways to move the cursor.* Wrapping:: What happens if you write a character in the last column.* Scrolling:: Pushing text up and down on the screen.* Windows:: Limiting the part of the window that output affects.* Clearing:: Erasing one or many lines.* Insdel Line:: Making new blank lines in mid-screen; deleting lines.* Insdel Char:: Inserting and deleting characters within a line.* Standout:: Highlighting some of the text.* Underlining:: Underlining some of the text.* Cursor Visibility:: Making the cursor more or less easy to spot.* Bell:: Attracts user's attention; not localized on the screen.* Keypad:: Recognizing when function keys or arrows are typed.* Meta Key:: @key{META} acts like an extra shift key.* Initialization:: Commands used to initialize or reset the terminal.* Pad Specs:: Info for the kernel on how much padding is needed.* Status Line:: A status line displays ``background'' information.* Half-Line:: Moving by half-lines, for superscripts and subscripts.* Printer:: Controlling auxiliary printers of display terminals.@end menu@node Basic, Screen Size, , Capabilities@section Basic CharacteristicsThis section documents the capabilities that describe the basic andnature of the terminal, and also those that are relevant to the outputof graphic characters.@table @samp@item os@kindex os@cindex overstrikeFlag whose presence means that the terminal can overstrike. Thismeans that outputting a graphic character does not erase whatever waspresent in the same character position before. The terminals that canoverstrike include printing terminals, storage tubes (all obsoletenowadays), and many bit-map displays.@item eo@kindex eoFlag whose presence means that outputting a space erases a characterposition even if the terminal supports overstriking. If this flag isnot present and overstriking is supported, output of a space has noeffect except to move the cursor.(On terminals that do not support overstriking, you can always assumethat outputting a space at a position erases whatever character waspreviously displayed there.)@item gn@kindex gn@cindex generic terminal typeFlag whose presence means that this terminal type is a generic typewhich does not really describe any particular terminal. Generic typesare intended for use as the default type assigned when the userconnects to the system, with the intention that the user shouldspecify what type he really has. One example of a generic typeis the type @samp{network}.Since the generic type cannot say how to do anything interesting withthe terminal, termcap-using programs will always find that theterminal is too weak to be supported if the user has failed to specifya real terminal type in place of the generic one. The @samp{gn} flagdirects these programs to use a different error message: ``You havenot specified your real terminal type'', rather than ``Your terminalis not powerful enough to be used''.@item hc@kindex hcFlag whose presence means this is a hardcopy terminal.@item rp@kindex rp@cindex repeat outputString of commands to output a graphic character @var{c}, repeated @var{n}times. The first parameter value is the ASCII code for the desiredcharacter, and the second parameter is the number of times to repeat thecharacter. Often this command requires padding proportional to the number of times the character is repeated. This effect can be had byusing parameter arithmetic with @samp{%}-sequences to compute theamount of padding, then generating the result as a number at the frontof the string so that @code{tputs} will treat it as padding.@item hz@kindex hzFlag whose presence means that the ASCII character @samp{~} cannot beoutput on this terminal because it is used for display commands.Programs handle this flag by checking all text to be output andreplacing each @samp{~} with some other character(s). If this is notdone, the screen will be thoroughly garbled.The old Hazeltine terminals that required such treatment are probablyvery rare today, so you might as well not bother to support this flag.@item CC@kindex CC@cindex command characterString whose presence means the terminal has a settable commandcharacter. The value of the string is the default command character(which is usually @key{ESC}).All the strings of commands in the terminal description should bewritten to use the default command character. If you are writing anapplication program that changes the command character, use the@samp{CC} capability to figure out how to translate all the displaycommands to work with the new command character.Most programs have no reason to look at the @samp{CC} capability.@item xb@kindex xb@cindex SuperbeeFlag whose presence identifies Superbee terminals which are unable totransmit the characters @key{ESC} and @kbd{Control-C}. Programs whichsupport this flag are supposed to check the input for the code sequencessent by the @key{F1} and @key{F2} keys, and pretend that @key{ESC}or @kbd{Control-C} (respectively) had been read. But this flag isobsolete, and not worth supporting.@end table@node Screen Size, Cursor Motion, Basic, Capabilities@section Screen Size@cindex screen sizeA terminal description has two capabilities, @samp{co} and @samp{li},that describe the screen size in columns and lines. But there is moreto the question of screen size than this.On some operating systems the ``screen'' is really a window and theeffective width can vary. On some of these systems, @code{tgetnum}uses the actual width of the window to decide what value to return forthe @samp{co} capability, overriding what is actually written in theterminal description. On other systems, it is up to the applicationprogram to check the actual window width using a system call. Forexample, on BSD 4.3 systems, the system call @code{ioctl} with code@code{TIOCGWINSZ} will tell you the current screen size.On all window systems, termcap is powerless to advise the applicationprogram if the user resizes the window. Application programs mustdeal with this possibility in a system-dependent fashion. On somesystems the C shell handles part of the problem by detecting changesin window size and setting the @code{TERMCAP} environment variableappropriately. This takes care of applicati
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -