-</PRE>
-<H2>DESCRIPTION</H2><PRE>
- <STRONG>STORAGE</STRONG> <STRONG>LOCATION</STRONG>
- Compiled terminfo descriptions are placed under the direc-
- tory <STRONG>/usr/share/terminfo</STRONG>. Two configurations are sup-
- ported (when building the ncurses libraries):
-
- <STRONG>directory</STRONG> <STRONG>tree</STRONG>
- A two-level scheme is used to avoid a linear search
- of a huge UNIX system directory: <STRONG>/usr/share/ter-</STRONG>
- <STRONG>minfo/c/name</STRONG> where <EM>name</EM> is the name of the terminal,
- and <EM>c</EM> is the first character of <EM>name</EM>. Thus, <EM>act4</EM> can
- be found in the file <STRONG>/usr/share/terminfo/a/act4</STRONG>.
- Synonyms for the same terminal are implemented by
- multiple links to the same compiled file.
-
- <STRONG>hashed</STRONG> <STRONG>database</STRONG>
- Using Berkeley database, two types of records are
- stored: the terminfo data in the same format as
- stored in a directory tree with the terminfo's pri-
- mary name as a key, and records containing only
- aliases pointing to the primary name.
-
- If built to write hashed databases, ncurses can still
- read terminfo databases organized as a directory
- tree, but cannot write entries into the directory
- tree. It can write (or rewrite) entries in the
- hashed database.
-
- ncurses distinguishes the two cases in the TERMINFO
- and TERMINFO_DIRS environment variable by assuming a
- directory tree for entries that correspond to an
- existing directory, and hashed database otherwise.
-
- <STRONG>STORAGE</STRONG> <STRONG>FORMAT</STRONG>
- The format has been chosen so that it will be the same on
- all hardware. An 8 or more bit byte is assumed, but no
- assumptions about byte ordering or sign extension are
- made.
-
- The compiled file is created with the <STRONG>tic</STRONG> program, and
- read by the routine <EM>setupterm</EM>. The file is divided into
- six parts: the header, terminal names, boolean flags, num-
- bers, strings, and string table.
-
- The header section begins the file. This section contains
- six short integers in the format described below. These
- integers are
-
- (1) the magic number (octal 0432);
-
- (2) the size, in bytes, of the names section;
-
- (3) the number of bytes in the boolean section;
-
- (4) the number of short integers in the numbers sec-
- tion;
-
- (5) the number of offsets (short integers) in the
- strings section;
-
- (6) the size, in bytes, of the string table.
-
- Short integers are stored in two 8-bit bytes. The first
- byte contains the least significant 8 bits of the value,
- and the second byte contains the most significant 8 bits.
- (Thus, the value represented is 256*second+first.) The
- value -1 is represented by the two bytes 0377, 0377; other
- negative values are illegal. This value generally means
- that the corresponding capability is missing from this
- terminal. Note that this format corresponds to the hard-
- ware of the VAX and PDP-11 (that is, little-endian
- machines). Machines where this does not correspond to the
- hardware must read the integers as two bytes and compute
- the little-endian value.
-
- The terminal names section comes next. It contains the
- first line of the terminfo description, listing the vari-
- ous names for the terminal, separated by the `|' charac-
- ter. The section is terminated with an ASCII NUL charac-
- ter.
-
- The boolean flags have one byte for each flag. This byte
- is either 0 or 1 as the flag is present or absent. The
- capabilities are in the same order as the file <term.h>.
-
- Between the boolean section and the number section, a null
- byte will be inserted, if necessary, to ensure that the
- number section begins on an even byte (this is a relic of
- the PDP-11's word-addressed architecture, originally
- designed in to avoid IOT traps induced by addressing a
- word on an odd byte boundary). All short integers are
- aligned on a short word boundary.
-
- The numbers section is similar to the flags section. Each
- capability takes up two bytes, and is stored as a little-
- endian short integer. If the value represented is -1, the
- capability is taken to be missing.
-
- The strings section is also similar. Each capability is
- stored as a short integer, in the format above. A value
- of -1 means the capability is missing. Otherwise, the
- value is taken as an offset from the beginning of the
- string table. Special characters in ^X or \c notation are
- stored in their interpreted form, not the printing repre-
- sentation. Padding information $<nn> and parameter infor-
- mation %x are stored intact in uninterpreted form.
-
- The final section is the string table. It contains all
- the values of string capabilities referenced in the string
- section. Each string is null terminated.
-
- <STRONG>EXTENDED</STRONG> <STRONG>STORAGE</STRONG> <STRONG>FORMAT</STRONG>
- The previous section describes the conventional terminfo
- binary format. With some minor variations of the offsets
- (see PORTABILITY), the same binary format is used in all
- modern UNIX systems. Each system uses a predefined set of
- boolean, number or string capabilities.
-
- The ncurses libraries and applications support extended
- terminfo binary format, allowing users to define capabili-
- ties which are loaded at runtime. This extension is made
- possible by using the fact that the other implementations
- stop reading the terminfo data when they have reached the
- end of the size given in the header. ncurses checks the
- size, and if it exceeds that due to the predefined data,
- continues to parse according to its own scheme.
+</PRE><H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
+
+</PRE><H3><a name="h3-STORAGE-LOCATION">STORAGE LOCATION</a></H3><PRE>
+ Compiled terminfo descriptions are placed under the directory
+ <B>/usr/share/terminfo</B>. Two configurations are supported (when building
+ the <B>ncurses</B> libraries):
+
+ <B>directory</B> <B>tree</B>
+ A two-level scheme is used to avoid a linear search of a huge UNIX
+ system directory: <B>/usr/share/terminfo/c/name</B> where <I>name</I> is the
+ name of the terminal, and <I>c</I> is the first character of <I>name</I>. Thus,
+ <I>act4</I> can be found in the file <B>/usr/share/terminfo/a/act4</B>.
+ Synonyms for the same terminal are implemented by multiple links
+ to the same compiled file.
+
+ <B>hashed</B> <B>database</B>
+ Using Berkeley database, two types of records are stored: the
+ terminfo data in the same format as stored in a directory tree
+ with the terminfo's primary name as a key, and records containing
+ only aliases pointing to the primary name.
+
+ If built to write hashed databases, <B>ncurses</B> can still read
+ terminfo databases organized as a directory tree, but cannot write
+ entries into the directory tree. It can write (or rewrite)
+ entries in the hashed database.
+
+ <B>ncurses</B> distinguishes the two cases in the TERMINFO and
+ TERMINFO_DIRS environment variable by assuming a directory tree
+ for entries that correspond to an existing directory, and hashed
+ database otherwise.
+
+
+</PRE><H3><a name="h3-LEGACY-STORAGE-FORMAT">LEGACY STORAGE FORMAT</a></H3><PRE>
+ The format has been chosen so that it will be the same on all hardware.
+ An 8 or more bit byte is assumed, but no assumptions about byte
+ ordering or sign extension are made.
+
+ The compiled file is created with the <B>tic</B> program, and read by the
+ routine <B><A HREF="curs_terminfo.3X.html">setupterm(3X)</A></B>. The file is divided into six parts:
+
+ a) <I>header</I>,
+
+ b) <I>terminal</I> <I>names</I>,
+
+ c) <I>boolean</I> <I>flags</I>,
+
+ d) <I>numbers</I>,
+
+ e) <I>strings</I>, and
+
+ f) <I>string</I> <I>table</I>.
+
+ The <I>header</I> section begins the file. This section contains six short
+ integers in the format described below. These integers are
+
+ (1) the <I>magic</I> <I>number</I> (octal 0432);
+
+ (2) the size, in bytes, of the <I>terminal</I> <I>names</I> section;
+
+ (3) the number of bytes in the <I>boolean</I> <I>flags</I> section;
+
+ (4) the number of short integers in the <I>numbers</I> section;
+
+ (5) the number of offsets (short integers) in the <I>strings</I> section;
+
+ (6) the size, in bytes, of the <I>string</I> <I>table</I>.
+
+ The capabilities in the <I>boolean</I> <I>flags</I>, <I>numbers</I>, and <I>strings</I> sections
+ are in the same order as the file <term.h>.
+
+ Short integers are signed, in the range -32768 to 32767. They are
+ stored as two 8-bit bytes. The first byte contains the least
+ significant 8 bits of the value, and the second byte contains the most
+ significant 8 bits. (Thus, the value represented is 256*second+first.)
+ This format corresponds to the hardware of the VAX and PDP-11 (that is,
+ little-endian machines). Machines where this does not correspond to
+ the hardware must read the integers as two bytes and compute the
+ little-endian value.
+
+ Numbers in a terminal description, whether they are entries in the
+ <I>numbers</I> or <I>strings</I> table, are positive integers. Boolean flags are
+ treated as positive one-byte integers. In each case, those positive
+ integers represent a terminal capability. The terminal compiler tic
+ uses negative integers to handle the cases where a capability is not
+ available:
+
+ <B>o</B> If a capability is absent from this terminal, tic stores a -1 in
+ the corresponding table.
+
+ The integer value -1 is represented by two bytes 0377, 0377.
+ Absent boolean values are represented by the byte 0 (false).
+
+ <B>o</B> If a capability has been canceled from this terminal, tic stores a
+ -2 in the corresponding table.
+
+ The integer value -2 is represented by two bytes 0377, 0376.
+ The boolean value -2 is represented by the byte 0376.
+
+ <B>o</B> Other negative values are illegal.
+
+ The <I>terminal</I> <I>names</I> section comes after the <I>header</I>. It contains the
+ first line of the terminfo description, listing the various names for
+ the terminal, separated by the "|" character. The <I>terminal</I> <I>names</I>
+ section is terminated with an ASCII NUL character.
+
+ The <I>boolean</I> <I>flags</I> section has one byte for each flag. Boolean
+ capabilities are either 1 or 0 (true or false) according to whether the
+ terminal supports the given capability or not.
+
+ Between the <I>boolean</I> <I>flags</I> section and the <I>number</I> section, a null byte
+ will be inserted, if necessary, to ensure that the <I>number</I> section
+ begins on an even byte This is a relic of the PDP-11's word-addressed
+ architecture, originally designed to avoid traps induced by addressing
+ a word on an odd byte boundary. All short integers are aligned on a
+ short word boundary.
+
+ The <I>numbers</I> section is similar to the <I>boolean</I> <I>flags</I> section. Each
+ capability takes up two bytes, and is stored as a little-endian short
+ integer.
+
+ The <I>strings</I> section is also similar. Each capability is stored as a
+ short integer. The capability value is an index into the <I>string</I> <I>table</I>.
+
+ The <I>string</I> <I>table</I> is the last section. It contains all of the values of
+ string capabilities referenced in the <I>strings</I> section. Each string is
+ null-terminated. Special characters in ^X or \c notation are stored in
+ their interpreted form, not the printing representation. Padding
+ information $<nn> and parameter information %x are stored intact in
+ uninterpreted form.
+
+
+</PRE><H3><a name="h3-EXTENDED-STORAGE-FORMAT">EXTENDED STORAGE FORMAT</a></H3><PRE>
+ The previous section describes the conventional terminfo binary format.
+ With some minor variations of the offsets (see PORTABILITY), the same
+ binary format is used in all modern UNIX systems. Each system uses a
+ predefined set of boolean, number or string capabilities.
+
+ The <B>ncurses</B> libraries and applications support extended terminfo binary
+ format, allowing users to define capabilities which are loaded at
+ runtime. This extension is made possible by using the fact that the
+ other implementations stop reading the terminfo data when they have
+ reached the end of the size given in the header. <B>ncurses</B> checks the
+ size, and if it exceeds that due to the predefined data, continues to
+ parse according to its own scheme.