]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/curs_initscr.3x
ncurses 4.1
[ncurses.git] / man / curs_initscr.3x
1 .TH curs_initscr 3X ""
2 .SH NAME
3 \fBinitscr\fR, \fBnewterm\fR, \fBendwin\fR,
4 \fBisendwin\fR, \fBset_term\fR, \fBdelscreen\fR - \fBcurses\fR screen
5 initialization and manipulation routines
6 .SH SYNOPSIS
7 \fB#include <curses.h>\fR
8
9 \fBWINDOW *initscr(void);\fR
10 .br
11 \fBint endwin(void);\fR
12 .br
13 \fBint isendwin(void);\fR
14 .br
15 \fBSCREEN *newterm(const char *type, FILE *outfd, FILE *infd);\fR
16 .br
17 \fBSCREEN *set_term(SCREEN *new);\fR
18 .br
19 \fBvoid delscreen(SCREEN* sp);\fR
20 .br
21 .SH DESCRIPTION
22 \fBinitscr\fR is normally the first \fBcurses\fR routine to call when
23 initializing a program.  A few special routines sometimes need to be
24 called before it; these are \fBslk_init\fR, \fBfilter\fR, \fBripoffline\fR,
25 \fBuse_env\fR.  For multiple-terminal applications, \fBnewterm\fR may be
26 called before \fBinitscr\fR.
27
28 The initscr code determines the terminal type and initializes all \fBcurses\fR
29 data structures.  \fBinitscr\fR also causes the first call to \fBrefresh\fR to
30 clear the screen.  If errors occur, \fBinitscr\fR writes an appropriate error
31 message to standard error and exits; otherwise, a pointer is returned to
32 \fBstdscr\fR.
33
34 A program that outputs to more than one terminal should use the \fBnewterm\fR
35 routine for each terminal instead of \fBinitscr\fR.  A program that needs to
36 inspect capabilities, so it can continue to run in a line-oriented mode if the
37 terminal cannot support a screen-oriented program, would also use
38 \fBnewterm\fR.  The routine \fBnewterm\fR should be called once for each
39 terminal.  It returns a variable of type \fBSCREEN *\fR which should be saved
40 as a reference to that terminal.  The arguments are the \fItype\fR of the
41 terminal to be used in place of \fB$TERM\fR, a file pointer for output to the
42 terminal, and another file pointer for input from the terminal (if \fItype\fR
43 is \fBNULL\fR, \fB$TERM\fR will be used).  The program must also call
44 \fBendwin\fR for each terminal being used before exiting from \fBcurses\fR.
45 If \fBnewterm\fR is called more than once for the same terminal, the first
46 terminal referred to must be the last one for which \fBendwin\fR is called.
47
48 A program should always call \fBendwin\fR before exiting or escaping from
49 \fBcurses\fR mode temporarily.  This routine restores tty modes, moves the
50 cursor to the lower left-hand corner of the screen and resets the terminal into
51 the proper non-visual mode.  Calling \fBrefresh\fR or \fBdoupdate\fR after a
52 temporary escape causes the program to resume visual mode.
53
54 The \fBisendwin\fR routine returns \fBTRUE\fR if \fBendwin\fR has been
55 called without any subsequent calls to \fBwrefresh\fR, and \fBFALSE\fR
56 otherwise.
57
58 The \fBset_term\fR routine is used to switch between different
59 terminals.  The screen reference \fBnew\fR becomes the new current
60 terminal.  The previous terminal is returned by the routine.  This is
61 the only routine which manipulates \fBSCREEN\fR pointers; all other
62 routines affect only the current terminal.
63
64 The \fBdelscreen\fR routine frees storage associated with the
65 \fBSCREEN\fR data structure.  The \fBendwin\fR routine does not do
66 this, so \fBdelscreen\fR should be called after \fBendwin\fR if a
67 particular \fBSCREEN\fR is no longer needed.
68 .SH RETURN VALUE
69 \fBendwin\fR returns the integer \fBERR\fR upon failure and \fBOK\fR
70 upon successful completion.
71
72 Routines that return pointers always return \fBNULL\fR on error.
73 .SH NOTES
74 Note that \fBinitscr\fR and \fBnewterm\fR may be macros.
75 .SH PORTABILITY
76 These functions are described in the XSI Curses standard, Issue 4.  It
77 specifies that portable applications must not call \fBinitscr\fR more than
78 once.
79 .SH SEE ALSO
80 \fBcurses\fR(3X), \fBcurs_kernel\fR(3X), \fBcurs_refresh\fR(3X),
81 \fBcurs_slk\fR(3X), \fBcurs_util\fR(3X)
82 .\"#
83 .\"# The following sets edit modes for GNU EMACS
84 .\"# Local Variables:
85 .\"# mode:nroff
86 .\"# fill-column:79
87 .\"# End: