These functions manipulate curses terminal settings.
The
beep() function rings the terminal bell, if this is possible. Failing that, the terminal screen will be flashed. If neither of these are possible, then no action will be taken.
flash() will flash the terminal screen if possible. Failing that, the terminal bell will be rung. If neither of these are possible then no action will be taken.
The cursor visibility can be set by calling
curs_set(). The following visibility settings are valid for
curs_set():
1
cursor is normal visibility
2
cursor is high visibility
A successful call to
curs_set() will return the previous visibility setting for the cursor.
The
delay_output() function pauses the output to the terminal by sending the appropriate number of terminal pad characters such that the transmission time of the pad characters will take
ms milliseconds.
Calling
def_prog_mode() will cause the current terminal curses setting to be saved. A subsequent call to
reset_prog_mode(), will restore the saved settings. This is useful when calls to external programs are made that may reset the terminal characteristics.
The
def_shell_mode() function saves the current terminal line settings. These settings are the ones that will be restored when the curses application exits. Conversely,
reset_shell_mode() will save the current terminal curses settings for later restoration and restores the previously saved terminal line settings.
The
echo() function turns on curses echo mode, characters entered will be echoed to the terminal by curses. The
noecho() function disables this feature.
The current erase character for the terminal can be determined by calling the
erasechar() function.
The
flushinp() function discards any pending input for the current screen.
The modes for the current terminal can be reset by calling
gettmode(), this will perform the initialisation on the terminal that is normally done by curses at start up.
The
has_ic() function returns either
TRUE or
FALSE depending on whether or not the terminal has a insert character capability or not. Similarly the
has_il() function does the same test but for a insert line capability.
The use of the insert character capability in curses operations can be enabled or disabled by calling
idcok() on the desired window. Similarly, the use of the insert line capability can be controlled using the
idlok() function.
The
intrflush() function controls whether or not a flush of the input buffer is performed when an interrupt key (kill, suspend or quit) is pressed. The
win parameter is ignored. The
noqiflush() function is equivalent to
intrflush(
stdscr,
FALSE). The
qiflush() function is equivalent to
intrflush(
stdscr,
TRUE).
The character that performs the line kill function can be determined by calling the
killchar() function.
The
meta() function turns on and off the generation of 8 bit characters by the terminal, if
flag is
FALSE then only 7 bit characters will be returned, if
flag is
TRUE then 8 bit characters will be returned by the terminal.
The
napms() causes the application to sleep for the number of milliseconds specified by
ms.
Calling
nl() will cause curses to map all carriage returns to newlines on input, this functionality is enabled by default. The
nonl() function disables this behaviour.
The
cbreak() function will put the terminal into cbreak mode, which means that characters will be returned one at a time instead of waiting for a newline character, line discipline processing will be performed. The
nocbreak() function disables this mode.
Calling
halfdelay() puts the terminal into the same mode as
cbreak() with the exception that if no character is received within the specified number of tenths of a second then the input routine will return
ERR. This mode can be cancelled by calling
nocbreak(). The valid range for the timeout is from 1 to 255 tenths of a second.
The
noraw() function sets the input mode for the current terminal into Cooked mode, that is input character translation and signal character processing is performed. The
raw() function puts the terminal into Raw mode, no input character translation is done nor is signal character processing.
The terminal tty flags can be saved by calling
savetty() and may be restored by calling
resetty(), the use of these functions is discouraged as they may cause the terminal to be put into a state that is incompatible with curses operation.