2 .\" Copyright 1989 AT&T
3 .\" Portions Copyright (c) 1996, Sun Microsystems, Inc. All Rights Reserved.
4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
5 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
6 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
7 .TH CURS_INOPTS 3CURSES "Dec 31, 1996"
9 curs_inopts, cbreak, nocbreak, echo, noecho, halfdelay, intrflush, keypad,
10 meta, nodelay, notimeout, raw, noraw, noqiflush, qiflush, timeout, wtimeout,
11 typeahead \- curses terminal input option control routines
15 \fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-lcurses\fR [ \fIlibrary\fR ... ]
18 \fBint\fR \fBcbreak\fR(\fBvoid\fR);
23 \fBint\fR \fBnocbreak\fR(\fBvoid\fR);
28 \fBint\fR \fBecho\fR(\fBvoid\fR);
33 \fBint\fR \fBnoecho\fR(\fBvoid\fR);
38 \fBint\fR \fBhalfdelay\fR(\fBint\fR \fItenths\fR);
43 \fBint\fR \fBintrflush\fR(\fBWINDOW *\fR\fIwin\fR, \fBbool\fR \fIbf\fR);
48 \fBint\fR \fBkeypad\fR(\fBWINDOW *\fR\fIwin\fR, \fBbool\fR \fIbf\fR);
53 \fBint\fR \fBmeta\fR(\fBWINDOW *\fR\fIwin\fR, \fBbool\fR \fIbf\fR);
58 \fBint\fR \fBnodelay\fR(\fBWINDOW *\fR\fIwin\fR, \fBbool\fR \fIbf\fR);
63 \fBint\fR \fBnotimeout\fR(\fBWINDOW *\fR\fIwin\fR, \fBbool\fR \fIbf\fR);
68 \fBint\fR \fBraw\fR(\fBvoid\fR);
73 \fBint\fR \fBnoraw\fR(\fBvoid\fR);
78 \fBvoid\fR \fBnoqiflush\fR(\fBvoid\fR);
83 \fBvoid\fR \fBqiflush\fR(\fBvoid\fR);
88 \fBvoid\fR \fBtimeout\fR(\fBint\fR \fIdelay\fR);
93 \fBvoid\fR \fBwtimeout\fR(\fBWINDOW *\fR\fIwin\fR, \fBint\fR \fIdelay\fR);
98 \fBint\fR \fBtypeahead\fR(\fBint\fR \fIfildes\fR);
104 The \fBcbreak()\fR and \fBnocbreak()\fR routines put the terminal into and out
105 of \fBcbreak()\fR mode, respectively. In this mode, characters typed by the
106 user are immediately available to the program, and erase/kill
107 character-processing is not performed. When out of this mode, the tty driver
108 buffers the typed characters until a newline or carriage return is typed.
109 Interrupt and flow control characters are unaffected by this mode. Initially
110 the terminal may or may not be in \fBcbreak()\fR mode, as the mode is
111 inherited; therefore, a program should call \fBcbreak()\fR or \fBnocbreak()\fR
112 explicitly. Most interactive programs using \fBcurses\fR set the \fBcbreak()\fR
116 Note that \fBcbreak()\fR overrides \fBraw()\fR. (See \fBcurs_getch\fR(3CURSES)
117 for a discussion of how these routines interact with \fBecho()\fR and
121 The \fBecho()\fR and \fBnoecho()\fR routines control whether characters typed
122 by the user are echoed by \fBgetch()\fR as they are typed. Echoing by the tty
123 driver is always disabled, but initially \fBgetch()\fR is in echo mode, so
124 characters typed are echoed. Authors of most interactive programs prefer to do
125 their own echoing in a controlled area of the screen, or not to echo at all, so
126 they disable echoing by calling \fBnoecho()\fR. (See \fBcurs_getch\fR(3CURSES)
127 for a discussion of how these routines interact with \fBcbreak()\fR and
131 The \fBhalfdelay()\fR routine is used for half-delay mode, which is similar to
132 \fBcbreak()\fR mode in that characters typed by the user are immediately
133 available to the program. However, after blocking for \fItenths\fR tenths of
134 seconds, \fBERR\fR is returned if nothing has been typed. The value of
135 \fItenths\fR must be a number between 1 and 255. Use \fBnocbreak()\fR to leave
139 If the \fBintrflush()\fR option is enabled, (\fIbf\fR is \fBTRUE\fR), when an
140 interrupt key is pressed on the keyboard (interrupt, break, quit) all output in
141 the tty driver queue will be flushed, giving the effect of faster response to
142 the interrupt, but causing \fBcurses\fR to have the wrong idea of what is on
143 the screen. Disabling (\fIbf\fR is \fBFALSE\fR), the option prevents the flush.
144 The default for the option is inherited from the tty driver settings. The
145 window argument is ignored.
148 The \fBkeypad()\fR option enables the keypad of the user's terminal. If enabled
149 (\fIbf\fR is \fBTRUE\fR), the user can press a function key (such as an arrow
150 key) and \fBwgetch()\fR returns a single value representing the function key,
151 as in \fBKEY_LEFT\fR. If disabled (\fIbf\fR is \fBFALSE\fR), \fBcurses\fR does
152 not treat function keys specially and the program has to interpret the escape
153 sequences itself. If the keypad in the terminal can be turned on (made to
154 transmit) and off (made to work locally), turning on this option causes the
155 terminal keypad to be turned on when \fBwgetch()\fR is called. The default
156 value for keypad is false.
159 Initially, whether the terminal returns 7 or 8 significant bits on input
160 depends on the control mode of the tty driver (see \fBtermio\fR(7I)). To force
161 8 bits to be returned, invoke \fBmeta\fR(\fIwin\fR, \fBTRUE\fR). To force 7
162 bits to be returned, invoke \fBmeta\fR(\fIwin\fR, \fBFALSE\fR). The window
163 argument, \fIwin\fR, is always ignored. If the terminfo capabilities \fBsmm\fR
164 (meta_on) and \fBrmm\fR (meta_off) are defined for the terminal, \fBsmm\fR is
165 sent to the terminal when \fBmeta\fR(\fI win\fR, \fBTRUE)\fR is called and
166 \fBrmm\fR is sent when \fBmeta\fR(\fIwin\fR, \fBFALSE\fR) is called.
169 The \fBnodelay()\fR option causes \fBgetch()\fR to be a non-blocking call. If
170 no input is ready, \fBgetch()\fR returns \fBERR\fR. If disabled (\fIbf\fR is
171 \fBFALSE\fR), \fBgetch()\fR waits until a key is pressed.
174 While interpreting an input escape sequence, \fBwgetch()\fR sets a timer while
175 waiting for the next character. If \fBnotimeout(\fR\fIwin\fR, \fBTRUE\fR) is
176 called, then \fBwgetch()\fR does not set a timer. The purpose of the timeout is
177 to differentiate between sequences received from a function key and those typed
181 With the \fBraw()\fR and \fBnoraw()\fR routines, the terminal is placed into or
182 out of raw mode. Raw mode is similar to \fBcbreak()\fR mode, in that characters
183 typed are immediately passed through to the user program. The differences are
184 that in raw mode, the interrupt, quit, suspend, and flow control characters are
185 all passed through uninterpreted, instead of generating a signal. The behavior
186 of the \fBBREAK\fR key depends on other bits in the tty driver that are not set
190 When the \fBnoqiflush()\fR routine is used, normal flush of input and output
191 queues associated with the \fBINTR\fR, \fBQUIT\fR and \fBSUSP\fR characters
192 will not be done (see \fBtermio\fR(7I)). When \fBqiflush()\fR is called, the
193 queues will be flushed when these control characters are read.
196 The \fBtimeout()\fR and \fBwtimeout()\fR routines set blocking or non-blocking
197 read for a given window. If \fIdelay\fR is negative, blocking read is used
198 (that is, waits indefinitely for input). If \fIdelay\fR is zero, then
199 non-blocking read is used (that is, read returns \fBERR\fR if no input is
200 waiting). If \fIdelay\fR is positive, then read blocks for \fIdelay\fR
201 milliseconds, and returns \fBERR\fR if there is still no input. Hence, these
202 routines provide the same functionality as \fBnodelay()\fR, plus the additional
203 capability of being able to block for only \fIdelay\fR milliseconds (where
204 \fIdelay\fR is positive).
207 \fBcurses\fR does ``line-breakout optimization'' by looking for typeahead
208 periodically while updating the screen. If input is found, and it is coming
209 from a tty, the current update is postponed until \fBrefresh()\fR or
210 \fBdoupdate()\fR is called again. This allows faster response to commands typed
211 in advance. Normally, the input \fBFILE\fR pointer passed to \fBnewterm()\fR,
212 or \fBstdin\fR in the case that \fBinitscr()\fR was used, will be used to do
213 this typeahead checking. The \fBtypeahead()\fR routine specifies that the file
214 descriptor \fIfildes\fR is to be used to check for typeahead instead. If
215 \fIfildes\fR is \(mi1, then no typeahead checking is done.
219 All routines that return an integer return \fBERR\fR upon failure and an
220 integer value other than \fBERR\fR upon successful completion, unless otherwise
221 noted in the preceding routine descriptions.
225 See \fBattributes\fR(5) for descriptions of the following attributes:
233 ATTRIBUTE TYPE ATTRIBUTE VALUE
241 \fBcurs_getch\fR(3CURSES), \fBcurs_initscr\fR(3CURSES), \fBcurses\fR(3CURSES),
242 \fBattributes\fR(5), \fBtermio\fR(7I)
246 The header <\fBcurses.h\fR> automatically includes the headers <\fBstdio.h\fR>
247 and <\fBunctrl.h\fR>.
250 Note that \fBecho()\fR, \fBnoecho()\fR, \fBhalfdelay()\fR, \fBintrflush()\fR,
251 \fBmeta()\fR, \fBnodelay()\fR, \fBnotimeout()\fR, \fBnoqiflush()\fR,
252 \fBqiflush()\fR, \fBtimeout()\fR, and \fBwtimeout()\fR may be macros.