+</PRE><H3><a name="h3-The-Terminal-State">The Terminal State</a></H3><PRE>
+ The <STRONG>setupterm</STRONG> routine stores its information about the terminal in a
+ <STRONG>TERMINAL</STRONG> structure pointed to by the global variable <STRONG>cur_term</STRONG>. If it
+ detects an error, or decides that the terminal is unsuitable (hardcopy
+ or generic), it discards this information, making it not available to
+ applications.
+
+ If <STRONG>setupterm</STRONG> is called repeatedly for the same terminal type, it will
+ reuse the information. It maintains only one copy of a given termi-
+ nal's capabilities in memory. If it is called for different terminal
+ types, <STRONG>setupterm</STRONG> allocates new storage for each set of terminal capa-
+ bilities.
+
+ The <STRONG>set_curterm</STRONG> routine sets <STRONG>cur_term</STRONG> to <EM>nterm</EM>, and makes all of the
+ <STRONG>terminfo</STRONG> boolean, numeric, and string variables use the values from
+ <EM>nterm</EM>. It returns the old value of <STRONG>cur_term</STRONG>.
+
+ The <STRONG>del_curterm</STRONG> routine frees the space pointed to by <EM>oterm</EM> and makes
+ it available for further use. If <EM>oterm</EM> is the same as <STRONG>cur_term</STRONG>, refer-
+ ences to any of the <STRONG>terminfo</STRONG> boolean, numeric, and string variables
+ thereafter may refer to invalid memory locations until another <STRONG>se-</STRONG>
+ <STRONG>tupterm</STRONG> has been called.
+
+ The <STRONG>restartterm</STRONG> routine is similar to <STRONG>setupterm</STRONG> and <STRONG>initscr</STRONG>, except
+ that it is called after restoring memory to a previous state (for exam-
+ ple, when reloading a game saved as a core image dump). <STRONG>restartterm</STRONG>
+ assumes that the windows and the input and output options are the same
+ as when memory was saved, but the terminal type and baud rate may be
+ different. Accordingly, <STRONG>restartterm</STRONG> saves various tty state bits,
+ calls <STRONG>setupterm</STRONG>, and then restores the bits.
+
+
+</PRE><H3><a name="h3-Formatting-Output">Formatting Output</a></H3><PRE>
+ The <STRONG>tparm</STRONG> routine instantiates the string <EM>str</EM> with parameters <EM>pi</EM>. A
+ pointer is returned to the result of <EM>str</EM> with the parameters applied.
+ Application developers should keep in mind these quirks of the inter-
+ face:
+
+ <STRONG>o</STRONG> Although <STRONG>tparm</STRONG>'s actual parameters may be integers or strings, the
+ prototype expects <STRONG>long</STRONG> (integer) values.
+
+ <STRONG>o</STRONG> Aside from the <STRONG>set_attributes</STRONG> (<STRONG>sgr</STRONG>) capability, most terminal capa-
+ bilities require no more than one or two parameters.
+
+ <STRONG>tiparm</STRONG> is a newer form of <STRONG>tparm</STRONG> which uses <EM><stdarg.h></EM> rather than a
+ fixed-parameter list. Its numeric parameters are integers (int) rather
+ than longs.
+
+
+</PRE><H3><a name="h3-Output-Functions">Output Functions</a></H3><PRE>
+ The <STRONG>tputs</STRONG> routine applies padding information to the string <EM>str</EM> and
+ outputs it:
+
+ <STRONG>o</STRONG> The <EM>str</EM> must be a terminfo string variable or the return value from
+ <STRONG>tparm</STRONG>, <STRONG>tgetstr</STRONG>, or <STRONG>tgoto</STRONG>.
+
+ <STRONG>o</STRONG> <EM>affcnt</EM> is the number of lines affected, or 1 if not applicable.
+
+ <STRONG>o</STRONG> <EM>putc</EM> is a <STRONG>putchar</STRONG>-like routine to which the characters are passed,
+ one at a time.
+
+ The <STRONG>putp</STRONG> routine calls <STRONG>tputs(</STRONG><EM>str</EM><STRONG>,</STRONG> <STRONG>1,</STRONG> <STRONG>putchar)</STRONG>. The output of <STRONG>putp</STRONG> al-
+ ways goes to <STRONG>stdout</STRONG>, rather than the <EM>filedes</EM> specified in <STRONG>setupterm</STRONG>.
+
+ The <STRONG>vidputs</STRONG> routine displays the string on the terminal in the video
+ attribute mode <EM>attrs</EM>, which is any combination of the attributes listed
+ in <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>. The characters are passed to the <STRONG>putchar</STRONG>-like routine
+ <EM>putc</EM>.
+
+ The <STRONG>vidattr</STRONG> routine is like the <STRONG>vidputs</STRONG> routine, except that it outputs
+ through <STRONG>putchar</STRONG>.
+
+ The <STRONG>vid_attr</STRONG> and <STRONG>vid_puts</STRONG> routines correspond to vidattr and vidputs,
+ respectively. They use a set of arguments for representing the video
+ attributes plus color, i.e.,
+
+ <STRONG>o</STRONG> <EM>attrs</EM> of type <STRONG>attr_t</STRONG> for the attributes and
+
+ <STRONG>o</STRONG> <EM>pair</EM> of type <STRONG>short</STRONG> for the color-pair number.
+
+ The <STRONG>vid_attr</STRONG> and <STRONG>vid_puts</STRONG> routines are designed to use the attribute
+ constants with the <EM>WA</EM><STRONG>_</STRONG> prefix.
+
+ X/Open Curses reserves the <EM>opts</EM> argument for future use, saying that
+ applications must provide a null pointer for that argument. As an ex-
+ tension, this implementation allows <EM>opts</EM> to be used as a pointer to
+ <STRONG>int</STRONG>, which overrides the <EM>pair</EM> (<STRONG>short</STRONG>) argument.
+
+ The <STRONG>mvcur</STRONG> routine provides low-level cursor motion. It takes effect
+ immediately (rather than at the next refresh).
+
+
+</PRE><H3><a name="h3-Terminal-Capability-Functions">Terminal Capability Functions</a></H3><PRE>
+ The <STRONG>tigetflag</STRONG>, <STRONG>tigetnum</STRONG> and <STRONG>tigetstr</STRONG> routines return the value of the
+ capability corresponding to the <STRONG>terminfo</STRONG> <EM>capname</EM> passed to them, such
+ as <STRONG>xenl</STRONG>. The <EM>capname</EM> for each capability is given in the table column
+ entitled <EM>capname</EM> code in the capabilities section of <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>.
+
+ These routines return special values to denote errors.
+
+ The <STRONG>tigetflag</STRONG> routine returns
+
+ <STRONG>-1</STRONG> if <EM>capname</EM> is not a boolean capability, or
+
+ <STRONG>0</STRONG> if it is canceled or absent from the terminal description.
+
+ The <STRONG>tigetnum</STRONG> routine returns
+
+ <STRONG>-2</STRONG> if <EM>capname</EM> is not a numeric capability, or
+
+ <STRONG>-1</STRONG> if it is canceled or absent from the terminal description.
+
+ The <STRONG>tigetstr</STRONG> routine returns
+
+ <STRONG>(char</STRONG> <STRONG>*)-1</STRONG>
+ if <EM>capname</EM> is not a string capability, or
+
+ <STRONG>0</STRONG> if it is canceled or absent from the terminal description.
+
+
+</PRE><H3><a name="h3-Terminal-Capability-Names">Terminal Capability Names</a></H3><PRE>
+ These null-terminated arrays contain
+
+ <STRONG>o</STRONG> the short terminfo names ("codes"),
+
+ <STRONG>o</STRONG> the <STRONG>termcap</STRONG> names ("names", and
+
+ <STRONG>o</STRONG> the long terminfo names ("fnames")
+
+ for each of the predefined <STRONG>terminfo</STRONG> variables:
+
+ <STRONG>const</STRONG> <STRONG>char</STRONG> <STRONG>*boolnames[]</STRONG>, <STRONG>*boolcodes[]</STRONG>, <STRONG>*boolfnames[]</STRONG>
+ <STRONG>const</STRONG> <STRONG>char</STRONG> <STRONG>*numnames[]</STRONG>, <STRONG>*numcodes[]</STRONG>, <STRONG>*numfnames[]</STRONG>
+ <STRONG>const</STRONG> <STRONG>char</STRONG> <STRONG>*strnames[]</STRONG>, <STRONG>*strcodes[]</STRONG>, <STRONG>*strfnames[]</STRONG>
+
+
+</PRE><H2><a name="h2-RETURN-VALUE">RETURN VALUE</a></H2><PRE>
+ Routines that return an integer return <STRONG>ERR</STRONG> upon failure and <STRONG>OK</STRONG> (SVr4
+ only specifies "an integer value other than <STRONG>ERR</STRONG>") upon successful com-
+ pletion, unless otherwise noted in the preceding routine descriptions.