1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
3 ****************************************************************************
4 * Copyright (c) 1998,2002 Free Software Foundation, Inc. *
6 * Permission is hereby granted, free of charge, to any person obtaining a *
7 * copy of this software and associated documentation files (the *
8 * "Software"), to deal in the Software without restriction, including *
9 * without limitation the rights to use, copy, modify, merge, publish, *
10 * distribute, distribute with modifications, sublicense, and/or sell *
11 * copies of the Software, and to permit persons to whom the Software is *
12 * furnished to do so, subject to the following conditions: *
14 * The above copyright notice and this permission notice shall be included *
15 * in all copies or substantial portions of the Software. *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
20 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
21 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
22 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
23 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
25 * Except as contained in this notice, the name(s) of the above copyright *
26 * holders shall not be used in advertising or otherwise to promote the *
27 * sale, use or other dealings in this Software without prior written *
29 ****************************************************************************
30 * @Id: term.5,v 1.14 2002/08/10 21:59:37 tom Exp @
35 <link rev=made href="mailto:bug-ncurses@gnu.org">
36 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
42 <!-- Manpage converted by man2html 3.0.1 -->
46 term - format of compiled term file.
50 <H2>SYNOPSIS</H2><PRE>
55 <H2>DESCRIPTION</H2><PRE>
56 Compiled terminfo descriptions are placed under the direc-
57 tory <STRONG>/usr/share/terminfo</STRONG>. In order to avoid a linear
58 search of a huge UNIX system directory, a two-level scheme
59 is used: <STRONG>/usr/share/terminfo/c/name</STRONG> where <EM>name</EM> is the name
60 of the terminal, and <EM>c</EM> is the first character of <EM>name</EM>.
61 Thus, <EM>act4</EM> can be found in the file <STRONG>/usr/share/ter-</STRONG>
62 <STRONG>minfo/a/act4</STRONG>. Synonyms for the same terminal are imple-
63 mented by multiple links to the same compiled file.
65 The format has been chosen so that it will be the same on
66 all hardware. An 8 or more bit byte is assumed, but no
67 assumptions about byte ordering or sign extension are
70 The compiled file is created with the <EM>tic</EM> program, and
71 read by the routine <EM>setupterm</EM>. The file is divided into
72 six parts: the header, terminal names, boolean flags, num-
73 bers, strings, and string table.
75 The header section begins the file. This section contains
76 six short integers in the format described below. These
77 integers are (1) the magic number (octal 0432); (2) the
78 size, in bytes, of the names section; (3) the number of
79 bytes in the boolean section; (4) the number of short
80 integers in the numbers section; (5) the number of offsets
81 (short integers) in the strings section; (6) the size, in
82 bytes, of the string table.
84 Short integers are stored in two 8-bit bytes. The first
85 byte contains the least significant 8 bits of the value,
86 and the second byte contains the most significant 8 bits.
87 (Thus, the value represented is 256*second+first.) The
88 value -1 is represented by the two bytes 0377, 0377; other
89 negative values are illegal. This value generally means
90 that the corresponding capability is missing from this
91 terminal. Note that this format corresponds to the hard-
92 ware of the VAX and PDP-11 (that is, little-endian
93 machines). Machines where this does not correspond to the
94 hardware must read the integers as two bytes and compute
95 the little-endian value.
97 The terminal names section comes next. It contains the
98 first line of the terminfo description, listing the vari-
99 ous names for the terminal, separated by the `|' charac-
100 ter. The section is terminated with an ASCII NUL charac-
103 The boolean flags have one byte for each flag. This byte
104 is either 0 or 1 as the flag is present or absent. The
105 capabilities are in the same order as the file <term.h>.
107 Between the boolean section and the number section, a null
108 byte will be inserted, if necessary, to ensure that the
109 number section begins on an even byte (this is a relic of
110 the PDP-11's word-addressed architecture, originally
111 designed in to avoid IOT traps induced by addressing a
112 word on an odd byte boundary). All short integers are
113 aligned on a short word boundary.
115 The numbers section is similar to the flags section. Each
116 capability takes up two bytes, and is stored as a little-
117 endian short integer. If the value represented is -1, the
118 capability is taken to be missing.
120 The strings section is also similar. Each capability is
121 stored as a short integer, in the format above. A value
122 of -1 means the capability is missing. Otherwise, the
123 value is taken as an offset from the beginning of the
124 string table. Special characters in ^X or \c notation are
125 stored in their interpreted form, not the printing repre-
126 sentation. Padding information $<nn> and parameter infor-
127 mation %x are stored intact in uninterpreted form.
129 The final section is the string table. It contains all
130 the values of string capabilities referenced in the string
131 section. Each string is null terminated.
133 Note that it is possible for <EM>setupterm</EM> to expect a differ-
134 ent set of capabilities than are actually present in the
135 file. Either the database may have been updated since
136 <EM>setupterm</EM> has been recompiled (resulting in extra unrecog-
137 nized entries in the file) or the program may have been
138 recompiled more recently than the database was updated
139 (resulting in missing entries). The routine <EM>setupterm</EM>
140 must be prepared for both possibilities - this is why the
141 numbers and sizes are included. Also, new capabilities
142 must always be added at the end of the lists of boolean,
143 number, and string capabilities.
145 Despite the consistent use of little-endian for numbers
146 and the otherwise self-describing format, it is not wise
147 to count on portability of binary terminfo entries between
148 commercial UNIX versions. The problem is that there are
149 at least three versions of terminfo (under HP-UX, AIX, and
150 OSF/1) which diverged from System V terminfo after SVr1,
151 and have added extension capabilities to the string table
152 that (in the binary format) collide with System V and XSI
153 Curses extensions. See <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG> for detailed discus-
154 sion of terminfo source compatibility issues.
156 As an example, here is a hex dump of the description for
157 the Lear-Siegler ADM-3, a popular though rather stupid
163 bel=^G, clear= 32$<1>, cr=^M, cub1=^H, cud1=^J,
164 cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K,
167 0000 1a 01 10 00 02 00 03 00 82 00 31 00 61 64 6d 33 ........ ..1.adm3
168 0010 61 7c 6c 73 69 20 61 64 6d 33 61 00 00 01 50 00 a|lsi ad m3a...P.
169 0020 ff ff 18 00 ff ff 00 00 02 00 ff ff ff ff 04 00 ........ ........
170 0030 ff ff ff ff ff ff ff ff 0a 00 25 00 27 00 ff ff ........ ..%.'...
171 0040 29 00 ff ff ff ff 2b 00 ff ff 2d 00 ff ff ff ff ).....+. ..-.....
172 0050 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
173 0060 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
174 0070 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
175 0080 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
176 0090 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
177 00a0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
178 00b0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
179 00c0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
180 00d0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
181 00e0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
182 00f0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
183 0100 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
184 0110 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ........ ........
185 0120 ff ff ff ff ff ff 2f 00 07 00 0d 00 1a 24 3c 31 ....../. .....$<1
186 0130 3e 00 1b 3d 25 70 31 25 7b 33 32 7d 25 2b 25 63 >..=%p1% {32}%+%c
187 0140 25 70 32 25 7b 33 32 7d 25 2b 25 63 00 0a 00 1e %p2%{32} %+%c....
188 0150 00 08 00 0c 00 0b 00 0a 00 ........ .
191 Some limitations: total compiled entries cannot exceed
192 4096 bytes. The name field cannot exceed 128 bytes.
197 /usr/share/terminfo/*/* compiled terminal capability data
202 <H2>SEE ALSO</H2><PRE>
203 <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>.
218 Man(1) output converted with
219 <a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>