+</PRE><H3><a name="h3-initscr">initscr</a></H3><PRE>
+ <B>initscr</B> is normally the first <B>curses</B> routine to call when initializing
+ a program. A few special routines sometimes need to be called before
+ it; these are <B><A HREF="curs_slk.3X.html">slk_init(3X)</A></B>, <B>filter</B>, <B>ripoffline</B>, <B>use_env</B>. For multiple-
+ terminal applications, <B>newterm</B> may be called before <B>initscr</B>.
+
+ The initscr code determines the terminal type and initializes all <B>curs-</B>
+ <B>es</B> data structures. <B>initscr</B> also causes the first call to <B><A HREF="curscurs_refresh.3X.html">refresh(3X)</A></B>
+ to clear the screen. If errors occur, <B>initscr</B> writes an appropriate
+ error message to standard error and exits; otherwise, a pointer is re-
+ turned to <B>stdscr</B>.
+
+
+</PRE><H3><a name="h3-newterm">newterm</a></H3><PRE>
+ A program that outputs to more than one terminal should use the <B>newterm</B>
+ routine for each terminal instead of <B>initscr</B>. A program that needs to
+ inspect capabilities, so it can continue to run in a line-oriented mode
+ if the terminal cannot support a screen-oriented program, would also
+ use <B>newterm</B>. The routine <B>newterm</B> should be called once for each termi-
+ nal. It returns a variable of type <B>SCREEN</B> <B>*</B> which should be saved as a
+ reference to that terminal. <B>newterm</B>'s arguments are
+
+ <B>o</B> the <I>type</I> of the terminal to be used in place of <B>$TERM</B>,
+
+ <B>o</B> a file pointer for output to the terminal, and
+
+ <B>o</B> another file pointer for input from the terminal
+
+ If the <I>type</I> parameter is <B>NULL</B>, <B>$TERM</B> will be used.
+
+
+</PRE><H3><a name="h3-endwin">endwin</a></H3><PRE>
+ The program must also call <B>endwin</B> for each terminal being used before
+ exiting from <B>curses</B>. If <B>newterm</B> is called more than once for the same
+ terminal, the first terminal referred to must be the last one for which
+ <B>endwin</B> is called.
+
+ A program should always call <B>endwin</B> before exiting or escaping from
+ <B>curses</B> mode temporarily. This routine
+
+ <B>o</B> resets colors to correspond with the default color pair 0,
+
+ <B>o</B> moves the cursor to the lower left-hand corner of the screen,
+
+ <B>o</B> clears the remainder of the line so that it uses the default col-
+ ors,
+
+ <B>o</B> sets the cursor to normal visibility (see <B><A HREF="curs_kernel.3X.html">curs_set(3X)</A></B>),
+
+ <B>o</B> stops cursor-addressing mode using the <I>exit</I><B>_</B><I>ca</I><B>_</B><I>mode</I> terminal capa-
+ bility,
+
+ <B>o</B> restores tty modes (see <B><A HREF="curs_kernel.3X.html">reset_shell_mode(3X)</A></B>).
+
+ Calling <B><A HREF="curs_refresh.3X.html">refresh(3X)</A></B> or <B><A HREF="curs_refresh.3X.html">doupdate(3X)</A></B> after a temporary escape causes the
+ program to resume visual mode.
+
+
+</PRE><H3><a name="h3-isendwin">isendwin</a></H3><PRE>
+ The <B>isendwin</B> routine returns <B>TRUE</B> if <B>endwin</B> has been called without any
+ subsequent calls to <B>wrefresh</B>, and <B>FALSE</B> otherwise.
+
+
+</PRE><H3><a name="h3-set_term">set_term</a></H3><PRE>
+ The <B>set_term</B> routine is used to switch between different terminals.
+ The screen reference <B>new</B> becomes the new current terminal. The previ-
+ ous terminal is returned by the routine. This is the only routine
+ which manipulates <B>SCREEN</B> pointers; all other routines affect only the
+ current terminal.
+
+
+</PRE><H3><a name="h3-delscreen">delscreen</a></H3><PRE>
+ The <B>delscreen</B> routine frees storage associated with the <B>SCREEN</B> data
+ structure. The <B>endwin</B> routine does not do this, so <B>delscreen</B> should be
+ called after <B>endwin</B> if a particular <B>SCREEN</B> is no longer needed.
+
+
+</PRE><H2><a name="h2-RETURN-VALUE">RETURN VALUE</a></H2><PRE>
+ <B>endwin</B> returns the integer <B>ERR</B> upon failure and <B>OK</B> upon successful com-
+ pletion.