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>
49 <H2><a name="h2-NAME">NAME</a></H2><PRE>
50 term - format of compiled term file.
54 <H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE>
59 <H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
62 <H3><a name="h3-STORAGE-LOCATION">STORAGE LOCATION</a></H3><PRE>
63 Compiled terminfo descriptions are placed under the direc-
64 tory <STRONG>/usr/share/terminfo</STRONG>. Two configurations are sup-
65 ported (when building the ncurses libraries):
67 <STRONG>directory</STRONG> <STRONG>tree</STRONG>
68 A two-level scheme is used to avoid a linear search
69 of a huge UNIX system directory: <STRONG>/usr/share/ter-</STRONG>
70 <STRONG>minfo/c/name</STRONG> where <EM>name</EM> is the name of the terminal,
71 and <EM>c</EM> is the first character of <EM>name</EM>. Thus, <EM>act4</EM> can
72 be found in the file <STRONG>/usr/share/terminfo/a/act4</STRONG>.
73 Synonyms for the same terminal are implemented by
74 multiple links to the same compiled file.
76 <STRONG>hashed</STRONG> <STRONG>database</STRONG>
77 Using Berkeley database, two types of records are
78 stored: the terminfo data in the same format as
79 stored in a directory tree with the terminfo's pri-
80 mary name as a key, and records containing only
81 aliases pointing to the primary name.
83 If built to write hashed databases, ncurses can still
84 read terminfo databases organized as a directory
85 tree, but cannot write entries into the directory
86 tree. It can write (or rewrite) entries in the
89 ncurses distinguishes the two cases in the TERMINFO
90 and TERMINFO_DIRS environment variable by assuming a
91 directory tree for entries that correspond to an
92 existing directory, and hashed database otherwise.
96 <H3><a name="h3-STORAGE-FORMAT">STORAGE FORMAT</a></H3><PRE>
97 The format has been chosen so that it will be the same on
98 all hardware. An 8 or more bit byte is assumed, but no
99 assumptions about byte ordering or sign extension are
102 The compiled file is created with the <STRONG>tic</STRONG> program, and
103 read by the routine <EM>setupterm</EM>. The file is divided into
104 six parts: the header, terminal names, boolean flags, num-
105 bers, strings, and string table.
107 The header section begins the file. This section contains
108 six short integers in the format described below. These
111 (1) the magic number (octal 0432);
113 (2) the size, in bytes, of the names section;
115 (3) the number of bytes in the boolean section;
117 (4) the number of short integers in the numbers sec-
120 (5) the number of offsets (short integers) in the
123 (6) the size, in bytes, of the string table.
125 Short integers are stored in two 8-bit bytes. The first
126 byte contains the least significant 8 bits of the value,
127 and the second byte contains the most significant 8 bits.
128 (Thus, the value represented is 256*second+first.) The
129 value -1 is represented by the two bytes 0377, 0377; other
130 negative values are illegal. This value generally means
131 that the corresponding capability is missing from this
132 terminal. Note that this format corresponds to the hard-
133 ware of the VAX and PDP-11 (that is, little-endian
134 machines). Machines where this does not correspond to the
135 hardware must read the integers as two bytes and compute
136 the little-endian value.
138 The terminal names section comes next. It contains the
139 first line of the terminfo description, listing the vari-
140 ous names for the terminal, separated by the `|' charac-
141 ter. The section is terminated with an ASCII NUL charac-
144 The boolean flags have one byte for each flag. This byte
145 is either 0 or 1 as the flag is present or absent. The
146 capabilities are in the same order as the file <term.h>.
148 Between the boolean section and the number section, a null
149 byte will be inserted, if necessary, to ensure that the
150 number section begins on an even byte (this is a relic of
151 the PDP-11's word-addressed architecture, originally
152 designed in to avoid IOT traps induced by addressing a
153 word on an odd byte boundary). All short integers are
154 aligned on a short word boundary.
156 The numbers section is similar to the flags section. Each
157 capability takes up two bytes, and is stored as a little-
158 endian short integer. If the value represented is -1, the
159 capability is taken to be missing.
161 The strings section is also similar. Each capability is
162 stored as a short integer, in the format above. A value
163 of -1 means the capability is missing. Otherwise, the
164 value is taken as an offset from the beginning of the
165 string table. Special characters in ^X or \c notation are
166 stored in their interpreted form, not the printing repre-
167 sentation. Padding information $<nn> and parameter infor-
168 mation %x are stored intact in uninterpreted form.
170 The final section is the string table. It contains all
171 the values of string capabilities referenced in the string
172 section. Each string is null terminated.
176 <H3><a name="h3-EXTENDED-STORAGE-FORMAT">EXTENDED STORAGE FORMAT</a></H3><PRE>
177 The previous section describes the conventional terminfo
178 binary format. With some minor variations of the offsets
179 (see PORTABILITY), the same binary format is used in all
180 modern UNIX systems. Each system uses a predefined set of
181 boolean, number or string capabilities.
183 The ncurses libraries and applications support extended
184 terminfo binary format, allowing users to define capabili-
185 ties which are loaded at runtime. This extension is made
186 possible by using the fact that the other implementations
187 stop reading the terminfo data when they have reached the
188 end of the size given in the header. ncurses checks the
189 size, and if it exceeds that due to the predefined data,
190 continues to parse according to its own scheme.
192 First, it reads the extended header (5 short integers):
194 (1) count of extended boolean capabilities
196 (2) count of extended numeric capabilities
198 (3) count of extended string capabilities
200 (4) size of the extended string table in bytes.
202 (5) last offset of the extended string table in
205 Using the counts and sizes, ncurses allocates arrays and
206 reads data for the extended capabilities in the same order
207 as the header information.
209 The extended string table contains values for string capa-
210 bilities. After the end of these values, it contains the
211 names for each of the extended capabilities in order,
212 e.g., booleans, then numbers and finally strings.
216 <H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
217 Note that it is possible for <EM>setupterm</EM> to expect a differ-
218 ent set of capabilities than are actually present in the
219 file. Either the database may have been updated since
220 <EM>setupterm</EM> has been recompiled (resulting in extra unrecog-
221 nized entries in the file) or the program may have been
222 recompiled more recently than the database was updated
223 (resulting in missing entries). The routine <EM>setupterm</EM>
224 must be prepared for both possibilities - this is why the
225 numbers and sizes are included. Also, new capabilities
226 must always be added at the end of the lists of boolean,
227 number, and string capabilities.
229 Despite the consistent use of little-endian for numbers
230 and the otherwise self-describing format, it is not wise
231 to count on portability of binary terminfo entries between
232 commercial UNIX versions. The problem is that there are
233 at least three versions of terminfo (under HP-UX, AIX, and
234 OSF/1) which diverged from System V terminfo after SVr1,
235 and have added extension capabilities to the string table
236 that (in the binary format) collide with System V and XSI
237 Curses extensions. See <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG> for detailed discus-
238 sion of terminfo source compatibility issues.
242 <H2><a name="h2-EXAMPLE">EXAMPLE</a></H2><PRE>
243 As an example, here is a hex dump of the description for
244 the Lear-Siegler ADM-3, a popular though rather stupid
250 bel=^G, clear= 32$<1>, cr=^M, cub1=^H, cud1=^J,
251 cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K,
254 0000 1a 01 10 00 02 00 03 00 82 00 31 00 61 64 6d 33 ........ ..1.adm3
255 0010 61 7c 6c 73 69 20 61 64 6d 33 61 00 00 01 50 00 a|lsi ad m3a...P.
256 0020 ff ff 18 00 ff ff 00 00 02 00 ff ff ff ff 04 00 ........ ........
257 0030 ff ff ff ff ff ff ff ff 0a 00 25 00 27 00 ff ff ........ ..%.'...
258 0040 29 00 ff ff ff ff 2b 00 ff ff 2d 00 ff ff ff ff ).....+. ..-.....
259 0050 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
260 0060 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
261 0070 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
262 0080 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
263 0090 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
264 00a0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
265 00b0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
266 00c0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
267 00d0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
268 00e0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
269 00f0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
270 0100 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
271 0110 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
272 0120 ff ff ff ff ff ff 2f 00 07 00 0d 00 1a 24 3c 31 ....../. .....$<1
273 0130 3e 00 1b 3d 25 70 31 25 7b 33 32 7d 25 2b 25 63 >..=%p1% {32}%+%c
274 0140 25 70 32 25 7b 33 32 7d 25 2b 25 63 00 0a 00 1e %p2%{32} %+%c....
275 0150 00 08 00 0c 00 0b 00 0a 00 ........ .
280 <H2><a name="h2-LIMITS">LIMITS</a></H2><PRE>
281 Some limitations: total compiled entries cannot exceed
282 4096 bytes. The name field cannot exceed 128 bytes.
286 <H2><a name="h2-FILES">FILES</a></H2><PRE>
287 /usr/share/terminfo/*/* compiled terminal capability data
292 <H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
293 <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>.
297 <H2><a name="h2-AUTHORS">AUTHORS</a></H2><PRE>
299 extended terminfo format for ncurses 5.0
300 hashed database support for ncurses 5.6
306 <STRONG><A HREF="term.5.html">term(5)</A></STRONG>
310 <li><a href="#h2-NAME">NAME</a></li>
311 <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li>
312 <li><a href="#h2-DESCRIPTION">DESCRIPTION</a>
314 <li><a href="#h3-STORAGE-LOCATION">STORAGE LOCATION</a></li>
315 <li><a href="#h3-STORAGE-FORMAT">STORAGE FORMAT</a></li>
316 <li><a href="#h3-EXTENDED-STORAGE-FORMAT">EXTENDED STORAGE FORMAT</a></li>
319 <li><a href="#h2-PORTABILITY">PORTABILITY</a></li>
320 <li><a href="#h2-EXAMPLE">EXAMPLE</a></li>
321 <li><a href="#h2-LIMITS">LIMITS</a></li>
322 <li><a href="#h2-FILES">FILES</a></li>
323 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>
324 <li><a href="#h2-AUTHORS">AUTHORS</a></li>