HP-UX Reference (11i v2 07/12) - 3 Library Functions A-M (vol 6)
c
curses_intro(3X) curses_intro(3X)
(X/Open CURSES)
key must be done by the application.
The complete set of key codes for keypad keys that Curses can process is specified by the constants defined
in <curses.h> whose names begin with KEY_. Each terminal type described in the
terminfo data-
base may support some or all of these key codes. The
terminfo database specifies the sequence of input
characters from the terminal type that correspond to each key code (see Keypad in terminfo(4)).
The Curses implementation cannot translate keypad keys on terminals where pressing the keys does not
transmit a unique sequence.
When translation is enabled and a character that could be the beginning of a function key (such as escape)
is received, Curses notes the time and begins accumulating characters. If Curses receives additional char-
acters that represent the pressing of a keypad key, within an unspecified interval from the time the first
character was received, then Curses converts this input to a key code for presentation to the application. If
such characters are not received during this interval, translation of this input does not occur and the indivi-
dual characters are presented to the application separately. (Because Curses waits for this interval to accu-
mulate a key code, many terminals experience a delay between the time a user presses the escape key and
the time the escape is returned to the application.)
In addition, No Timeout Mode provides that in any case where Curses has received part of a function key
sequence, it waits indefinitely for the complete key sequence. The "unspecified interval" in the previous
paragraph becomes infinite in No Timeout Mode. No Timeout Mode allows the use of function keys over
slow communication lines. No Timeout Mode lets the user type the individual characters of a function key
sequence, but also delays application response when the user types a character (not a function key) that
begins a function key sequence. For this reason, in No Timeout Mode many terminals will appear to hang
between the time a user presses the escape key and the time another key is pressed. No Timeout Mode is
switchable by calling
notimeout() .
If any special characters (see Special Characters) are defined or redefined to be characters that are
members of a function key sequence, then Curses will be unable to recognise and translate those function
keys.
Several of the modes discussed below are described in terms of availability of input. If keypad translation
is enabled, then input is not available once Curses has begun receiving a keypad sequence until the
sequence is completely received or the interval has elapsed.
Input Mode
The X/Open System Interface Definitions, Issue 4, Version 2 specification ("Special Characters") defines
flow-control characters, the interrupt character, the erase character, and the kill character. Four mutually
exclusive Curses modes let the application control the effect of these input characters:
Input Mode Effect
Cooked Mode This achieves normal line-at-a-time processing with all special characters handled out-
side the application. This achieves the same effect as canonical-mode input processing
as specified in the X/Open System Interface Definitions, Issue 4, Version 2
specification . The state of the ISIG and IXON flags are not changed upon entering
this mode by calling
cbreak(), and are set upon entering this mode by calling
noraw().
The implementation supports erase and kill characters from any supported locale, no
matter what the width of the character is.
cbreak Mode Characters typed by the user are immediately available to the application and Curses
does not perform special processing on either the erase character or the kill character.
An application can select cbreak mode to do its own line editing but to let the abort
character be used to abort the task. This mode achieves the same effect as
noncanonical-mode, Case B input processing (with MIN set to 1 and ICRNL cleared)
as specified in the X/Open System Interface Definitions, Issue 4, Version 2
specification. The state of the ISIG and IXON flags are not changed upon entering
this mode.
Half-Delay Mode The effect is the same as cbreak, except that input functions wait until a character is
available or an interval defined by the application elapses, whichever comes first.
This mode achieves the same effect as noncanonical-mode, Case C input processing
(with TIME set to the value specified by the application) as specified in the X/Open
System Interface Definitions, Issue 4, Version 2 specification . The state of the ISIG
and IXON flags are not changed upon entering this mode.
264 Hewlett-Packard Company − 10 − HP-UX 11i Version 2: December 2007 Update