-</PRE>
-<H2>DESCRIPTION</H2><PRE>
- These low-level routines must be called by programs that
- have to deal directly with the <STRONG>terminfo</STRONG> database to handle
- certain terminal capabilities, such as programming func-
- tion keys. For all other functionality, <STRONG>curses</STRONG> routines
- are more suitable and their use is recommended.
-
- Initially, <STRONG>setupterm</STRONG> should be called. Note that <STRONG>se-</STRONG>
- <STRONG>tupterm</STRONG> is automatically called by <STRONG>initscr</STRONG> and <STRONG>newterm</STRONG>.
- This defines the set of terminal-dependent variables
- [listed in <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>]. The <STRONG>terminfo</STRONG> variables <STRONG>lines</STRONG> and
- <STRONG>columns</STRONG> are initialized by <STRONG>setupterm</STRONG> as follows:
-
- If <STRONG>use_env(FALSE)</STRONG> has been called, values for <STRONG>lines</STRONG>
- and <STRONG>columns</STRONG> specified in <STRONG>terminfo</STRONG> are used.
-
- Otherwise, if the environment variables <STRONG>LINES</STRONG> and
- <STRONG>COLUMNS</STRONG> exist, their values are used. If these en-
- vironment variables do not exist and the program is
- running in a window, the current window size is
- used. Otherwise, if the environment variables do
- not exist, the values for <STRONG>lines</STRONG> and <STRONG>columns</STRONG> speci-
- fied in the <STRONG>terminfo</STRONG> database are used.
-
- The header files <STRONG>curses.h</STRONG> and <STRONG>term.h</STRONG> should be included
- (in this order) to get the definitions for these strings,
- numbers, and flags. Parameterized strings should be
- passed through <STRONG>tparm</STRONG> to instantiate them. All <STRONG>terminfo</STRONG>
- strings [including the output of <STRONG>tparm</STRONG>] should be printed
- with <STRONG>tputs</STRONG> or <STRONG>putp</STRONG>. Call the <STRONG>reset_shell_mode</STRONG> to restore
- the tty modes before exiting [see <STRONG><A HREF="curs_kernel.3x.html">curs_kernel(3x)</A></STRONG>]. Pro-
- grams which use cursor addressing should output <STRONG>en-</STRONG>
- <STRONG>ter_ca_mode</STRONG> upon startup and should output <STRONG>exit_ca_mode</STRONG>
- before exiting. Programs desiring shell escapes should
- call
-
- <STRONG>reset_shell_mode</STRONG> and output <STRONG>exit_ca_mode</STRONG> before the shell
- is called and should output <STRONG>enter_ca_mode</STRONG> and call <STRONG>re-</STRONG>
- <STRONG>set_prog_mode</STRONG> after returning from the shell.
-
- The <STRONG>setupterm</STRONG> routine reads in the <STRONG>terminfo</STRONG> database, ini-
- tializing the <STRONG>terminfo</STRONG> structures, but does not set up the
- output virtualization structures used by <STRONG>curses</STRONG>. The ter-
- minal type is the character string <EM>term</EM>; if <EM>term</EM> is null,
- the environment variable <STRONG>TERM</STRONG> is used. All output is to
- file descriptor <STRONG>fildes</STRONG> which is initialized for output.
- If <EM>errret</EM> is not null, then <STRONG>setupterm</STRONG> returns <STRONG>OK</STRONG> or <STRONG>ERR</STRONG>
- and stores a status value in the integer pointed to by <EM>er-</EM>
- <EM>rret</EM>. A return value of <STRONG>OK</STRONG> combined with status of <STRONG>1</STRONG> in
- <EM>errret</EM> is normal. If <STRONG>ERR</STRONG> is returned, examine <EM>errret</EM>:
-
- <STRONG>1</STRONG> means that the terminal is hardcopy, cannot be
- used for curses applications.
-
- <STRONG>0</STRONG> means that the terminal could not be found, or
- that it is a generic type, having too little
- information for curses applications to run.
-
- <STRONG>-1</STRONG> means that the <STRONG>terminfo</STRONG> database could not be
- found.
-
- If <EM>errret</EM> is null, <STRONG>setupterm</STRONG> prints an error message upon
- finding an error and exits. Thus, the simplest call is:
-
- <STRONG>setupterm((char</STRONG> <STRONG>*)0,</STRONG> <STRONG>1,</STRONG> <STRONG>(int</STRONG> <STRONG>*)0);</STRONG>,
-
- which uses all the defaults and sends the output to <STRONG>std-</STRONG>
- <STRONG>out</STRONG>.
-
- The <STRONG>setterm</STRONG> routine is being replaced by <STRONG>setupterm</STRONG>. The
- call:
+</PRE><H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
+ These low-level routines must be called by programs that have to deal
+ directly with the <STRONG>terminfo</STRONG> database to handle certain terminal capabil-
+ ities, such as programming function keys. For all other functionality,
+ <STRONG>curses</STRONG> routines are more suitable and their use is recommended.
+
+
+</PRE><H3><a name="h3-Initialization">Initialization</a></H3><PRE>
+ Initially, <STRONG>setupterm</STRONG> should be called. The high-level curses functions
+ <STRONG>initscr</STRONG> and <STRONG>newterm</STRONG> call <STRONG>setupterm</STRONG> to initialize the low-level set of
+ terminal-dependent variables [listed in <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>].
+
+ Applications can use the terminal capabilities either directly (via
+ header definitions), or by special functions. The header files <STRONG>curs-</STRONG>
+ <STRONG>es.h</STRONG> and <STRONG>term.h</STRONG> should be included (in this order) to get the defini-
+ tions for these strings, numbers, and flags.
+
+ The <STRONG>terminfo</STRONG> variables <STRONG>lines</STRONG> and <STRONG>columns</STRONG> are initialized by <STRONG>setupterm</STRONG>
+ as follows:
+
+ <STRONG>o</STRONG> If <STRONG>use_env(FALSE)</STRONG> has been called, values for <STRONG>lines</STRONG> and <STRONG>columns</STRONG>
+ specified in <STRONG>terminfo</STRONG> are used.
+
+ <STRONG>o</STRONG> Otherwise, if the environment variables <STRONG>LINES</STRONG> and <STRONG>COLUMNS</STRONG> exist,
+ their values are used. If these environment variables do not exist
+ and the program is running in a window, the current window size is
+ used. Otherwise, if the environment variables do not exist, the
+ values for <STRONG>lines</STRONG> and <STRONG>columns</STRONG> specified in the <STRONG>terminfo</STRONG> database are
+ used.
+
+ Parameterized strings should be passed through <STRONG>tparm</STRONG> to instantiate
+ them. All <STRONG>terminfo</STRONG> strings (including the output of <STRONG>tparm</STRONG>) should be
+ printed with <STRONG>tputs</STRONG> or <STRONG>putp</STRONG>. Call <STRONG>reset_shell_mode</STRONG> to restore the tty
+ modes before exiting [see <STRONG><A HREF="curs_kernel.3x.html">curs_kernel(3x)</A></STRONG>].
+
+ Programs which use cursor addressing should
+
+ <STRONG>o</STRONG> output <STRONG>enter_ca_mode</STRONG> upon startup and
+
+ <STRONG>o</STRONG> output <STRONG>exit_ca_mode</STRONG> before exiting.
+
+ Programs which execute shell subprocesses should
+
+ <STRONG>o</STRONG> call <STRONG>reset_shell_mode</STRONG> and output <STRONG>exit_ca_mode</STRONG> before the shell is
+ called and
+
+ <STRONG>o</STRONG> output <STRONG>enter_ca_mode</STRONG> and call <STRONG>reset_prog_mode</STRONG> after returning from
+ the shell.
+
+ The <STRONG>setupterm</STRONG> routine reads in the <STRONG>terminfo</STRONG> database, initializing the
+ <STRONG>terminfo</STRONG> structures, but does not set up the output virtualization
+ structures used by <STRONG>curses</STRONG>. These are its parameters:
+
+ <EM>term</EM> is the terminal type, a character string. If <EM>term</EM> is null, the
+ environment variable <STRONG>TERM</STRONG> is used.
+
+ <EM>filedes</EM>
+ is the file descriptor used for all output.
+
+ <EM>errret</EM>
+ points to an optional location where an error status can be re-
+ turned to the caller. If <EM>errret</EM> is not null, then <STRONG>setupterm</STRONG>
+ returns <STRONG>OK</STRONG> or <STRONG>ERR</STRONG> and stores a status value in the integer
+ pointed to by <EM>errret</EM>. A return value of <STRONG>OK</STRONG> combined with sta-
+ tus of <STRONG>1</STRONG> in <EM>errret</EM> is normal.
+
+ If <STRONG>ERR</STRONG> is returned, examine <EM>errret</EM>:
+
+ <STRONG>1</STRONG> means that the terminal is hardcopy, cannot be used for
+ curses applications.
+
+ <STRONG>setupterm</STRONG> determines if the entry is a hardcopy type by
+ checking the <STRONG>hc</STRONG> (<STRONG>hardcopy</STRONG>) capability.
+
+ <STRONG>0</STRONG> means that the terminal could not be found, or that it is
+ a generic type, having too little information for curses
+ applications to run.
+
+ <STRONG>setupterm</STRONG> determines if the entry is a generic type by
+ checking the <STRONG>gn</STRONG> (<STRONG>generic</STRONG>) capability.
+
+ <STRONG>-1</STRONG> means that the <STRONG>terminfo</STRONG> database could not be found.
+
+ If <EM>errret</EM> is null, <STRONG>setupterm</STRONG> prints an error message upon find-
+ ing an error and exits. Thus, the simplest call is:
+
+ <STRONG>setupterm((char</STRONG> <STRONG>*)0,</STRONG> <STRONG>1,</STRONG> <STRONG>(int</STRONG> <STRONG>*)0);</STRONG>,
+
+ which uses all the defaults and sends the output to <STRONG>stdout</STRONG>.
+
+ The <STRONG>setterm</STRONG> routine was replaced by <STRONG>setupterm</STRONG>. The call: