Go to the first, previous, next, last section, table of contents.


Inheriting from Related Descriptions

When two terminal descriptions are similar, their identical parts do not need to be given twice. Instead, one of the two can be defined in terms of the other, using the `tc' capability. We say that one description refers to the other, or inherits from the other.

The `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 which is referred to. For example,

N9|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:

defines the terminal type `aaa-30' (also known as plain `aaa') in terms of `aaa-unk', which defines everything about the Ambassador that is independent of screen height. The types `aaa-36', `aaa-48' and so on for other screen heights are likewise defined to inherit from `aaa-unk'.

The capabilities overridden by `aaa-30' include `li', which says how many lines there are, and `ti' and `te', which configure the terminal to use that many lines.

The effective terminal description for type `aaa' consists of the text shown above followed by the text of the description of `aaa-unk'. The `tc' capability is handled automatically by tgetent, which finds the description thus referenced and combines the two descriptions (see section Finding a Terminal Description: tgetent). Therefore, only the implementor of the terminal descriptions needs to think about using `tc'. Users and application programmers do not need to be concerned with it.

Since the reference terminal description is used last, capabilities specified in the referring description override any specifications of the same capabilities in the reference description.

The referring description can cancel out a capability without specifying any new value for it by means of a special trick. Write the capability in the referring description, with the character `@' after the capability name, as follows:

NZ|aaa-30-nam|ann arbor ambassador/30 lines/no automatic-margins:\
        :am@:tc=aaa-30:


Go to the first, previous, next, last section, table of contents.