CURSES_TTY(3) BSD Library Functions Manual CURSES_TTY(3)
curses_tty, beep, flash, curs_set, def_prog_mode, reset_prog_mode, def_shell_mode, reset_shell_mode, echo, noecho, delay_output, erasechar,
flushinp, gettmode, halfdelay, has_ic, has_il, idcok, idlok, intrflush, noqiflush, qiflush, killchar, meta, napms, nl, nonl, cbreak,
nocbreak, raw, noraw, savetty, resetty -- curses terminal manipulation routines
Curses Library (libcurses, -lcurses)
idcok(WINDOW *win, boolf flag);
idlok(WINDOW *win, boolf flag);
intrflush(WINDOW *win, boolf flag);
meta(WINDOW *win, boolf flag);
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():
0 cursor is invisible.
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 pre-
viously 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
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. Simi-
larly 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. Simi-
larly, 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() func-
tion 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
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.
Functions returning pointers will return NULL if an error is detected. The functions that return an int will return one of the following
OK The function completed successfully.
ERR An error occurred in the function.
The idcok() and idlok() currently have no effect on the curses code at all, currently curses will always use the terminal insert character
and insert line capabilities if available.
The NetBSD Curses library complies with the X/Open Curses specification, part of the Single Unix Specification.
The Curses package appeared in 4.0BSD.
June 13, 2003 BSD