1term(4) File Formats term(4)
2
3
4
6 term - format of compiled term file
7
9 /usr/share/lib/terminfo/?/*
10
11
13 The term file is compiled from terminfo(4) source files using tic(1M).
14 Compiled files are organized in a directory hierarchy under the first
15 letter of each terminal name. For example, the vt100 file would have
16 the pathname /usr/lib/terminfo/v/vt100. The default directory is
17 /usr/share/lib/terminfo. Synonyms for the same terminal are implemented
18 by multiple links to the same compiled file.
19
20
21 The format has been chosen so that it is the same on all hardware. An
22 8-bit byte is assumed, but no assumptions about byte ordering or sign
23 extension are made. Thus, these binary terminfo files can be trans‐
24 ported to other hardware with 8-bit bytes.
25
26
27 Short integers are stored in two 8-bit bytes. The first byte contains
28 the least significant 8 bits of the value, and the second byte contains
29 the most significant 8 bits. (Thus, the value represented is 256*sec‐
30 ond+first.) The value −1 is represented by 0377,0377, and the value −2
31 is represented by 0376,0377; other negative values are illegal. The −1
32 generally means that a capability is missing from this terminal. The −2
33 means that the capability has been cancelled in the terminfo source and
34 also is to be considered missing.
35
36
37 The compiled file is created from the source file descriptions of the
38 terminals (see the -I option of infocmp) by using the terminfo com‐
39 piler, tic, and read by the routine setupterm (see curses(3CURSES)).
40 The file is divided into six parts in the following order: the header,
41 terminal names, boolean flags, numbers, strings, and string table.
42
43
44 The header section begins the file six short integers in the format
45 described below. These integers are:
46
47 1. the magic number (octal 0432);
48
49 2. the size, in bytes, of the names section;
50
51 3. the number of bytes in the boolean section
52
53 4. the number of short integers in the numbers section;
54
55 5. the number of offsets (short integers) in the strings sec‐
56 tion;
57
58 6. the size, in bytes, of the string table.
59
60
61 The terminal name section comes next. It contains the first line of the
62 terminfo description, listing the various names for the terminal, sepa‐
63 rated by the bar ( | ) character (see term(5)). The section is termi‐
64 nated with an ASCII NUL character.
65
66
67 The terminal name section is followed by the Boolean section, number
68 section, string section, and string table.
69
70
71 The boolean flags section consists of one byte for each flag. This byte
72 is either 0 or 1 as the flag is present or absent. The value of 2 means
73 that the flag has been cancelled. The capabilities are in the same
74 order as the file <term.h>.
75
76
77 Between the boolean flags section and the number section, a null byte
78 is inserted, if necessary, to ensure that the number section begins on
79 an even byte offset. All short integers are aligned on a short word
80 boundary.
81
82
83 The numbers section is similar to the boolean flags section. Each capa‐
84 bility takes up two bytes, and is stored as a short integer. If the
85 value represented is −1 or −2, the capability is taken to be missing.
86
87
88 The strings section is also similar. Each capability is stored as a
89 short integer, in the format above. A value of −1 or −2 means the capa‐
90 bility is missing. Otherwise, the value is taken as an offset from the
91 beginning of the string table. Special characters in ^X or \c notation
92 are stored in their interpreted form, not the printing representation.
93 Padding information ($<nn>) and parameter information (%x) are stored
94 intact in uninterpreted form.
95
96
97 The final section is the string table. It contains all the values of
98 string capabilities referenced in the string section. Each string is
99 null terminated.
100
101
102 Note that it is possible for setupterm to expect a different set of
103 capabilities than are actually present in the file. Either the database
104 may have been updated since setupterm has been recompiled (resulting in
105 extra unrecognized entries in the file) or the program may have been
106 recompiled more recently than the database was updated (resulting in
107 missing entries). The routine setupterm must be prepared for both pos‐
108 sibilities—this is why the numbers and sizes are included. Also, new
109 capabilities must always be added at the end of the lists of boolean,
110 number, and string capabilities.
111
112
113 As an example, here is terminal information on the AT&T Model 37 KSR
114 terminal as output by the infocmp -I tty37 command:
115
116 37|tty37|AT&T model 37 teletype,
117 hc, os, xon,
118 bel=^G, cr=\r, cub1=\b, cud1=\n, cuu1=\E7, hd=\E9,
119 hu=\E8, ind=\n,
120
121
122
123
124 The following is an octal dump of the corresponding term file, produced
125 by the od -c /usr/share/lib/terminfo/t/tty37 command:
126
127 0000000 032 001 \0 032 \0 013 \0 021 001 3 \0 3 7 | t
128 0000020 t y 3 7 | A T & T m o d e l
129 0000040 3 7 t e l e t y p e \0 \0 \0 \0 \0
130 0000060 \0 \0 \0 001 \0 \0 \0 \0 \0 \0 \0 001 \0 \0 \0 \0
131 0000100 001 \0 \0 \0 \0 \0 377 377 377 377 377 377 377 377 377 377
132 0000120 377 377 377 377 377 377 377 377 377 377 377 377 377 377 & \0
133 0000140 \0 377 377 377 377 377 377 377 377 377 377 377 377 377 377
134 0000160 377 377 " \0 377 377 377 377 ( \0 377 377 377 377 377 377
135 0000200 377 377 0 \0 377 377 377 377 377 377 377 377 - \0 377 377
136 0000220 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377
137 *
138 0000520 377 377 377 377 377 377 377 377 377 377 377 377 377 377 $ \0
139 0000540 377 377 377 377 377 377 377 377 377 377 377 377 377 377 * \0
140 0000560 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377
141 *
142 0001160 377 377 377 377 377 377 377 377 377 377 377 377 377 377 3 7
143 0001200 | t t y 3 7 | A T & T m o d e
144 0001220 l 3 7 t e l e t y p e \0 \r \0
145 0001240 \n \0 \n \0 007 \0 \b \0 033 8 \0 033 9 \0 033 7
146 0001260 \0 \0
147 0001261
148
149
150
151
152 Some limitations: total compiled entries cannot exceed 4096 bytes; all
153 entries in the name field cannot exceed 128 bytes.
154
156 /usr/share/lib/terminfo/?/*
157
158 compiled terminal description database
159
160
161 /usr/include/term.h
162
163 terminfo header
164
165
166 /usr/xpg4/include/term.h
167
168 X/Open Curses terminfo header
169
170
172 infocmp(1M), curses(3CURSES), curses(3XCURSES), terminfo(4), term(5)
173
174
175
176SunOS 5.11 3 Jul 1996 term(4)