Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1 | <!-- |
| 2 | **************************************************************************** |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 3 | * Copyright (c) 1998-2013,2015 Free Software Foundation, Inc. * |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 4 | * * |
| 5 | * Permission is hereby granted, free of charge, to any person obtaining a * |
| 6 | * copy of this software and associated documentation files (the * |
| 7 | * "Software"), to deal in the Software without restriction, including * |
| 8 | * without limitation the rights to use, copy, modify, merge, publish, * |
| 9 | * distribute, distribute with modifications, sublicense, and/or sell * |
| 10 | * copies of the Software, and to permit persons to whom the Software is * |
| 11 | * furnished to do so, subject to the following conditions: * |
| 12 | * * |
| 13 | * The above copyright notice and this permission notice shall be included * |
| 14 | * in all copies or substantial portions of the Software. * |
| 15 | * * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * |
| 17 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * |
| 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * |
| 19 | * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * |
| 20 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * |
| 21 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * |
| 22 | * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * |
| 23 | * * |
| 24 | * Except as contained in this notice, the name(s) of the above copyright * |
| 25 | * holders shall not be used in advertising or otherwise to promote the * |
| 26 | * sale, use or other dealings in this Software without prior written * |
| 27 | * authorization. * |
| 28 | **************************************************************************** |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 29 | * @Id: curs_inopts.3x,v 1.19 2015/04/11 10:21:38 tom Exp @ |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 30 | --> |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 31 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 32 | <HTML> |
| 33 | <HEAD> |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 34 | <meta http-equiv="Content-Type" content="text/html; charset=us-ascii"> |
| 35 | <meta name="generator" content="Manpage converted by man2html - see http://invisible-island.net/scripts/readme.html#others_scripts"> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 36 | <TITLE>curs_inopts 3x</TITLE> |
| 37 | <link rev=made href="mailto:bug-ncurses@gnu.org"> |
| 38 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
| 39 | </HEAD> |
| 40 | <BODY> |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 41 | <H1 class="no-header">curs_inopts 3x</H1> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 42 | <PRE> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 43 | <STRONG><A HREF="curs_inopts.3x.html">curs_inopts(3x)</A></STRONG> <STRONG><A HREF="curs_inopts.3x.html">curs_inopts(3x)</A></STRONG> |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | </PRE> |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 49 | <H2><a name="h2-NAME">NAME</a></H2><PRE> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 50 | <STRONG>cbreak</STRONG>, <STRONG>nocbreak</STRONG>, <STRONG>echo</STRONG>, <STRONG>noecho</STRONG>, <STRONG>halfdelay</STRONG>, <STRONG>intrflush</STRONG>, |
| 51 | <STRONG>keypad</STRONG>, <STRONG>meta</STRONG>, <STRONG>nodelay</STRONG>, <STRONG>notimeout</STRONG>, <STRONG>raw</STRONG>, <STRONG>noraw</STRONG>, <STRONG>noqiflush</STRONG>, |
| 52 | <STRONG>qiflush</STRONG>, <STRONG>timeout</STRONG>, <STRONG>wtimeout</STRONG>, <STRONG>typeahead</STRONG> - <STRONG>curses</STRONG> input |
| 53 | options |
| 54 | |
| 55 | |
| 56 | </PRE> |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 57 | <H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 58 | <STRONG>#include</STRONG> <STRONG><curses.h></STRONG> |
| 59 | |
| 60 | <STRONG>int</STRONG> <STRONG>cbreak(void);</STRONG> |
| 61 | <STRONG>int</STRONG> <STRONG>nocbreak(void);</STRONG> |
| 62 | <STRONG>int</STRONG> <STRONG>echo(void);</STRONG> |
| 63 | <STRONG>int</STRONG> <STRONG>noecho(void);</STRONG> |
| 64 | <STRONG>int</STRONG> <STRONG>halfdelay(int</STRONG> <STRONG>tenths);</STRONG> |
| 65 | <STRONG>int</STRONG> <STRONG>intrflush(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>bool</STRONG> <STRONG>bf);</STRONG> |
| 66 | <STRONG>int</STRONG> <STRONG>keypad(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>bool</STRONG> <STRONG>bf);</STRONG> |
| 67 | <STRONG>int</STRONG> <STRONG>meta(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>bool</STRONG> <STRONG>bf);</STRONG> |
| 68 | <STRONG>int</STRONG> <STRONG>nodelay(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>bool</STRONG> <STRONG>bf);</STRONG> |
| 69 | <STRONG>int</STRONG> <STRONG>raw(void);</STRONG> |
| 70 | <STRONG>int</STRONG> <STRONG>noraw(void);</STRONG> |
| 71 | <STRONG>void</STRONG> <STRONG>noqiflush(void);</STRONG> |
| 72 | <STRONG>void</STRONG> <STRONG>qiflush(void);</STRONG> |
| 73 | <STRONG>int</STRONG> <STRONG>notimeout(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>bool</STRONG> <STRONG>bf);</STRONG> |
| 74 | <STRONG>void</STRONG> <STRONG>timeout(int</STRONG> <STRONG>delay);</STRONG> |
| 75 | <STRONG>void</STRONG> <STRONG>wtimeout(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>int</STRONG> <STRONG>delay);</STRONG> |
| 76 | <STRONG>int</STRONG> <STRONG>typeahead(int</STRONG> <STRONG>fd);</STRONG> |
| 77 | |
| 78 | |
| 79 | </PRE> |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 80 | <H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE> |
| 81 | The <STRONG>ncurses</STRONG> library provides several functions which let |
| 82 | an application change way input from the terminal is han- |
| 83 | dled. Some are global, applying to all windows. Others |
| 84 | apply only to a specific window. Window-specific settings |
| 85 | are not automatically applied to new or derived windows. |
| 86 | An application must apply these to each window, if the |
| 87 | same behavior is needed. |
| 88 | |
| 89 | |
| 90 | </PRE> |
| 91 | <H3><a name="h3-cbreak">cbreak</a></H3><PRE> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 92 | Normally, the tty driver buffers typed characters until a |
| 93 | newline or carriage return is typed. The <STRONG>cbreak</STRONG> routine |
| 94 | disables line buffering and erase/kill character-process- |
| 95 | ing (interrupt and flow control characters are unaffect- |
| 96 | ed), making characters typed by the user immediately |
| 97 | available to the program. The <STRONG>nocbreak</STRONG> routine returns |
| 98 | the terminal to normal (cooked) mode. |
| 99 | |
| 100 | Initially the terminal may or may not be in <STRONG>cbreak</STRONG> mode, |
| 101 | as the mode is inherited; therefore, a program should call |
| 102 | <STRONG>cbreak</STRONG> or <STRONG>nocbreak</STRONG> explicitly. Most interactive programs |
| 103 | using <STRONG>curses</STRONG> set the <STRONG>cbreak</STRONG> mode. Note that <STRONG>cbreak</STRONG> over- |
| 104 | rides <STRONG>raw</STRONG>. [See <STRONG><A HREF="curs_getch.3x.html">curs_getch(3x)</A></STRONG> for a discussion of how |
| 105 | these routines interact with <STRONG>echo</STRONG> and <STRONG>noecho</STRONG>.] |
| 106 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 107 | |
| 108 | </PRE> |
| 109 | <H3><a name="h3-echo_noecho">echo/noecho</a></H3><PRE> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 110 | The <STRONG>echo</STRONG> and <STRONG>noecho</STRONG> routines control whether characters |
| 111 | typed by the user are echoed by <STRONG>getch</STRONG> as they are typed. |
| 112 | Echoing by the tty driver is always disabled, but initial- |
| 113 | ly <STRONG>getch</STRONG> is in echo mode, so characters typed are echoed. |
| 114 | Authors of most interactive programs prefer to do their |
| 115 | own echoing in a controlled area of the screen, or not to |
| 116 | echo at all, so they disable echoing by calling <STRONG>noecho</STRONG>. |
| 117 | [See <STRONG><A HREF="curs_getch.3x.html">curs_getch(3x)</A></STRONG> for a discussion of how these routines |
| 118 | interact with <STRONG>cbreak</STRONG> and <STRONG>nocbreak</STRONG>.] |
| 119 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 120 | |
| 121 | </PRE> |
| 122 | <H3><a name="h3-halfdelay">halfdelay</a></H3><PRE> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 123 | The <STRONG>halfdelay</STRONG> routine is used for half-delay mode, which |
| 124 | is similar to <STRONG>cbreak</STRONG> mode in that characters typed by the |
| 125 | user are immediately available to the program. However, |
| 126 | after blocking for <EM>tenths</EM> tenths of seconds, ERR is re- |
| 127 | turned if nothing has been typed. The value of <STRONG>tenths</STRONG> |
| 128 | must be a number between 1 and 255. Use <STRONG>nocbreak</STRONG> to leave |
| 129 | half-delay mode. |
| 130 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 131 | |
| 132 | </PRE> |
| 133 | <H3><a name="h3-intrflush">intrflush</a></H3><PRE> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 134 | If the <STRONG>intrflush</STRONG> option is enabled, (<EM>bf</EM> is <STRONG>TRUE</STRONG>), when an |
| 135 | interrupt key is pressed on the keyboard (interrupt, |
| 136 | break, quit) all output in the tty driver queue will be |
| 137 | flushed, giving the effect of faster response to the in- |
| 138 | terrupt, but causing <STRONG>curses</STRONG> to have the wrong idea of what |
| 139 | is on the screen. Disabling (<EM>bf</EM> is <STRONG>FALSE</STRONG>), the option |
| 140 | prevents the flush. The default for the option is inher- |
| 141 | ited from the tty driver settings. The window argument is |
| 142 | ignored. |
| 143 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 144 | |
| 145 | </PRE> |
| 146 | <H3><a name="h3-keypad">keypad</a></H3><PRE> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 147 | The <STRONG>keypad</STRONG> option enables the keypad of the user's termi- |
| 148 | nal. If enabled (<EM>bf</EM> is <STRONG>TRUE</STRONG>), the user can press a func- |
| 149 | tion key (such as an arrow key) and <STRONG>wgetch</STRONG> returns a sin- |
| 150 | gle value representing the function key, as in <STRONG>KEY_LEFT</STRONG>. |
| 151 | If disabled (<EM>bf</EM> is <STRONG>FALSE</STRONG>), <STRONG>curses</STRONG> does not treat function |
| 152 | keys specially and the program has to interpret the escape |
| 153 | sequences itself. If the keypad in the terminal can be |
| 154 | turned on (made to transmit) and off (made to work local- |
| 155 | ly), turning on this option causes the terminal keypad to |
| 156 | be turned on when <STRONG>wgetch</STRONG> is called. The default value for |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 157 | keypad is <STRONG>FALSE</STRONG>. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 158 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 159 | |
| 160 | </PRE> |
| 161 | <H3><a name="h3-meta">meta</a></H3><PRE> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 162 | Initially, whether the terminal returns 7 or 8 significant |
| 163 | bits on input depends on the control mode of the tty driv- |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 164 | er [see <STRONG>termio(7)</STRONG>]. To force 8 bits to be returned, in- |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 165 | voke <STRONG>meta</STRONG>(<EM>win</EM>, <STRONG>TRUE</STRONG>); this is equivalent, under POSIX, to |
| 166 | setting the CS8 flag on the terminal. To force 7 bits to |
| 167 | be returned, invoke <STRONG>meta</STRONG>(<EM>win</EM>, <STRONG>FALSE</STRONG>); this is equivalent, |
| 168 | under POSIX, to setting the CS7 flag on the terminal. The |
| 169 | window argument, <EM>win</EM>, is always ignored. If the terminfo |
| 170 | capabilities <STRONG>smm</STRONG> (meta_on) and <STRONG>rmm</STRONG> (meta_off) are defined |
| 171 | for the terminal, <STRONG>smm</STRONG> is sent to the terminal when |
| 172 | <STRONG>meta</STRONG>(<EM>win</EM>, <STRONG>TRUE</STRONG>) is called and <STRONG>rmm</STRONG> is sent when <STRONG>meta</STRONG>(<EM>win</EM>, |
| 173 | <STRONG>FALSE</STRONG>) is called. |
| 174 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 175 | |
| 176 | </PRE> |
| 177 | <H3><a name="h3-nodelay">nodelay</a></H3><PRE> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 178 | The <STRONG>nodelay</STRONG> option causes <STRONG>getch</STRONG> to be a non-blocking call. |
| 179 | If no input is ready, <STRONG>getch</STRONG> returns <STRONG>ERR</STRONG>. If disabled (<EM>bf</EM> |
| 180 | is <STRONG>FALSE</STRONG>), <STRONG>getch</STRONG> waits until a key is pressed. |
| 181 | |
| 182 | While interpreting an input escape sequence, <STRONG>wgetch</STRONG> sets a |
| 183 | timer while waiting for the next character. If <STRONG>notime-</STRONG> |
| 184 | <STRONG>out(</STRONG><EM>win</EM>, <STRONG>TRUE</STRONG>) is called, then <STRONG>wgetch</STRONG> does not set a |
| 185 | timer. The purpose of the timeout is to differentiate be- |
| 186 | tween sequences received from a function key and those |
| 187 | typed by a user. |
| 188 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 189 | |
| 190 | </PRE> |
| 191 | <H3><a name="h3-raw_noraw">raw/noraw</a></H3><PRE> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 192 | The <STRONG>raw</STRONG> and <STRONG>noraw</STRONG> routines place the terminal into or out |
| 193 | of raw mode. Raw mode is similar to <STRONG>cbreak</STRONG> mode, in that |
| 194 | characters typed are immediately passed through to the us- |
| 195 | er program. The differences are that in raw mode, the in- |
| 196 | terrupt, quit, suspend, and flow control characters are |
| 197 | all passed through uninterpreted, instead of generating a |
| 198 | signal. The behavior of the BREAK key depends on other |
| 199 | bits in the tty driver that are not set by <STRONG>curses</STRONG>. |
| 200 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 201 | |
| 202 | </PRE> |
| 203 | <H3><a name="h3-noqiflush">noqiflush</a></H3><PRE> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 204 | When the <STRONG>noqiflush</STRONG> routine is used, normal flush of input |
| 205 | and output queues associated with the <STRONG>INTR</STRONG>, <STRONG>QUIT</STRONG> and <STRONG>SUSP</STRONG> |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 206 | characters will not be done [see <STRONG>termio(7)</STRONG>]. When <STRONG>qiflush</STRONG> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 207 | is called, the queues will be flushed when these control |
| 208 | characters are read. You may want to call <STRONG>noqiflush()</STRONG> in |
| 209 | a signal handler if you want output to continue as though |
| 210 | the interrupt had not occurred, after the handler exits. |
| 211 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 212 | |
| 213 | </PRE> |
| 214 | <H3><a name="h3-timeout_wtimeout">timeout/wtimeout</a></H3><PRE> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 215 | The <STRONG>timeout</STRONG> and <STRONG>wtimeout</STRONG> routines set blocking or non- |
| 216 | blocking read for a given window. If <EM>delay</EM> is negative, |
| 217 | blocking read is used (i.e., waits indefinitely for in- |
| 218 | put). If <EM>delay</EM> is zero, then non-blocking read is used |
| 219 | (i.e., read returns <STRONG>ERR</STRONG> if no input is waiting). If <EM>delay</EM> |
| 220 | is positive, then read blocks for <EM>delay</EM> milliseconds, and |
| 221 | returns <STRONG>ERR</STRONG> if there is still no input. Hence, these rou- |
| 222 | tines provide the same functionality as <STRONG>nodelay</STRONG>, plus the |
| 223 | additional capability of being able to block for only <EM>de-</EM> |
| 224 | <EM>lay</EM> milliseconds (where <EM>delay</EM> is positive). |
| 225 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 226 | |
| 227 | </PRE> |
| 228 | <H3><a name="h3-typeahead">typeahead</a></H3><PRE> |
| 229 | The <STRONG>curses</STRONG> library does "line-breakout optimization" by |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 230 | looking for typeahead periodically while updating the |
| 231 | screen. If input is found, and it is coming from a tty, |
| 232 | the current update is postponed until <STRONG>refresh</STRONG> or <STRONG>doupdate</STRONG> |
| 233 | is called again. This allows faster response to commands |
| 234 | typed in advance. Normally, the input FILE pointer passed |
| 235 | to <STRONG>newterm</STRONG>, or <STRONG>stdin</STRONG> in the case that <STRONG>initscr</STRONG> was used, |
| 236 | will be used to do this typeahead checking. The <STRONG>typeahead</STRONG> |
| 237 | routine specifies that the file descriptor <EM>fd</EM> is to be |
| 238 | used to check for typeahead instead. If <EM>fd</EM> is -1, then no |
| 239 | typeahead checking is done. |
| 240 | |
| 241 | |
| 242 | </PRE> |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 243 | <H2><a name="h2-RETURN-VALUE">RETURN VALUE</a></H2><PRE> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 244 | All routines that return an integer return <STRONG>ERR</STRONG> upon fail- |
| 245 | ure and OK (SVr4 specifies only "an integer value other |
| 246 | than <STRONG>ERR</STRONG>") upon successful completion, unless otherwise |
| 247 | noted in the preceding routine descriptions. |
| 248 | |
| 249 | X/Open does not define any error conditions. In this im- |
| 250 | plementation, functions with a window parameter will re- |
| 251 | turn an error if it is null. Any function will also re- |
| 252 | turn an error if the terminal was not initialized. Also, |
| 253 | |
| 254 | <STRONG>halfdelay</STRONG> |
| 255 | returns an error if its parameter is outside |
| 256 | the range 1..255. |
| 257 | |
| 258 | |
| 259 | </PRE> |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 260 | <H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 261 | These functions are described in the XSI Curses standard, |
| 262 | Issue 4. |
| 263 | |
| 264 | The ncurses library obeys the XPG4 standard and the his- |
| 265 | torical practice of the AT&T curses implementations, in |
| 266 | that the echo bit is cleared when curses initializes the |
| 267 | terminal state. BSD curses differed from this slightly; |
| 268 | it left the echo bit on at initialization, but the BSD <STRONG>raw</STRONG> |
| 269 | call turned it off as a side-effect. For best portabili- |
| 270 | ty, set echo or noecho explicitly just after initializa- |
| 271 | tion, even if your program remains in cooked mode. |
| 272 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 273 | When <STRONG>keypad</STRONG> is first enabled, ncurses loads the key-defi- |
| 274 | nitions for the current terminal description. If the ter- |
| 275 | minal description includes extended string capabilities, |
| 276 | e.g., from using the <STRONG>-x</STRONG> option of tic, then ncurses also |
| 277 | defines keys for the capabilities whose names begin with |
| 278 | "k". The corresponding keycodes are generated and (de- |
| 279 | pending on previous loads of terminal descriptions) may |
| 280 | differ from one execution of a program to the next. The |
| 281 | generated keycodes are recognized by the <STRONG>keyname</STRONG> function |
| 282 | (which will then return a name beginning with "k" denoting |
| 283 | the terminfo capability name rather than "K", used for |
| 284 | curses key-names). On the other hand, an application can |
| 285 | use <STRONG>define_key</STRONG> to establish a specific keycode for a given |
| 286 | string. This makes it possible for an application to |
| 287 | check for an extended capability's presence with <EM>tigetstr</EM>, |
| 288 | and reassign the keycode to match its own needs. |
| 289 | |
| 290 | Low-level applications can use <STRONG>tigetstr</STRONG> to obtain the def- |
| 291 | inition of any particular string capability. Higher-level |
| 292 | applications which use the curses <STRONG>wgetch</STRONG> and similar func- |
| 293 | tions to return keycodes rely upon the order in which the |
| 294 | strings are loaded. If more than one key definition has |
| 295 | the same string value, then <STRONG>wgetch</STRONG> can return only one |
| 296 | keycode. Most curses implementations (including ncurses) |
| 297 | load key definitions in the order defined by the array of |
| 298 | string capability names. The last key to be loaded deter- |
| 299 | mines the keycode which will be returned. In ncurses, you |
| 300 | may also have extended capabilities interpreted as key |
| 301 | definitions. These are loaded after the predefined keys, |
| 302 | and if a capability's value is the same as a previously- |
| 303 | loaded key definition, the later definition is the one |
| 304 | used. |
| 305 | |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 306 | |
| 307 | </PRE> |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 308 | <H2><a name="h2-NOTES">NOTES</a></H2><PRE> |
| 309 | Note that <STRONG>echo</STRONG>, <STRONG>noecho</STRONG>, <STRONG>halfdelay</STRONG>, <STRONG>intrflush</STRONG>, <STRONG>meta</STRONG>, <STRONG>node-</STRONG> |
| 310 | <STRONG>lay</STRONG>, <STRONG>notimeout</STRONG>, <STRONG>noqiflush</STRONG>, <STRONG>qiflush</STRONG>, <STRONG>timeout</STRONG>, and <STRONG>wtimeout</STRONG> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 311 | may be macros. |
| 312 | |
| 313 | The <STRONG>noraw</STRONG> and <STRONG>nocbreak</STRONG> calls follow historical practice in |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 314 | that they attempt to restore to normal (`cooked') mode |
| 315 | from raw and cbreak modes respectively. Mixing raw/noraw |
| 316 | and cbreak/nocbreak calls leads to tty driver control |
| 317 | states that are hard to predict or understand; it is not |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 318 | recommended. |
| 319 | |
| 320 | |
| 321 | </PRE> |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 322 | <H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE> |
| 323 | <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="curs_getch.3x.html">curs_getch(3x)</A></STRONG>, <STRONG><A HREF="curs_initscr.3x.html">curs_initscr(3x)</A></STRONG>, |
| 324 | <STRONG><A HREF="curs_util.3x.html">curs_util(3x)</A></STRONG>, <STRONG><A HREF="define_key.3x.html">define_key(3x)</A></STRONG>, <STRONG>termio(7)</STRONG> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 325 | |
| 326 | |
| 327 | |
| 328 | <STRONG><A HREF="curs_inopts.3x.html">curs_inopts(3x)</A></STRONG> |
| 329 | </PRE> |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 330 | <div class="nav"> |
| 331 | <ul> |
| 332 | <li><a href="#h2-NAME">NAME</a></li> |
| 333 | <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li> |
| 334 | <li><a href="#h2-DESCRIPTION">DESCRIPTION</a> |
| 335 | <ul> |
| 336 | <li><a href="#h3-cbreak">cbreak</a></li> |
| 337 | <li><a href="#h3-echo_noecho">echo/noecho</a></li> |
| 338 | <li><a href="#h3-halfdelay">halfdelay</a></li> |
| 339 | <li><a href="#h3-intrflush">intrflush</a></li> |
| 340 | <li><a href="#h3-keypad">keypad</a></li> |
| 341 | <li><a href="#h3-meta">meta</a></li> |
| 342 | <li><a href="#h3-nodelay">nodelay</a></li> |
| 343 | <li><a href="#h3-raw_noraw">raw/noraw</a></li> |
| 344 | <li><a href="#h3-noqiflush">noqiflush</a></li> |
| 345 | <li><a href="#h3-timeout_wtimeout">timeout/wtimeout</a></li> |
| 346 | <li><a href="#h3-typeahead">typeahead</a></li> |
| 347 | </ul> |
| 348 | </li> |
| 349 | <li><a href="#h2-RETURN-VALUE">RETURN VALUE</a></li> |
| 350 | <li><a href="#h2-PORTABILITY">PORTABILITY</a></li> |
| 351 | <li><a href="#h2-NOTES">NOTES</a></li> |
| 352 | <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li> |
| 353 | </ul> |
| 354 | </div> |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 355 | </BODY> |
| 356 | </HTML> |