2 ****************************************************************************
3 * Copyright (c) 1998-2010,2015 Free Software Foundation, Inc. *
5 * Permission is hereby granted, free of charge, to any person obtaining a *
6 * copy of this software and associated documentation files (the *
7 * "Software"), to deal in the Software without restriction, including *
8 * without limitation the rights to use, copy, modify, merge, publish, *
9 * distribute, distribute with modifications, sublicense, and/or sell *
10 * copies of the Software, and to permit persons to whom the Software is *
11 * furnished to do so, subject to the following conditions: *
13 * The above copyright notice and this permission notice shall be included *
14 * in all copies or substantial portions of the Software. *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
19 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
21 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
22 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
24 * Except as contained in this notice, the name(s) of the above copyright *
25 * holders shall not be used in advertising or otherwise to promote the *
26 * sale, use or other dealings in this Software without prior written *
28 ****************************************************************************
29 * @Id: term.5,v 1.22 2015/04/26 14:50:23 tom Exp @
31 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
34 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
35 <meta name="generator" content="Manpage converted by man2html - see http://invisible-island.net/scripts/readme.html#others_scripts">
37 <link rev=made href="mailto:bug-ncurses@gnu.org">
38 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
41 <H1 class="no-header">term 5</H1>
43 <STRONG><A HREF="term.5.html">term(5)</A></STRONG> <STRONG><A HREF="term.5.html">term(5)</A></STRONG>
48 </PRE><H2><a name="h2-NAME">NAME</a></H2><PRE>
49 term - format of compiled term file.
52 </PRE><H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE>
56 </PRE><H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
58 </PRE><H3><a name="h3-STORAGE-LOCATION">STORAGE LOCATION</a></H3><PRE>
59 Compiled terminfo descriptions are placed under the direc-
60 tory <STRONG>/usr/share/terminfo</STRONG>. Two configurations are sup-
61 ported (when building the ncurses libraries):
63 <STRONG>directory</STRONG> <STRONG>tree</STRONG>
64 A two-level scheme is used to avoid a linear search
65 of a huge UNIX system directory: <STRONG>/usr/share/ter-</STRONG>
66 <STRONG>minfo/c/name</STRONG> where <EM>name</EM> is the name of the terminal,
67 and <EM>c</EM> is the first character of <EM>name</EM>. Thus, <EM>act4</EM> can
68 be found in the file <STRONG>/usr/share/terminfo/a/act4</STRONG>.
69 Synonyms for the same terminal are implemented by
70 multiple links to the same compiled file.
72 <STRONG>hashed</STRONG> <STRONG>database</STRONG>
73 Using Berkeley database, two types of records are
74 stored: the terminfo data in the same format as
75 stored in a directory tree with the terminfo's pri-
76 mary name as a key, and records containing only
77 aliases pointing to the primary name.
79 If built to write hashed databases, ncurses can still
80 read terminfo databases organized as a directory
81 tree, but cannot write entries into the directory
82 tree. It can write (or rewrite) entries in the
85 ncurses distinguishes the two cases in the TERMINFO
86 and TERMINFO_DIRS environment variable by assuming a
87 directory tree for entries that correspond to an
88 existing directory, and hashed database otherwise.
91 </PRE><H3><a name="h3-STORAGE-FORMAT">STORAGE FORMAT</a></H3><PRE>
92 The format has been chosen so that it will be the same on
93 all hardware. An 8 or more bit byte is assumed, but no
94 assumptions about byte ordering or sign extension are
97 The compiled file is created with the <STRONG>tic</STRONG> program, and
98 read by the routine <EM>setupterm</EM>. The file is divided into
99 six parts: the header, terminal names, boolean flags, num-
100 bers, strings, and string table.
102 The header section begins the file. This section contains
103 six short integers in the format described below. These
106 (1) the magic number (octal 0432);
108 (2) the size, in bytes, of the names section;
110 (3) the number of bytes in the boolean section;
112 (4) the number of short integers in the numbers sec-
115 (5) the number of offsets (short integers) in the
118 (6) the size, in bytes, of the string table.
120 Short integers are stored in two 8-bit bytes. The first
121 byte contains the least significant 8 bits of the value,
122 and the second byte contains the most significant 8 bits.
123 (Thus, the value represented is 256*second+first.) The
124 value -1 is represented by the two bytes 0377, 0377; other
125 negative values are illegal. This value generally means
126 that the corresponding capability is missing from this
127 terminal. Note that this format corresponds to the hard-
128 ware of the VAX and PDP-11 (that is, little-endian
129 machines). Machines where this does not correspond to the
130 hardware must read the integers as two bytes and compute
131 the little-endian value.
133 The terminal names section comes next. It contains the
134 first line of the terminfo description, listing the vari-
135 ous names for the terminal, separated by the `|' charac-
136 ter. The section is terminated with an ASCII NUL charac-
139 The boolean flags have one byte for each flag. This byte
140 is either 0 or 1 as the flag is present or absent. The
141 capabilities are in the same order as the file <term.h>.
143 Between the boolean section and the number section, a null
144 byte will be inserted, if necessary, to ensure that the
145 number section begins on an even byte (this is a relic of
146 the PDP-11's word-addressed architecture, originally
147 designed in to avoid IOT traps induced by addressing a
148 word on an odd byte boundary). All short integers are
149 aligned on a short word boundary.
151 The numbers section is similar to the flags section. Each
152 capability takes up two bytes, and is stored as a little-
153 endian short integer. If the value represented is -1, the
154 capability is taken to be missing.
156 The strings section is also similar. Each capability is
157 stored as a short integer, in the format above. A value
158 of -1 means the capability is missing. Otherwise, the
159 value is taken as an offset from the beginning of the
160 string table. Special characters in ^X or \c notation are
161 stored in their interpreted form, not the printing repre-
162 sentation. Padding information $<nn> and parameter infor-
163 mation %x are stored intact in uninterpreted form.
165 The final section is the string table. It contains all
166 the values of string capabilities referenced in the string
167 section. Each string is null terminated.
170 </PRE><H3><a name="h3-EXTENDED-STORAGE-FORMAT">EXTENDED STORAGE FORMAT</a></H3><PRE>
171 The previous section describes the conventional terminfo
172 binary format. With some minor variations of the offsets
173 (see PORTABILITY), the same binary format is used in all
174 modern UNIX systems. Each system uses a predefined set of
175 boolean, number or string capabilities.
177 The ncurses libraries and applications support extended
178 terminfo binary format, allowing users to define capabili-
179 ties which are loaded at runtime. This extension is made
180 possible by using the fact that the other implementations
181 stop reading the terminfo data when they have reached the
182 end of the size given in the header. ncurses checks the
183 size, and if it exceeds that due to the predefined data,
184 continues to parse according to its own scheme.
186 First, it reads the extended header (5 short integers):
188 (1) count of extended boolean capabilities
190 (2) count of extended numeric capabilities
192 (3) count of extended string capabilities
194 (4) size of the extended string table in bytes.
196 (5) last offset of the extended string table in
199 Using the counts and sizes, ncurses allocates arrays and
200 reads data for the extended capabilities in the same order
201 as the header information.
203 The extended string table contains values for string capa-
204 bilities. After the end of these values, it contains the
205 names for each of the extended capabilities in order,
206 e.g., booleans, then numbers and finally strings.
209 </PRE><H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
210 Note that it is possible for <EM>setupterm</EM> to expect a differ-
211 ent set of capabilities than are actually present in the
212 file. Either the database may have been updated since
213 <EM>setupterm</EM> has been recompiled (resulting in extra unrecog-
214 nized entries in the file) or the program may have been
215 recompiled more recently than the database was updated
216 (resulting in missing entries). The routine <EM>setupterm</EM>
217 must be prepared for both possibilities - this is why the
218 numbers and sizes are included. Also, new capabilities
219 must always be added at the end of the lists of boolean,
220 number, and string capabilities.
222 Despite the consistent use of little-endian for numbers
223 and the otherwise self-describing format, it is not wise
224 to count on portability of binary terminfo entries between
225 commercial UNIX versions. The problem is that there are
226 at least three versions of terminfo (under HP-UX, AIX, and
227 OSF/1) which diverged from System V terminfo after SVr1,
228 and have added extension capabilities to the string table
229 that (in the binary format) collide with System V and XSI
230 Curses extensions. See <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG> for detailed discus-
231 sion of terminfo source compatibility issues.
234 </PRE><H2><a name="h2-EXAMPLE">EXAMPLE</a></H2><PRE>
235 As an example, here is a hex dump of the description for
236 the Lear-Siegler ADM-3, a popular though rather stupid
242 bel=^G, clear= 32$<1>, cr=^M, cub1=^H, cud1=^J,
243 cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K,
246 0000 1a 01 10 00 02 00 03 00 82 00 31 00 61 64 6d 33 ........ ..1.adm3
247 0010 61 7c 6c 73 69 20 61 64 6d 33 61 00 00 01 50 00 a|lsi ad m3a...P.
248 0020 ff ff 18 00 ff ff 00 00 02 00 ff ff ff ff 04 00 ........ ........
249 0030 ff ff ff ff ff ff ff ff 0a 00 25 00 27 00 ff ff ........ ..%.'...
250 0040 29 00 ff ff ff ff 2b 00 ff ff 2d 00 ff ff ff ff ).....+. ..-.....
251 0050 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
252 0060 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
253 0070 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
254 0080 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
255 0090 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
256 00a0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
257 00b0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
258 00c0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
259 00d0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
260 00e0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
261 00f0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
262 0100 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
263 0110 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
264 0120 ff ff ff ff ff ff 2f 00 07 00 0d 00 1a 24 3c 31 ....../. .....$<1
265 0130 3e 00 1b 3d 25 70 31 25 7b 33 32 7d 25 2b 25 63 >..=%p1% {32}%+%c
266 0140 25 70 32 25 7b 33 32 7d 25 2b 25 63 00 0a 00 1e %p2%{32} %+%c....
267 0150 00 08 00 0c 00 0b 00 0a 00 ........ .
271 </PRE><H2><a name="h2-LIMITS">LIMITS</a></H2><PRE>
272 Some limitations: total compiled entries cannot exceed
273 4096 bytes. The name field cannot exceed 128 bytes.
276 </PRE><H2><a name="h2-FILES">FILES</a></H2><PRE>
277 /usr/share/terminfo/*/* compiled terminal capability data
281 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
282 <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>.
285 </PRE><H2><a name="h2-AUTHORS">AUTHORS</a></H2><PRE>
287 extended terminfo format for ncurses 5.0
288 hashed database support for ncurses 5.6
294 <STRONG><A HREF="term.5.html">term(5)</A></STRONG>
298 <li><a href="#h2-NAME">NAME</a></li>
299 <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li>
300 <li><a href="#h2-DESCRIPTION">DESCRIPTION</a>
302 <li><a href="#h3-STORAGE-LOCATION">STORAGE LOCATION</a></li>
303 <li><a href="#h3-STORAGE-FORMAT">STORAGE FORMAT</a></li>
304 <li><a href="#h3-EXTENDED-STORAGE-FORMAT">EXTENDED STORAGE FORMAT</a></li>
307 <li><a href="#h2-PORTABILITY">PORTABILITY</a></li>
308 <li><a href="#h2-EXAMPLE">EXAMPLE</a></li>
309 <li><a href="#h2-LIMITS">LIMITS</a></li>
310 <li><a href="#h2-FILES">FILES</a></li>
311 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>
312 <li><a href="#h2-AUTHORS">AUTHORS</a></li>