Penguin
Annotated edit history of term(5) version 1, including all changes. View license author blame.
Rev Author # Line
1 perry 1 TERM
2 !!!TERM
3 NAME
4 SYNOPSIS
5 DESCRIPTION
6 FILES
7 SEE ALSO
8 ----
9 !!NAME
10
11
12 term - format of compiled term file.
13 !!SYNOPSIS
14
15
16 __term__
17 !!DESCRIPTION
18
19
20 Compiled terminfo descriptions are placed under the
21 directory __/usr/share/terminfo__. In order to avoid a
22 linear search of a huge UNIX system
23 directory, a two-level scheme is used: __/c/name__ where
24 ''name'' is the name of the terminal, and ''c'' is the
25 first character of ''name''. Thus, ''act4'' can be
26 found in the file __/usr/share/terminfo/a/act4__.
27 Synonyms for the same terminal are implemented by multiple
28 links to the same compiled file.
29
30
31 The format has been chosen so that it will be the same on
32 all hardware. An 8 or more bit byte is assumed, but no
33 assumptions about byte ordering or sign extension are
34 made.
35
36
37 The compiled file is created with the ''tic'' program,
38 and read by the routine ''setupterm''. The file is
39 divided into six parts: the header, terminal names, boolean
40 flags, numbers, strings, and string table.
41
42
43 The header section begins the file. This section contains
44 six short integers in the format described below. These
45 integers are (1) the magic number (octal 0432); (2) the
46 size, in bytes, of the names section; (3) the number of
47 bytes in the boolean section; (4) the number of short
48 integers in the numbers section; (5) the number of offsets
49 (short integers) in the strings section; (6) the size, in
50 bytes, of the string table.
51
52
53 Short integers are stored in two 8-bit bytes. The first byte
54 contains the least significant 8 bits of the value, and the
55 second byte contains the most significant 8 bits. (Thus, the
56 value represented is 256*second+first.) The value -1 is
57 represented by the two bytes 0377, 0377; other negative
58 values are illegal. This value generally means that the
59 corresponding capability is missing from this terminal. Note
60 that this format corresponds to the hardware of the
61 VAX and PDP -11 (that is,
62 little-endian machines). Machines where this does not
63 correspond to the hardware must read the integers as two
64 bytes and compute the little-endian value.
65
66
67 The terminal names section comes next. It contains the first
68 line of the terminfo description, listing the various names
69 for the terminal, separated by the `|' character. The
70 section is terminated with an ASCII NUL
71 character.
72
73
74 The boolean flags have one byte for each flag. This byte is
75 either 0 or 1 as the flag is present or absent. The
76 capabilities are in the same order as the file
77
78
79 Between the boolean section and the number section, a null
80 byte will be inserted, if necessary, to ensure that the
81 number section begins on an even byte (this is a relic of
82 the PDP-11's word-addressed architecture, originally
83 designed in to avoid IOT traps induced by addressing a word
84 on an odd byte boundary). All short integers are aligned on
85 a short word boundary.
86
87
88 The numbers section is similar to the flags section. Each
89 capability takes up two bytes, and is stored as a
90 little-endian short integer. If the value represented is -1,
91 the capability is taken to be missing.
92
93
94 The strings section is also similar. Each capability is
95 stored as a short integer, in the format above. A value of
96 -1 means the capability is missing. Otherwise, the value is
97 taken as an offset from the beginning of the string table.
98 Special characters in ^X or c notation are stored in their
99 interpreted form, not the printing representation. Padding
100 information $
101
102
103 The final section is the string table. It contains all the
104 values of string capabilities referenced in the string
105 section. Each string is null terminated.
106
107
108 Note that it is possible for ''setupterm'' to expect a
109 different set of capabilities than are actually present in
110 the file. Either the database may have been updated since
111 ''setupterm'' has been recompiled (resulting in extra
112 unrecognized entries in the file) or the program may have
113 been recompiled more recently than the database was updated
114 (resulting in missing entries). The routine ''setupterm''
115 must be prepared for both possibilities - this is why the
116 numbers and sizes are included. Also, new capabilities must
117 always be added at the end of the lists of boolean, number,
118 and string capabilities.
119
120
121 Despite the consistent use of little-endian for numbers and
122 the otherwise self-describing format, it is not wise to
123 count on portability of binary terminfo entries between
124 commercial UNIX versions. The problem is that there are at
125 least three versions of terminfo (under HP-UX, AIX, and
126 OSF/1) which diverged from System V terminfo after SVr1, and
127 have added extension capabilities to the string table that
128 (in the binary format) collide with System V and XSI Curses
129 extensions. See terminfo(5) for detailed discussion
130 of terminfo source compatibility issues.
131
132
133 As an example, here is a hex dump of the description for the
134 Lear-Siegler ADM-3, a popular though rather stupid early
135 terminal:
136
137
138 adm3a|lsi adm3a,
139 am,
140 cols#80, lines#24,
141 bel=^G, clear= 32$
142 0000 1a 01 10 00 02 00 03 00 82 00 31 00 61 64 6d 33 ........ ..1.adm3
143 0010 61 7c 6c 73 69 20 61 64 6d 33 61 00 00 01 50 00 a|lsi ad m3a...P.
144 0020 ff ff 18 00 ff ff 00 00 02 00 ff ff ff ff 04 00 ........ ........
145 0030 ff ff ff ff ff ff ff ff 0a 00 25 00 27 00 ff ff ........ ..%.'...
146 0040 29 00 ff ff ff ff 2b 00 ff ff 2d 00 ff ff ff ff ).....+. ..-.....
147 0050 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
148 0060 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
149 0070 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
150 0080 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
151 0090 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
152 00a0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
153 00b0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
154 00c0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
155 00d0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
156 00e0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
157 00f0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
158 0100 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
159 0110 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
160 0120 ff ff ff ff ff ff 2f 00 07 00 0d 00 1a 24 3c 31 ....../. .....$
161
162
163 Some limitations: total compiled entries cannot exceed 4096
164 bytes. The name field cannot exceed 128 bytes.
165 !!FILES
166
167
168 /usr/share/terminfo/*/* compiled terminal capability data
169 base
170 !!SEE ALSO
171
172
173 __curses__(3X), terminfo(5).
174 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.