]> ncurses.scripts.mit.edu Git - ncurses.git/blob - doc/html/man/term.5.html
ncurses 5.9 - patch 20150214
[ncurses.git] / doc / html / man / term.5.html
1 <!-- 
2   ****************************************************************************
3   * Copyright (c) 1998-2006,2010 Free Software Foundation, Inc.              *
4   *                                                                          *
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:                 *
12   *                                                                          *
13   * The above copyright notice and this permission notice shall be included  *
14   * in all copies or substantial portions of the Software.                   *
15   *                                                                          *
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.                               *
23   *                                                                          *
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       *
27   * authorization.                                                           *
28   ****************************************************************************
29   * @Id: term.5,v 1.21 2010/12/04 18:40:45 tom Exp @
30 -->
31 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
32 <HTML>
33 <HEAD>
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">
36 <TITLE>term 5</TITLE>
37 <link rev=made href="mailto:bug-ncurses@gnu.org">
38 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
39 </HEAD>
40 <BODY>
41 <H1>term 5</H1>
42 <HR>
43 <PRE>
44 <STRONG><A HREF="term.5.html">term(5)</A></STRONG>                                                         <STRONG><A HREF="term.5.html">term(5)</A></STRONG>
45
46
47
48
49 </PRE>
50 <H2><a name="h2-NAME">NAME</a></H2><PRE>
51        term - format of compiled term file.
52
53
54 </PRE>
55 <H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE>
56        <STRONG>term</STRONG>
57
58
59 </PRE>
60 <H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
61
62 </PRE>
63 <H3><a name="h3-STORAGE-LOCATION">STORAGE LOCATION</a></H3><PRE>
64        Compiled terminfo descriptions are placed under the direc-
65        tory <STRONG>/usr/share/terminfo</STRONG>.   Two  configurations  are  sup-
66        ported (when building the ncurses libraries):
67
68        <STRONG>directory</STRONG> <STRONG>tree</STRONG>
69             A  two-level  scheme is used to avoid a linear search
70             of a  huge  UNIX  system  directory:  <STRONG>/usr/share/ter-</STRONG>
71             <STRONG>minfo/c/name</STRONG>  where <EM>name</EM> is the name of the terminal,
72             and <EM>c</EM> is the first character of <EM>name</EM>.  Thus, <EM>act4</EM> can
73             be  found  in  the  file  <STRONG>/usr/share/terminfo/a/act4</STRONG>.
74             Synonyms for the same  terminal  are  implemented  by
75             multiple links to the same compiled file.
76
77        <STRONG>hashed</STRONG> <STRONG>database</STRONG>
78             Using  Berkeley  database,  two  types of records are
79             stored: the terminfo  data  in  the  same  format  as
80             stored  in  a directory tree with the terminfo's pri-
81             mary name as  a  key,  and  records  containing  only
82             aliases pointing to the primary name.
83
84             If built to write hashed databases, ncurses can still
85             read terminfo  databases  organized  as  a  directory
86             tree,  but  cannot  write  entries into the directory
87             tree.  It can  write  (or  rewrite)  entries  in  the
88             hashed database.
89
90             ncurses  distinguishes  the two cases in the TERMINFO
91             and TERMINFO_DIRS environment variable by assuming  a
92             directory  tree  for  entries  that  correspond to an
93             existing directory, and hashed database otherwise.
94
95
96 </PRE>
97 <H3><a name="h3-STORAGE-FORMAT">STORAGE FORMAT</a></H3><PRE>
98        The format has been chosen so that it will be the same  on
99        all  hardware.   An  8 or more bit byte is assumed, but no
100        assumptions about byte  ordering  or  sign  extension  are
101        made.
102
103        The  compiled  file  is  created with the <STRONG>tic</STRONG> program, and
104        read by the routine <EM>setupterm</EM>.  The file is  divided  into
105        six parts: the header, terminal names, boolean flags, num-
106        bers, strings, and string table.
107
108        The header section begins the file.  This section contains
109        six  short  integers in the format described below.  These
110        integers are
111
112             (1) the magic number (octal 0432);
113
114             (2) the size, in bytes, of the names section;
115
116             (3) the number of bytes in the boolean section;
117
118             (4) the number of short integers in the numbers  sec-
119             tion;
120
121             (5)  the  number  of  offsets (short integers) in the
122             strings section;
123
124             (6) the size, in bytes, of the string table.
125
126        Short integers are stored in two 8-bit bytes.   The  first
127        byte  contains  the least significant 8 bits of the value,
128        and the second byte contains the most significant 8  bits.
129        (Thus,  the  value  represented is 256*second+first.)  The
130        value -1 is represented by the two bytes 0377, 0377; other
131        negative  values  are  illegal. This value generally means
132        that the corresponding capability  is  missing  from  this
133        terminal.   Note that this format corresponds to the hard-
134        ware  of  the  VAX  and  PDP-11  (that  is,  little-endian
135        machines).  Machines where this does not correspond to the
136        hardware must read the integers as two bytes  and  compute
137        the little-endian value.
138
139        The  terminal  names  section comes next.  It contains the
140        first line of the terminfo description, listing the  vari-
141        ous  names  for the terminal, separated by the `|' charac-
142        ter.  The section is terminated with an ASCII NUL  charac-
143        ter.
144
145        The  boolean flags have one byte for each flag.  This byte
146        is either 0 or 1 as the flag is present  or  absent.   The
147        capabilities are in the same order as the file &lt;term.h&gt;.
148
149        Between the boolean section and the number section, a null
150        byte will be inserted, if necessary, to  ensure  that  the
151        number  section begins on an even byte (this is a relic of
152        the  PDP-11's  word-addressed   architecture,   originally
153        designed  in  to  avoid  IOT traps induced by addressing a
154        word on an odd byte boundary).   All  short  integers  are
155        aligned on a short word boundary.
156
157        The numbers section is similar to the flags section.  Each
158        capability takes up two bytes, and is stored as a  little-
159        endian short integer.  If the value represented is -1, the
160        capability is taken to be missing.
161
162        The strings section is also similar.  Each  capability  is
163        stored  as  a short integer, in the format above.  A value
164        of -1 means the capability  is  missing.   Otherwise,  the
165        value  is  taken  as  an  offset from the beginning of the
166        string table.  Special characters in ^X or \c notation are
167        stored  in their interpreted form, not the printing repre-
168        sentation.  Padding information $&lt;nn&gt; and parameter infor-
169        mation %x are stored intact in uninterpreted form.
170
171        The  final  section  is the string table.  It contains all
172        the values of string capabilities referenced in the string
173        section.  Each string is null terminated.
174
175
176 </PRE>
177 <H3><a name="h3-EXTENDED-STORAGE-FORMAT">EXTENDED STORAGE FORMAT</a></H3><PRE>
178        The  previous  section describes the conventional terminfo
179        binary format.  With some minor variations of the  offsets
180        (see  PORTABILITY),  the same binary format is used in all
181        modern UNIX systems.  Each system uses a predefined set of
182        boolean, number or string capabilities.
183
184        The  ncurses  libraries  and applications support extended
185        terminfo binary format, allowing users to define capabili-
186        ties  which are loaded at runtime.  This extension is made
187        possible by using the fact that the other  implementations
188        stop  reading the terminfo data when they have reached the
189        end of the size given in the header.  ncurses  checks  the
190        size,  and  if it exceeds that due to the predefined data,
191        continues to parse according to its own scheme.
192
193        First, it reads the extended header (5 short integers):
194
195             (1)  count of extended boolean capabilities
196
197             (2)  count of extended numeric capabilities
198
199             (3)  count of extended string capabilities
200
201             (4)  size of the extended string table in bytes.
202
203             (5)  last offset of  the  extended  string  table  in
204                  bytes.
205
206        Using  the  counts and sizes, ncurses allocates arrays and
207        reads data for the extended capabilties in the same  order
208        as the header information.
209
210        The extended string table contains values for string capa-
211        bilities.  After the end of these values, it contains  the
212        names  for  each  of  the  extended capabilities in order,
213        e.g., booleans, then numbers and finally strings.
214
215
216 </PRE>
217 <H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
218        Note that it is possible for <EM>setupterm</EM> to expect a differ-
219        ent  set  of capabilities than are actually present in the
220        file.  Either the database may  have  been  updated  since
221        <EM>setupterm</EM> has been recompiled (resulting in extra unrecog-
222        nized entries in the file) or the program  may  have  been
223        recompiled  more  recently  than  the database was updated
224        (resulting in missing  entries).   The  routine  <EM>setupterm</EM>
225        must  be prepared for both possibilities - this is why the
226        numbers and sizes are included.   Also,  new  capabilities
227        must  always  be added at the end of the lists of boolean,
228        number, and string capabilities.
229
230        Despite the consistent use of  little-endian  for  numbers
231        and  the  otherwise self-describing format, it is not wise
232        to count on portability of binary terminfo entries between
233        commercial  UNIX  versions.  The problem is that there are
234        at least three versions of terminfo (under HP-UX, AIX, and
235        OSF/1)  which  diverged from System V terminfo after SVr1,
236        and have added extension capabilities to the string  table
237        that  (in the binary format) collide with System V and XSI
238        Curses extensions.  See <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG> for  detailed  discus-
239        sion of terminfo source compatibility issues.
240
241
242 </PRE>
243 <H2><a name="h2-EXAMPLE">EXAMPLE</a></H2><PRE>
244        As  an  example, here is a hex dump of the description for
245        the Lear-Siegler ADM-3, a  popular  though  rather  stupid
246        early terminal:
247
248        adm3a|lsi adm3a,
249                am,
250                cols#80, lines#24,
251                bel=^G, clear= 32$&lt;1&gt;, cr=^M, cub1=^H, cud1=^J,
252                cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K,
253                home=^^, ind=^J,
254
255        0000  1a 01 10 00 02 00 03 00  82 00 31 00 61 64 6d 33  ........ ..1.adm3
256        0010  61 7c 6c 73 69 20 61 64  6d 33 61 00 00 01 50 00  a|lsi ad m3a...P.
257        0020  ff ff 18 00 ff ff 00 00  02 00 ff ff ff ff 04 00  ........ ........
258        0030  ff ff ff ff ff ff ff ff  0a 00 25 00 27 00 ff ff  ........ ..%.'...
259        0040  29 00 ff ff ff ff 2b 00  ff ff 2d 00 ff ff ff ff  ).....+. ..-.....
260        0050  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ........ ........
261        0060  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ........ ........
262        0070  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ........ ........
263        0080  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ........ ........
264        0090  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ........ ........
265        00a0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ........ ........
266        00b0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ........ ........
267        00c0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ........ ........
268        00d0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ........ ........
269        00e0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ........ ........
270        00f0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ........ ........
271        0100  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ........ ........
272        0110  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ........ ........
273        0120  ff ff ff ff ff ff 2f 00  07 00 0d 00 1a 24 3c 31  ....../. .....$&lt;1
274        0130  3e 00 1b 3d 25 70 31 25  7b 33 32 7d 25 2b 25 63  &gt;..=%p1% {32}%+%c
275        0140  25 70 32 25 7b 33 32 7d  25 2b 25 63 00 0a 00 1e  %p2%{32} %+%c....
276        0150  00 08 00 0c 00 0b 00 0a  00                       ........ .
277
278
279
280 </PRE>
281 <H2><a name="h2-LIMITS">LIMITS</a></H2><PRE>
282        Some  limitations:  total  compiled  entries cannot exceed
283        4096 bytes.  The name field cannot exceed 128 bytes.
284
285
286 </PRE>
287 <H2><a name="h2-FILES">FILES</a></H2><PRE>
288        /usr/share/terminfo/*/*  compiled terminal capability data
289        base
290
291
292 </PRE>
293 <H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
294        <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>.
295
296
297 </PRE>
298 <H2><a name="h2-AUTHORS">AUTHORS</a></H2><PRE>
299        Thomas E. Dickey
300        extended terminfo format for ncurses 5.0
301        hashed database support for ncurses 5.6
302
303        Eric S. Raymond
304
305
306
307                                                                 <STRONG><A HREF="term.5.html">term(5)</A></STRONG>
308 </PRE>
309 <div class="nav">
310 <ul>
311 <li><a href="#h2-NAME">NAME</a></li>
312 <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li>
313 <li><a href="#h2-DESCRIPTION">DESCRIPTION</a>
314 <ul>
315 <li><a href="#h3-STORAGE-LOCATION">STORAGE LOCATION</a></li>
316 <li><a href="#h3-STORAGE-FORMAT">STORAGE FORMAT</a></li>
317 <li><a href="#h3-EXTENDED-STORAGE-FORMAT">EXTENDED STORAGE FORMAT</a></li>
318 </ul>
319 </li>
320 <li><a href="#h2-PORTABILITY">PORTABILITY</a></li>
321 <li><a href="#h2-EXAMPLE">EXAMPLE</a></li>
322 <li><a href="#h2-LIMITS">LIMITS</a></li>
323 <li><a href="#h2-FILES">FILES</a></li>
324 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>
325 <li><a href="#h2-AUTHORS">AUTHORS</a></li>
326 </ul>
327 </div>
328 </BODY>
329 </HTML>