1curs_initscr(3CURSES) Curses Library Functions curs_initscr(3CURSES)
2
3
4
6 curs_initscr, initscr, newterm, endwin, isendwin, set_term, delscreen -
7 curses screen initialization and manipulation routines
8
10 cc [ flag ... ] file ... -lcurses [ library ... ]
11 #include <curses.h>
12
13 WINDOW *initscr(void);
14
15
16 int endwin(void);
17
18
19 int isendwin(void);
20
21
22 SCREEN *newterm(char *type, FILE *outfd, FILE *infd);
23
24
25 SCREEN *set_term(SCREEN *new);
26
27
28 void delscreen(SCREEN * sp);
29
30
32 initscr() is almost always the first routine that should be called (the
33 exceptions are slk_init(), filter(), ripoffline(), use_env() and, for
34 multiple-terminal applications, newterm().) This determines the termi‐
35 nal type and initializes all curses data structures. initscr() also
36 causes the first call to refresh() to clear the screen. If errors
37 occur, initscr() writes an appropriate error message to standard error
38 and exits; otherwise, a pointer is returned to stdscr(). If the program
39 needs an indication of error conditions, newterm() should be used
40 instead of initscr(); initscr() should only be called once per appli‐
41 cation.
42
43
44 A program that outputs to more than one terminal should use the
45 newterm() routine for each terminal instead of initscr(). A program
46 that needs an indication of error conditions, so it can continue to run
47 in a line-oriented mode if the terminal cannot support a screen-ori‐
48 ented program, would also use this routine. The routine newterm()
49 should be called once for each terminal. It returns a variable of type
50 SCREEN * which should be saved as a reference to that terminal. The
51 arguments are the type of the terminal to be used in place of $TERM, a
52 file pointer for output to the terminal, and another file pointer for
53 input from the terminal (if type is NULL, $TERM will be used). The
54 program must also call endwin() for each terminal being used before
55 exiting from curses. If newterm() is called more than once for the same
56 terminal, the first terminal referred to must be the last one for which
57 endwin() is called.
58
59
60 A program should always call endwin() before exiting or escaping from
61 curses mode temporarily. This routine restores tty modes, moves the
62 cursor to the lower left-hand corner of the screen and resets the ter‐
63 minal into the proper non-visual mode. Calling refresh() or doupdate()
64 after a temporary escape causes the program to resume visual mode.
65
66
67 The isendwin() routine returns TRUE if endwin() has been called without
68 any subsequent calls to wrefresh(), and FALSE otherwise.
69
70
71 The set_term() routine is used to switch between different terminals.
72 The screen reference new becomes the new current terminal. The previous
73 terminal is returned by the routine. This is the only routine which
74 manipulates SCREEN pointers; all other routines affect only the current
75 terminal.
76
77
78 The delscreen() routine frees storage associated with the SCREEN data
79 structure. The endwin() routine does not do this, so delscreen()
80 should be called after endwin() if a particular SCREEN is no longer
81 needed.
82
84 endwin() returns the integer ERR upon failure and OK upon successful
85 completion.
86
87
88 Routines that return pointers always return NULL on error.
89
91 See attributes(5) for descriptions of the following attributes:
92
93
94
95
96 ┌─────────────────────────────┬─────────────────────────────┐
97 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
98 ├─────────────────────────────┼─────────────────────────────┤
99 │MT-Level │Unsafe │
100 └─────────────────────────────┴─────────────────────────────┘
101
103 curs_kernel(3CURSES), curs_refresh(3CURSES), curs_slk(3CURSES),
104 curs_util(3CURSES), curses(3CURSES), attributes(5)
105
107 The header <curses.h> automatically includes the headers <stdio.h> and
108 <unctrl.h>.
109
110
111 Note that initscr() and newterm() may be macros.
112
113
114
115SunOS 5.11 31 Dec 1996 curs_initscr(3CURSES)