- NetBSD Manual Pages
CURSES_TTY(3) NetBSD Library Functions Manual CURSES_TTY(3)
Powered by man-cgi (2021-03-02).
Maintained for NetBSD
by Kimmo Suominen.
Based on man-cgi by Panagiotis Christias.
curses_tty, baudrate, 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, typeahead, savetty, resetty -- curses
terminal manipulation routines
Curses Library (libcurses, -lcurses)
idcok(WINDOW *win, bool flag);
idlok(WINDOW *win, bool flag);
intrflush(WINDOW *win, bool flag);
meta(WINDOW *win, bool flag);
These functions manipulate curses terminal settings.
The baudrate() function extracts the output speed of the terminal and
returns it in bits per second.
The beep() function rings the terminal bell, if this is possible. Fail-
ing 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 set-
ting 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 transmis-
sion 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 appli-
cation exits. Conversely, reset_shell_mode() will save the current ter-
minal 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
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
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 capabil-
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()
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 equiv-
alent 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
The napms() causes the application to sleep for the number of millisec-
onds 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 num-
ber 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 pro-
The typeahead() function controls the detection of typeahead during a
refresh based on the value of filedes:
· If filedes is a valid file descriptor, typeahead is enabled during
refresh; Curses periodically checks filedes for input and aborts the
refresh if any character is available. The value of filedes need not
be the file descriptor on which the refresh is occurring.
· If filedes is -1, Curses does not check for typeahead during refresh.
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 incompati-
ble 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 values:
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.
NetBSD 9.0 February 17, 2017 NetBSD 9.0