+ <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.