1curs_kernel(3CURSES) Curses Library Functions curs_kernel(3CURSES)
2
3
4
6 curs_kernel, def_prog_mode, def_shell_mode, reset_prog_mode,
7 reset_shell_mode, resetty, savetty, getsyx, setsyx, ripoffline,
8 curs_set, napms - low-level curses routines
9
11 cc [ flag ... ] file ... -lcurses [ library ... ]
12 #include <curses.h>
13
14 int def_prog_mode(void);
15
16
17 int def_shell_mode(void);
18
19
20 int reset_prog_mode(void);
21
22
23 int reset_shell_mode(void);
24
25
26 int resetty(void);
27
28
29 int savetty(void);
30
31
32 int getsyx(int y, int x);
33
34
35 int setsyx(int y, int x);
36
37
38 int ripoffline(int line, int (*init)(WINDOW *, int));
39
40
41 int curs_set(int visibility);
42
43
44 int napms(int ms);
45
46
48 The following routines give low-level access to various curses func‐
49 tionality. Theses routines typically are used inside library routines.
50
51
52 The def_prog_mode() and def_shell_mode() routines save the current ter‐
53 minal modes as the ``program'' (in curses) or ``shell'' (not in curses
54 ) state for use by the reset_prog_mode() and reset_shell_mode() rou‐
55 tines. This is done automatically by initscr().
56
57
58 The reset_prog_mode() and reset_shell_mode() routines restore the ter‐
59 minal to ``program'' (in curses) or ``shell'' (out of curses) state.
60 These are done automatically by endwin() and, after an endwin(), by
61 doupdate(), so they normally are not called.
62
63
64 The resetty() and savetty() routines save and restore the state of the
65 terminal modes. savetty() saves the current state in a buffer and
66 resetty() restores the state to what it was at the last call to
67 savetty().
68
69
70 With the getsyx() routine, the current coordinates of the virtual
71 screen cursor are returned in y and x. If leaveok() is currently TRUE,
72 then −1,−1 is returned. If lines have been removed from the top of the
73 screen, using ripoffline(), y and x include these lines; therefore, y
74 and x should be used only as arguments for setsyx().
75
76
77 With the setsyx() routine, the virtual screen cursor is set to y, x. If
78 y and x are both −1, then leaveok() is set. The two routines getsyx()
79 and setsyx() are designed to be used by a library routine, which manip‐
80 ulates curses windows but does not want to change the current position
81 of the program's cursor. The library routine would call getsyx() at the
82 beginning, do its manipulation of its own windows, do a wnoutrefresh()
83 on its windows, call setsyx(), and then call doupdate().
84
85
86 The ripoffline() routine provides access to the same facility that
87 slk_init() (see curs_slk(3CURSES)) uses to reduce the size of the
88 screen. ripoffline() must be called before initscr() or newterm() is
89 called. If line is positive, a line is removed from the top of std‐
90 scr(); if line is negative, a line is removed from the bottom. When
91 this is done inside initscr(), the routine init() (supplied by the
92 user) is called with two arguments: a window pointer to the one-line
93 window that has been allocated and an integer with the number of col‐
94 umns in the window. Inside this initialization routine, the integer
95 variables LINES and COLS (defined in <curses.h>) are not guaranteed to
96 be accurate and wrefresh() or doupdate() must not be called. It is
97 allowable to call wnoutrefresh() during the initialization routine.
98
99
100 ripoffline() can be called up to five times before calling initscr() or
101 newterm().
102
103
104 With the curs_set() routine, the cursor state is set to invisible, nor‐
105 mal, or very visible for visibility equal to 0, 1, or 2 respectively.
106 If the terminal supports the visibility requested, the previous cur‐
107 sor state is returned; otherwise, ERR is returned.
108
109
110 The napms() routine is used to sleep for ms milliseconds.
111
113 Except for curs_set(), these routines always return OK. curs_set()
114 returns the previous cursor state, or ERR if the requested visibility
115 is not supported.
116
118 See attributes(5) for descriptions of the following attributes:
119
120
121
122
123 ┌─────────────────────────────┬─────────────────────────────┐
124 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
125 ├─────────────────────────────┼─────────────────────────────┤
126 │MT-Level │Unsafe │
127 └─────────────────────────────┴─────────────────────────────┘
128
130 curs_initscr(3CURSES), curs_outopts(3CURSES), curs_refresh(3CURSES),
131 curs_scr_dump(3CURSES), curs_slk(3CURSES), curses(3CURSES),
132 attributes(5)
133
135 The header <curses.h> automatically includes the headers <stdio.h> and
136 <unctrl.h>.
137
138
139 Note that getsyx() is a macro, so an ampersand (&) is not necessary
140 before the variables y and x.
141
142
143
144SunOS 5.11 31 Dec 1996 curs_kernel(3CURSES)