term.5.html 14 KB

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