.PM ""
'\"macro stdmacro
.if n .pH g3x.curs_inopts @(#)curs_inopts	40.3 of 12/15/89
.\" Copyright 1989 AT&T
.\" ident	"@(#)svid_ti:ti_lib/curs_inopts	1.4"
.nr X
.if \nX=0 .ds x} curs_inopts 3X "" "\&"
.if \nX=1 .ds x} curs_inopts 3X ""
.if \nX=2 .ds x} curs_inopts 3X "" "\&"
.if \nX=3 .ds x} curs_inopts "" "" "\&"
.TH \*(x}
.SH NAME
\f4curs_inopts\f2: \f4 cbreak\f1, \f4nocbreak\f1, \f4echo\f1, \f4noecho\f1, \f4halfdelay\f1, \f4intrflush\f1, \f4keypad\f1, \f4meta\f1, \f4nodelay\f1, \f4notimeout\f1, \f4raw\f1, \f4noraw\f1, \f4noqiflush\f1, \f4qiflush\f1, \f4timeout\f1, \f4wtimeout\f1, \f4typeahead\f1 \- \f4curses\fP terminal input option control routines
.SH SYNOPSIS
.nf
.ft 4
#include <curses.h>
.sp
int cbreak(void);
.sp 0.5
int nocbreak(void);
.sp 0.5
int echo(void);
.sp 0.5
int noecho(void);
.sp 0.5
int halfdelay(int tenths);
.sp 0.5
int intrflush(WINDOW *win, bool bf);
.sp 0.5
int keypad(WINDOW *win, bool bf);
.sp 0.5
int meta(WINDOW *win, bool bf);
.sp 0.5
int nodelay(WINDOW *win, bool bf);
.sp 0.5
int notimeout(WINDOW *win, bool bf);
.sp 0.5
int raw(void);
.sp 0.5
int noraw(void);
.sp 0.5
void noqiflush(void);
.sp 0.5
void qiflush(void);
.sp 0.5
void timeout(int delay);
.sp 0.5
void wtimeout(WINDOW *win, int delay);
.sp 0.5
int typeahead(int fd);
.ft 1
.fi
.SH DESCRIPTION
The \f4cbreak\f1 and \f4nocbreak\f1 routines put the terminal into
and out of \f4cbreak\f1 mode, respectively.
In this mode, characters typed by the user are immediately available to the
program, and erase/kill character-processing is not performed.
When out of this mode, the tty driver buffers the typed
characters until a newline or carriage return is typed.
Interrupt and flow control characters are unaffected by this mode.
Initially the terminal may or may not be in \f4cbreak\f1 mode, as the mode
is inherited;
therefore, a program should call \f4cbreak\f1 or
\f4nocbreak\f1 explicitly.
Most interactive programs using \f4curses\fP set the \f4cbreak\f1 mode.
.P
Note that \f4cbreak\f1 overrides \f4raw\f1.
[See curs_getch(3X) for a discussion
of how these routines interact with \f4echo\f1 and
\f4noecho\f1.]
.P
The \f4echo\f1 and \f4noecho\f1
routines control whether characters typed by the user
are echoed by \f4getch\f1 as they are typed.
Echoing by the tty driver is always disabled, but
initially \f4getch\f1 is in echo mode,
so characters typed are echoed.
Authors of most interactive programs prefer to do their own
echoing in a controlled area of the screen,
or not to echo at all, so they disable echoing
by calling \f4noecho\f1.
[See curs_getch(3X) for a discussion of
how these routines interact with \f4cbreak\f1 and
\f4nocbreak\f1.]
.P
The \f4halfdelay\f1 routine is used for
half-delay mode,
which is similar to \f4cbreak\f1
mode in that characters typed by the
user are immediately available to the program.
However, after blocking for
\f2tenths\f1
tenths of seconds, ERR\s0 is returned if nothing has been typed.
The value of
\f4tenths\f1
must be a number between 1 and 255.
Use \f4nocbreak\f1
to leave half-delay mode.
.P
If the \f4intrflush\f1
option is enabled,
(\f2bf\f1 is \f4TRUE\f1), 
when an interrupt key is pressed on the keyboard
(interrupt,
break, quit) all output in the tty driver queue will be flushed,
giving the effect of faster response to the interrupt,
but causing \f4curses\fP to
have the wrong idea of what is on the screen.
Disabling (\f2bf\f1 is \f4FALSE\f1), the option prevents the flush.
The default for the option is inherited from the tty driver settings.
The window argument is ignored.
.P
The \f4keypad\f1
option enables the keypad of the user's terminal.
If enabled (\f2bf\f1 is \f4TRUE\f1), the user can press 
a function key (such as an arrow key) and \f4wgetch\f1
returns a single value representing the 
function key, as in \f4KEY_LEFT\f1.
If disabled (\f2bf\f1 is \f4FALSE\f1), 
\f4curses\fP does not treat function keys specially and the program
has to interpret the escape sequences itself.
If the keypad in the terminal can be turned on (made to transmit)
and off (made to work locally),
turning on this option causes the terminal
keypad to be turned on when \f4wgetch\f1 is called.
The default value for keypad is false.
.P
Initially,
whether the terminal returns 7 or 8 significant bits on input
depends on the control mode of the tty driver [see termio(7)].
To force 8 bits to be returned, invoke \f4meta\f1(\f2win\f1, 
\f4TRUE\s0\f1).
To force 7 bits to be returned, invoke \f4meta\f1(\f2win\f1, 
\f4FALSE\s0\f1).
The window argument, \f2win\f1, is always ignored.
If the terminfo
capabilities \f4smm\f1 (meta_on) and \f4rmm\f1 (meta_off)
are  defined for the terminal,
\f4smm\f1 is sent to the terminal when 
\f4meta\f1(\f2win\f1, \f4TRUE\s0\f1)
is called and \f4rmm\f1 is sent when 
\f4meta\f1(\f2win\f1, \f4FALSE\s0\f1)
is called.
.P
The \f4nodelay\f1
option causes
\f4getch\f1
to be a non-blocking call.
If no input is ready,
\f4getch\f1
returns \f4ERR\f1.
If disabled (\f2bf\f1 is \f4FALSE\f1), \f4getch\f1
waits until a key is pressed.
.P
While interpreting an input escape sequence,
\f4wgetch\f1
sets a timer while waiting for the next character.
If
\f4notimeout(\f2win\f1, \f4TRUE\f1)
is called,
then
\f4wgetch\f1
does not set a timer.
The purpose of the timeout is to differentiate between sequences
received from a function key and those typed by a user.
.P
With the \f4raw\f1 and \f4noraw\fP routines,
the terminal is placed into or out of raw mode.
Raw mode is similar to \f4cbreak\f1 mode, 
in that characters typed are immediately
passed through to the user program.
The differences are that in raw mode, the interrupt, 
quit, suspend, and flow
control characters are all passed through uninterpreted,
instead of generating a signal.
The behavior of the BREAK key depends on other bits in the tty
driver that are not set by \f4curses\fP.
.P
When the \f4noqiflush\fP routine is used, normal flush of input and
output queues associated with the \f4INTR\fP, \f4QUIT\fP and
\f4SUSP\fP characters will not be done [see \%termio(7)].
When \f4qiflush\fP is called, the queues will be flushed when these
control characters are read.
.P
The \f4timeout\f1 and \f4wtimeout\f1 routines
set blocking or non-blocking read for a given window.
If \f2delay\f1 is negative, blocking read is used (\f2i.e.\f1,
waits indefinitely for input).
If \f2delay\f1 is zero, then non-blocking read is used
(\f2i.e.\f1, read returns \f4ERR\f1 if no input is waiting).
If \f2delay\f1 is positive, then read blocks for \f2delay\f1 milliseconds,
and returns \f4ERR\f1 if there is still no input.
Hence, these routines provide the same functionality as \f4nodelay\fP,
plus the additional capability of being able to block for only \f2delay\fP
milliseconds (where \f2delay\fP is positive).
.P
\f4curses\fP does ``line-breakout optimization'' by looking for
typeahead periodically while updating the screen.
If input is found, and it is coming from a tty,
the current update is postponed until
\f4refresh\f1 or \f4doupdate\f1 is called again.
This allows faster response to commands typed in advance.
Normally, the input FILE pointer passed to
\f4newterm\f1,
or
\f4stdin\f1
in the case that
\f4initscr\f1
was used,
will be used to do this typeahead checking.
The
\f4typeahead\f1
routine specifies that the file descriptor
\f2fd\f1
is to be used to check for typeahead instead.
If
\f2fd\f1
is \-1, then no typeahead checking is done.
.SH RETURN VALUE
All routines that return an integer return \f4ERR\f1 upon
failure and an integer value other than \f4ERR\f1
upon successful completion,
unless otherwise noted in the preceding routine descriptions.
.SH NOTES
.P
The header file \f4<curses.h>\f1 automatically includes the header files
\f4<stdio.h>\f1 and \f4<unctrl.h>\f1.
.PP
Note that \f4echo\fP, \f4noecho\fP, \f4halfdelay\fP,
\f4intrflush\fP, \f4meta\fP, \f4nodelay\fP,
\f4notimeout\fP,
\f4noqiflush\fP, \f4qiflush\fP, \f4timeout\f1, and
\f4wtimeout\fP may be macros.
.SH SEE ALSO
.na
\f4curses\fP(3X),
\f4curs_getch\fP(3X),
\f4curs_initscr\fP(3X),
\f4termio\fP(7).
.ad
