]> ncurses.scripts.mit.edu Git - ncurses.git/blob - doc/html/man/curs_getch.3x.html
ncurses 6.4 - patch 20231223
[ncurses.git] / doc / html / man / curs_getch.3x.html
1 <!--
2   * t
3   ****************************************************************************
4   * Copyright 2018-2022,2023 Thomas E. Dickey                                *
5   * Copyright 1998-2016,2017 Free Software Foundation, Inc.                  *
6   *                                                                          *
7   * Permission is hereby granted, free of charge, to any person obtaining a  *
8   * copy of this software and associated documentation files (the            *
9   * "Software"), to deal in the Software without restriction, including      *
10   * without limitation the rights to use, copy, modify, merge, publish,      *
11   * distribute, distribute with modifications, sublicense, and/or sell       *
12   * copies of the Software, and to permit persons to whom the Software is    *
13   * furnished to do so, subject to the following conditions:                 *
14   *                                                                          *
15   * The above copyright notice and this permission notice shall be included  *
16   * in all copies or substantial portions of the Software.                   *
17   *                                                                          *
18   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
19   * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
20   * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
21   * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
22   * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
23   * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
24   * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
25   *                                                                          *
26   * Except as contained in this notice, the name(s) of the above copyright   *
27   * holders shall not be used in advertising or otherwise to promote the     *
28   * sale, use or other dealings in this Software without prior written       *
29   * authorization.                                                           *
30   ****************************************************************************
31   * @Id: curs_getch.3x,v 1.77 2023/12/23 16:36:18 tom Exp @
32 -->
33 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
34 <HTML>
35 <HEAD>
36 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
37 <meta name="generator" content="Manpage converted by man2html - see https://invisible-island.net/scripts/readme.html#others_scripts">
38 <TITLE>curs_getch 3x 2023-12-23 ncurses 6.4 Library calls</TITLE>
39 <link rel="author" href="mailto:bug-ncurses@gnu.org">
40
41 </HEAD>
42 <BODY>
43 <H1 class="no-header">curs_getch 3x 2023-12-23 ncurses 6.4 Library calls</H1>
44 <PRE>
45 <STRONG><A HREF="curs_getch.3x.html">curs_getch(3x)</A></STRONG>                   Library calls                  <STRONG><A HREF="curs_getch.3x.html">curs_getch(3x)</A></STRONG>
46
47
48
49
50 </PRE><H2><a name="h2-NAME">NAME</a></H2><PRE>
51        <STRONG>getch</STRONG>, <STRONG>wgetch</STRONG>, <STRONG>mvgetch</STRONG>, <STRONG>mvwgetch</STRONG>, <STRONG>ungetch</STRONG>, <STRONG>has_key</STRONG> - get (or push back)
52        characters from <EM>curses</EM> terminal keyboard
53
54
55 </PRE><H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE>
56        <STRONG>#include</STRONG> <STRONG>&lt;curses.h&gt;</STRONG>
57
58        <STRONG>int</STRONG> <STRONG>getch(void);</STRONG>
59        <STRONG>int</STRONG> <STRONG>wgetch(WINDOW</STRONG> <STRONG>*</STRONG><EM>win</EM><STRONG>);</STRONG>
60        <STRONG>int</STRONG> <STRONG>mvgetch(int</STRONG> <EM>y</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>x</EM><STRONG>);</STRONG>
61        <STRONG>int</STRONG> <STRONG>mvwgetch(WINDOW</STRONG> <STRONG>*</STRONG><EM>win</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>y</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>x</EM><STRONG>);</STRONG>
62
63        <STRONG>int</STRONG> <STRONG>ungetch(int</STRONG> <EM>ch</EM><STRONG>);</STRONG>
64
65        <EM>/*</EM> <EM>extension</EM> <EM>*/</EM>
66        <STRONG>int</STRONG> <STRONG>has_key(int</STRONG> <EM>ch</EM><STRONG>);</STRONG>
67
68
69 </PRE><H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
70
71 </PRE><H3><a name="h3-Reading-Characters">Reading Characters</a></H3><PRE>
72        The <STRONG>getch</STRONG>, <STRONG>wgetch</STRONG>, <STRONG>mvgetch</STRONG> and <STRONG>mvwgetch</STRONG>, routines read a character from
73        the window.  In no-delay mode, if no input is waiting, the value <STRONG>ERR</STRONG> is
74        returned.  In delay mode, the program waits  until  the  system  passes
75        text  through to the program.  Depending on the setting of <STRONG>cbreak</STRONG>, this
76        is after one character  (cbreak  mode),  or  after  the  first  newline
77        (nocbreak  mode).   In  half-delay  mode,  the  program  waits  until a
78        character is typed or the specified timeout has been reached.
79
80        If <STRONG>echo</STRONG> is enabled, and the window is not a  pad,  then  the  character
81        will  also  be  echoed  into  the  designated  window  according to the
82        following rules:
83
84        <STRONG>o</STRONG>   If the character is the current erase  character,  left  arrow,  or
85            backspace,  the  cursor  is  moved  one  space to the left and that
86            screen position is erased as if <STRONG>delch</STRONG> had been called.
87
88        <STRONG>o</STRONG>   If the character value is  any  other  <STRONG>KEY_</STRONG>  define,  the  user  is
89            alerted with a <STRONG>beep</STRONG> call.
90
91        <STRONG>o</STRONG>   If  the character is a carriage-return, and if <STRONG>nl</STRONG> is enabled, it is
92            translated to a line-feed after echoing.
93
94        <STRONG>o</STRONG>   Otherwise the character is simply output to the screen.
95
96        If the window is not a pad, and it has been moved or modified since the
97        last call to <STRONG>wrefresh</STRONG>, <STRONG>wrefresh</STRONG> will be called before another character
98        is read.
99
100
101 </PRE><H3><a name="h3-Keypad-Mode">Keypad Mode</a></H3><PRE>
102        If <STRONG>keypad</STRONG> is <STRONG>TRUE</STRONG>, and a function key is pressed, the  token  for  that
103        function key is returned instead of the raw characters:
104
105        <STRONG>o</STRONG>   The  predefined  function  keys  are listed in <STRONG>&lt;curses.h&gt;</STRONG> as macros
106            with values outside the range of  8-bit  characters.   Their  names
107            begin with <STRONG>KEY_</STRONG>.
108
109        <STRONG>o</STRONG>   Other  (user-defined)  function  keys  which  may  be defined using
110            <STRONG><A HREF="define_key.3x.html">define_key(3x)</A></STRONG> have no names, but also are expected to have  values
111            outside the range of 8-bit characters.
112
113        Thus,  a  variable  intended to hold the return value of a function key
114        must be of short size or larger.
115
116        When a character that could be the  beginning  of  a  function  key  is
117        received  (which,  on  modern  terminals,  means  an escape character),
118        <STRONG>curses</STRONG> sets a timer.  If the remainder of the sequence does not come in
119        within the designated time, the character is passed through; otherwise,
120        the function key value is returned.  For this  reason,  many  terminals
121        experience  a  delay between the time a user presses the escape key and
122        the escape is returned to the program.
123
124        In <EM>ncurses</EM>, the timer normally expires after the value in <STRONG>ESCDELAY</STRONG> (see
125        <STRONG><A HREF="curs_variables.3x.html">curs_variables(3x)</A></STRONG>).   If <STRONG>notimeout</STRONG> is <STRONG>TRUE</STRONG>, the timer does not expire;
126        it is an infinite (or very large) value.  Because function keys usually
127        begin  with  an  escape  character,  the terminal may appear to hang in
128        notimeout mode after pressing the  escape  key  until  another  key  is
129        pressed.
130
131
132 </PRE><H3><a name="h3-Ungetting-Characters">Ungetting Characters</a></H3><PRE>
133        The  <STRONG>ungetch</STRONG> routine places <EM>ch</EM> back onto the input queue to be returned
134        by the next call to <STRONG>wgetch</STRONG>.  There is just  one  input  queue  for  all
135        windows.
136
137
138 </PRE><H3><a name="h3-Predefined-Key-Codes">Predefined Key Codes</a></H3><PRE>
139        The following special keys are defined in <STRONG>&lt;curses.h&gt;</STRONG>.
140
141        <STRONG>o</STRONG>   Except  for  the special case <STRONG>KEY_RESIZE</STRONG>, it is necessary to enable
142            <STRONG>keypad</STRONG> for <STRONG>getch</STRONG> to return these codes.
143
144        <STRONG>o</STRONG>   Not all of  these  are  necessarily  supported  on  any  particular
145            terminal.
146
147        <STRONG>o</STRONG>   The   naming  convention  may  seem  obscure,  with  some  apparent
148            misspellings (such as "RSUME" for "resume").  The names  correspond
149            to  the  long  terminfo  capability  names  for  the keys, and were
150            defined long ago, in the 1980s.
151
152               <STRONG>Name</STRONG>            <STRONG>Key</STRONG> <STRONG>name</STRONG>
153               -------------------------------------------------
154               KEY_BREAK       Break key
155               KEY_DOWN        The four arrow keys ...
156               KEY_UP
157               KEY_LEFT
158               KEY_RIGHT
159               KEY_HOME        Home key (upward+left arrow)
160               KEY_BACKSPACE   Backspace
161               KEY_F0          Function keys; space for 64 keys
162                               is reserved.
163               KEY_F(<EM>n</EM>)        For 0 &lt;= <EM>n</EM> &lt;= 63
164               KEY_DL          Delete line
165               KEY_IL          Insert line
166               KEY_DC          Delete character
167               KEY_IC          Insert char or enter insert mode
168               KEY_EIC         Exit insert char mode
169               KEY_CLEAR       Clear screen
170               KEY_EOS         Clear to end of screen
171               KEY_EOL         Clear to end of line
172               KEY_SF          Scroll 1 line forward
173               KEY_SR          Scroll 1 line backward (reverse)
174               KEY_NPAGE       Next page
175               KEY_PPAGE       Previous page
176               KEY_STAB        Set tab
177               KEY_CTAB        Clear tab
178               KEY_CATAB       Clear all tabs
179               KEY_ENTER       Enter or send
180               KEY_SRESET      Soft (partial) reset
181               KEY_RESET       Reset or hard reset
182               KEY_PRINT       Print or copy
183
184               KEY_LL          Home down or bottom (lower left)
185               KEY_A1          Upper left of keypad
186               KEY_A3          Upper right of keypad
187               KEY_B2          Center of keypad
188               KEY_C1          Lower left of keypad
189               KEY_C3          Lower right of keypad
190               KEY_BTAB        Back tab key
191               KEY_BEG         Beg(inning) key
192               KEY_CANCEL      Cancel key
193               KEY_CLOSE       Close key
194               KEY_COMMAND     Cmd (command) key
195               KEY_COPY        Copy key
196               KEY_CREATE      Create key
197               KEY_END         End key
198               KEY_EXIT        Exit key
199               KEY_FIND        Find key
200               KEY_HELP        Help key
201               KEY_MARK        Mark key
202               KEY_MESSAGE     Message key
203               KEY_MOUSE       Mouse event occurred
204               KEY_MOVE        Move key
205               KEY_NEXT        Next object key
206               KEY_OPEN        Open key
207               KEY_OPTIONS     Options key
208               KEY_PREVIOUS    Previous object key
209               KEY_REDO        Redo key
210               KEY_REFERENCE   Ref(erence) key
211               KEY_REFRESH     Refresh key
212               KEY_REPLACE     Replace key
213               KEY_RESIZE      Screen resized
214               KEY_RESTART     Restart key
215               KEY_RESUME      Resume key
216               KEY_SAVE        Save key
217               KEY_SBEG        Shifted beginning key
218               KEY_SCANCEL     Shifted cancel key
219               KEY_SCOMMAND    Shifted command key
220               KEY_SCOPY       Shifted copy key
221               KEY_SCREATE     Shifted create key
222               KEY_SDC         Shifted delete char key
223               KEY_SDL         Shifted delete line key
224               KEY_SELECT      Select key
225               KEY_SEND        Shifted end key
226               KEY_SEOL        Shifted clear line key
227               KEY_SEXIT       Shifted exit key
228               KEY_SFIND       Shifted find key
229               KEY_SHELP       Shifted help key
230               KEY_SHOME       Shifted home key
231               KEY_SIC         Shifted insert key
232               KEY_SLEFT       Shifted left arrow key
233               KEY_SMESSAGE    Shifted message key
234               KEY_SMOVE       Shifted move key
235               KEY_SNEXT       Shifted next key
236               KEY_SOPTIONS    Shifted options key
237               KEY_SPREVIOUS   Shifted prev key
238               KEY_SPRINT      Shifted print key
239               KEY_SREDO       Shifted redo key
240               KEY_SREPLACE    Shifted replace key
241               KEY_SRIGHT      Shifted right arrow key
242               KEY_SRSUME      Shifted resume key
243               KEY_SSAVE       Shifted save key
244               KEY_SSUSPEND    Shifted suspend key
245               KEY_SUNDO       Shifted undo key
246               KEY_SUSPEND     Suspend key
247               KEY_UNDO        Undo key
248
249        Keypad is arranged like this:
250
251               +-----+------+-------+
252               | <STRONG>A1</STRONG>  |  <STRONG>up</STRONG>  |  <STRONG>A3</STRONG>   |
253               +-----+------+-------+
254               |<STRONG>left</STRONG> |  <STRONG>B2</STRONG>  | <STRONG>right</STRONG> |
255               +-----+------+-------+
256               | <STRONG>C1</STRONG>  | <STRONG>down</STRONG> |  <STRONG>C3</STRONG>   |
257               +-----+------+-------+
258        A few of these predefined values do <EM>not</EM> correspond to a real key:
259
260        <STRONG>o</STRONG>   <STRONG>KEY_RESIZE</STRONG>  is  returned when the <STRONG>SIGWINCH</STRONG> signal has been detected
261            (see  <STRONG><A HREF="curs_initscr.3x.html">initscr(3x)</A></STRONG>  and  <STRONG><A HREF="resizeterm.3x.html">resizeterm(3x)</A></STRONG>).   This  code  is  returned
262            whether or not <STRONG>keypad</STRONG> has been enabled.
263
264        <STRONG>o</STRONG>   <STRONG>KEY_MOUSE</STRONG>  is returned for mouse-events (see <STRONG><A HREF="curs_mouse.3x.html">curs_mouse(3x)</A></STRONG>).  This
265            code relies upon  whether  or  not  <STRONG><A HREF="curs_inopts.3x.html">keypad(3x)</A></STRONG>  has  been  enabled,
266            because  (e.g.,  with  <STRONG>xterm(1)</STRONG> mouse prototocol) <EM>ncurses</EM> must read
267            escape sequences, just like a function key.
268
269
270 </PRE><H3><a name="h3-Testing-Key-Codes">Testing Key Codes</a></H3><PRE>
271        The <STRONG>has_key</STRONG> routine takes a key-code value from  the  above  list,  and
272        returns  <STRONG>TRUE</STRONG>  or  <STRONG>FALSE</STRONG> according to whether the current terminal type
273        recognizes a key with that value.
274
275        The library also supports these extensions:
276
277           <STRONG>define_key</STRONG>
278                defines a key-code for a given string (see <STRONG><A HREF="define_key.3x.html">define_key(3x)</A></STRONG>).
279
280           <STRONG>key_defined</STRONG>
281                checks if there is a key-code defined for a given  string  (see
282                <STRONG><A HREF="key_defined.3x.html">key_defined(3x)</A></STRONG>).
283
284
285 </PRE><H2><a name="h2-RETURN-VALUE">RETURN VALUE</a></H2><PRE>
286        All  routines  return the integer <STRONG>ERR</STRONG> upon failure and an integer value
287        other than <STRONG>ERR</STRONG> (<STRONG>OK</STRONG> in the case of <STRONG>ungetch</STRONG>) upon successful completion.
288
289           <STRONG>ungetch</STRONG>
290                returns <STRONG>ERR</STRONG> if there is no more room in the FIFO.
291
292           <STRONG>wgetch</STRONG>
293                returns <STRONG>ERR</STRONG> if the window pointer is null, or  if  its  timeout
294                expires  without  having  any  data,  or  if  the execution was
295                interrupted by a signal (<STRONG>errno</STRONG> will be set to <STRONG>EINTR</STRONG>).
296
297        Functions with a "mv" prefix first  perform  a  cursor  movement  using
298        <STRONG>wmove</STRONG>, and return an error if the position is outside the window, or if
299        the window pointer is null.
300
301
302 </PRE><H2><a name="h2-NOTES">NOTES</a></H2><PRE>
303        Use of the escape key by a programmer for a single  character  function
304        is  discouraged, as it will cause a delay of up to one second while the
305        keypad code looks for a following function-key sequence.
306
307        Some keys may  be  the  same  as  commonly  used  control  keys,  e.g.,
308        <STRONG>KEY_ENTER</STRONG>  versus  control/M,  <STRONG>KEY_BACKSPACE</STRONG>  versus  control/H.   Some
309        curses implementations may differ according to whether they treat these
310        control  keys  specially (and ignore the terminfo), or use the terminfo
311        definitions.  <EM>ncurses</EM> uses the terminfo definition.  If  it  says  that
312        <STRONG>KEY_ENTER</STRONG>  is  control/M,  <STRONG>getch</STRONG>  will  return <STRONG>KEY_ENTER</STRONG> when you press
313        control/M.
314
315        Generally, <STRONG>KEY_ENTER</STRONG> denotes the character(s) sent by the <EM>Enter</EM> key  on
316        the numeric keypad:
317
318        <STRONG>o</STRONG>   the terminal description lists the most useful keys,
319
320        <STRONG>o</STRONG>   the  <EM>Enter</EM>  key  on  the regular keyboard is already handled by the
321            standard ASCII characters for carriage-return and line-feed,
322
323        <STRONG>o</STRONG>   depending on whether <STRONG>nl</STRONG> or <STRONG>nonl</STRONG> was called, pressing "Enter" on the
324            regular  keyboard may return either a carriage-return or line-feed,
325            and finally
326
327        <STRONG>o</STRONG>   "Enter or send" is the standard description for this key.
328
329        When  using  <STRONG>getch</STRONG>,  <STRONG>wgetch</STRONG>,  <STRONG>mvgetch</STRONG>,  or  <STRONG>mvwgetch</STRONG>,   nocbreak   mode
330        (<STRONG>nocbreak</STRONG>)  and  echo  mode (<STRONG>echo</STRONG>) should not be used at the same time.
331        Depending on the state of the tty driver when each character is  typed,
332        the program may produce undesirable results.
333
334        Note that <STRONG>getch</STRONG>, <STRONG>mvgetch</STRONG>, and <STRONG>mvwgetch</STRONG> may be macros.
335
336        Historically,  the  set  of  keypad  macros  was largely defined by the
337        extremely function-key-rich keyboard of the AT&amp;T  7300,  aka  3B1,  aka
338        Safari  4.   Modern personal computers usually have only a small subset
339        of these.  IBM PC-style consoles typically  support  little  more  than
340        <STRONG>KEY_UP</STRONG>,  <STRONG>KEY_DOWN</STRONG>,  <STRONG>KEY_LEFT</STRONG>,  <STRONG>KEY_RIGHT</STRONG>, <STRONG>KEY_HOME</STRONG>, <STRONG>KEY_END</STRONG>, <STRONG>KEY_NPAGE</STRONG>,
341        <STRONG>KEY_PPAGE</STRONG>, and function keys 1 through 12.   The  Ins  key  is  usually
342        mapped to <STRONG>KEY_IC</STRONG>.
343
344
345 </PRE><H2><a name="h2-EXTENSIONS">EXTENSIONS</a></H2><PRE>
346        <STRONG>has_key</STRONG>  was designed for <STRONG><A HREF="ncurses.3x.html">ncurses(3x)</A></STRONG>, and is not found in SVr4 <EM>curses</EM>,
347        4.4BSD <EM>curses</EM>, or any other previous curses implementation.
348
349
350 </PRE><H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
351        Applications employing <EM>ncurses</EM> extensions should condition their use on
352        the visibility of the <STRONG>NCURSES_VERSION</STRONG> preprocessor macro.
353
354        X/Open  Curses,  Issue  4, Version 2, describes <STRONG>getch</STRONG>, <STRONG>wgetch</STRONG>, <STRONG>mvgetch</STRONG>,
355        <STRONG>mvwgetch</STRONG>, and <STRONG>ungetch</STRONG>.  They read  single-byte  characters  only.   The
356        standard  specifies  that  they return <STRONG>ERR</STRONG> on failure, but describes no
357        failure conditions.
358
359        The echo behavior of these functions on  input  of  <STRONG>KEY_</STRONG>  or  backspace
360        characters   was   not  specified  in  the  SVr4  documentation.   This
361        description is adapted from X/Open Curses.
362
363        The behavior of <STRONG>getch</STRONG> and friends in the presence of signal handlers is
364        unspecified  in  the  SVr4  documentation  and  X/Open  Curses.   Under
365        historical curses implementations, it varied depending on  whether  the
366        operating  system's  dispatch  of  a  signal  to a handler interrupts a
367        <STRONG>read(2)</STRONG> call in progress or not, and  also  (in  some  implementations)
368        whether an input timeout or non-blocking mode has been set.
369
370        <STRONG>KEY_MOUSE</STRONG> is mentioned in X/Open Curses, along with a few related <EM>term-</EM>
371        <EM>info</EM> capabilities, but no higher-level functions use the feature.   The
372        implementation in <EM>ncurses</EM> is an extension.
373
374        <STRONG>KEY_RESIZE</STRONG>  is  an  extension  first  implemented  for <EM>ncurses.</EM>  NetBSD
375        <EM>curses</EM> later added this extension.
376
377        Programmers concerned about portability should be prepared  for  either
378        of  two  cases: (a) signal receipt does not interrupt <STRONG>getch</STRONG>; (b) signal
379        receipt interrupts <STRONG>getch</STRONG> and causes it to return <STRONG>ERR</STRONG> with <STRONG>errno</STRONG> set  to
380        <STRONG>EINTR</STRONG>.
381
382        The  <STRONG>has_key</STRONG> function is unique to <EM>ncurses</EM>.  We recommend that any code
383        using it be conditionalized on the <STRONG>NCURSES_VERSION</STRONG> feature macro.
384
385
386 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
387        <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>,     <STRONG><A HREF="curs_inopts.3x.html">curs_inopts(3x)</A></STRONG>,     <STRONG><A HREF="curs_mouse.3x.html">curs_mouse(3x)</A></STRONG>,     <STRONG><A HREF="curs_move.3x.html">curs_move(3x)</A></STRONG>,
388        <STRONG><A HREF="curs_outopts.3x.html">curs_outopts(3x)</A></STRONG>, <STRONG><A HREF="curs_refresh.3x.html">curs_refresh(3x)</A></STRONG>, <STRONG><A HREF="curs_variables.3x.html">curs_variables(3x)</A></STRONG>, <STRONG><A HREF="resizeterm.3x.html">resizeterm(3x)</A></STRONG>
389
390        Comparable  functions  in  the  wide-character  (ncursesw)  library are
391        described in <STRONG><A HREF="curs_get_wch.3x.html">curs_get_wch(3x)</A></STRONG>.
392
393
394
395 ncurses 6.4                       2023-12-23                    <STRONG><A HREF="curs_getch.3x.html">curs_getch(3x)</A></STRONG>
396 </PRE>
397 <div class="nav">
398 <ul>
399 <li><a href="#h2-NAME">NAME</a></li>
400 <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li>
401 <li><a href="#h2-DESCRIPTION">DESCRIPTION</a>
402 <ul>
403 <li><a href="#h3-Reading-Characters">Reading Characters</a></li>
404 <li><a href="#h3-Keypad-Mode">Keypad Mode</a></li>
405 <li><a href="#h3-Ungetting-Characters">Ungetting Characters</a></li>
406 <li><a href="#h3-Predefined-Key-Codes">Predefined Key Codes</a></li>
407 <li><a href="#h3-Testing-Key-Codes">Testing Key Codes</a></li>
408 </ul>
409 </li>
410 <li><a href="#h2-RETURN-VALUE">RETURN VALUE</a></li>
411 <li><a href="#h2-NOTES">NOTES</a></li>
412 <li><a href="#h2-EXTENSIONS">EXTENSIONS</a></li>
413 <li><a href="#h2-PORTABILITY">PORTABILITY</a></li>
414 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>
415 </ul>
416 </div>
417 </BODY>
418 </HTML>