+'\" t
.\"***************************************************************************
-.\" Copyright 2018-2020,2021 Thomas E. Dickey *
+.\" Copyright 2018-2022,2023 Thomas E. Dickey *
.\" Copyright 1998-2016,2017 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
.\" authorization. *
.\"***************************************************************************
.\"
-.\" $Id: curs_inopts.3x,v 1.35 2021/12/25 21:49:32 tom Exp $
-.TH curs_inopts 3X ""
+.\" $Id: curs_inopts.3x,v 1.42 2023/08/12 17:07:04 tom Exp $
+.TH curs_inopts 3X 2023-08-12 "ncurses 6.4" "Library calls"
.ie \n(.g .ds `` \(lq
.el .ds `` ``
.ie \n(.g .ds '' \(rq
.hy 0
.SH NAME
\fBcbreak\fP,
-\fBnocbreak\fP,
\fBecho\fP,
-\fBnoecho\fP,
\fBhalfdelay\fP,
\fBintrflush\fP,
+\fBis_cbreak\fP,
+\fBis_echo\fP,
+\fBis_nl\fP,
+\fBis_raw\fP,
\fBkeypad\fP,
\fBmeta\fP,
\fBnl\fP,
-\fBnonl\fP,
+\fBnocbreak\fP,
\fBnodelay\fP,
-\fBnotimeout\fP,
-\fBraw\fP,
+\fBnoecho\fP,
+\fBnonl\fP,
+\fBnoqiflush\fP,
\fBnoraw\fP,
+\fBnotimeout\fP,
\fBqiflush\fP,
-\fBnoqiflush\fP,
+\fBraw\fP,
\fBtimeout\fP,
\fBwtimeout\fP,
\fBtypeahead\fP \- \fBcurses\fP input options
.br
\fBint noecho(void);\fP
.sp
-\fBint intrflush(WINDOW *\fP\fIwin\fP\fB, bool \fP\fIbf\fP\fB);\fP
+\fBint intrflush(WINDOW *\fIwin\fB, bool \fIbf\fB);\fR
.br
-\fBint keypad(WINDOW *\fP\fIwin\fP\fB, bool \fP\fIbf\fP\fB);\fP
+\fBint keypad(WINDOW *\fIwin\fB, bool \fIbf\fB);\fR
.br
-\fBint meta(WINDOW *\fP\fIwin\fP\fB, bool \fP\fIbf\fP\fB);\fP
+\fBint meta(WINDOW *\fIwin\fB, bool \fIbf\fB);\fR
.br
-\fBint nodelay(WINDOW *\fP\fIwin\fP\fB, bool \fP\fIbf\fP\fB);\fP
+\fBint nodelay(WINDOW *\fIwin\fB, bool \fIbf\fB);\fR
.br
-\fBint notimeout(WINDOW *\fP\fIwin\fP\fB, bool \fP\fIbf\fP\fB);\fP
+\fBint notimeout(WINDOW *\fIwin\fB, bool \fIbf\fB);\fR
.sp
\fBint nl(void);\fP
.br
.br
\fBvoid noqiflush(void);\fP
.sp
-\fBint halfdelay(int \fP\fItenths\fP\fB);\fP
+\fBint halfdelay(int \fItenths\fB);\fR
.br
-\fBvoid timeout(int \fP\fIdelay\fP\fB);\fP
+\fBvoid timeout(int \fIdelay\fB);\fR
.br
-\fBvoid wtimeout(WINDOW *\fP\fIwin\fP\fB, int \fP\fIdelay\fP\fB);\fP
+\fBvoid wtimeout(WINDOW *\fIwin\fB, int \fIdelay\fB);\fR
+.sp
+\fBint typeahead(int \fIfd\fB);\fR
.sp
-\fBint typeahead(int \fP\fIfd\fP\fB);\fP
+/* extensions */
+.br
+\fBint is_cbreak(void);\fP
+.br
+\fBint is_echo(void);\fP
+.br
+\fBint is_nl(void);\fP
+.br
+\fBint is_raw(void);\fP
.br
.SH DESCRIPTION
The \fBncurses\fP library provides several functions which let an application
discussion of how these routines interact with \fBecho\fP and \fBnoecho\fP.]
.\"
.SS echo/noecho
-.PP
The \fBecho\fP and \fBnoecho\fP routines control whether characters typed by
the user are echoed by \fBgetch\fP(3X) as they are typed.
Echoing by the tty
\fBnocbreak\fP.]
.\"
.SS halfdelay
-.PP
The \fBhalfdelay\fP routine is used for half-delay mode, which is similar to
\fBcbreak\fP mode in that characters typed by the user are immediately
available to the program.
mode.
.\"
.SS intrflush
-.PP
If the \fBintrflush\fP option is enabled (\fIbf\fP is \fBTRUE\fP), and 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 window argument is ignored.
.\"
.SS keypad
-.PP
The \fBkeypad\fP option enables the keypad of the user's terminal.
If
enabled (\fIbf\fP is \fBTRUE\fP), the user can press a function key
The default value for keypad is \fBFALSE\fP.
.\"
.SS meta
-.PP
Initially, whether the terminal returns 7 or 8 significant bits on
input depends on the control mode of the tty driver [see \fBtermios\fP(3)].
To force 8 bits to be returned, invoke \fBmeta\fP(\fIwin\fP,
\fBFALSE\fP) is called.
.\"
.SS nl/nonl
-.PP
The \fBnl\fP and \fBnonl\fP routines control whether the underlying display
device translates the return key into newline on input.
.\"
.SS nodelay
-.PP
The \fBnodelay\fP option causes \fBgetch\fP to be a non-blocking call.
If no input is ready, \fBgetch\fP returns \fBERR\fP.
If disabled
(\fIbf\fP is \fBFALSE\fP), \fBgetch\fP waits until a key is pressed.
.SS notimeout
-.PP
When interpreting an escape sequence, \fBwgetch\fP(3X) sets a timer
while waiting for the next character.
-If \fBnotimeout(\fP\fIwin\fP,
+If \fBnotimeout(\fIwin\fR,
\fBTRUE\fP) is called, then \fBwgetch\fP 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.
.\"
.SS raw/noraw
-.PP
The \fBraw\fP and \fBnoraw\fP routines place the terminal into or out of raw
mode.
Raw mode is similar to \fBcbreak\fP mode, in that characters typed are
\fBcurses\fP.
.\"
.SS qiflush/noqiflush
-.PP
When the \fBnoqiflush\fP routine is used, normal flush of input and
output queues associated with the \fBINTR\fP, \fBQUIT\fP and
\fBSUSP\fP characters will not be done [see \fBtermios\fP(3)].
had not occurred, after the handler exits.
.\"
.SS timeout/wtimeout
-.PP
The \fBtimeout\fP and \fBwtimeout\fP routines set blocking or
non-blocking read for a given window.
If \fIdelay\fP is negative,
\fIdelay\fP milliseconds (where \fIdelay\fP is positive).
.\"
.SS typeahead
-.PP
The \fBcurses\fP library does \*(``line-breakout optimization\*(''
by looking for typeahead periodically while updating the screen.
If input is found, and it is coming from a tty,
functions with a window parameter will return an error if it is null.
Any function will also return an error if the terminal was not initialized.
Also,
-.RS
+.RS 3
.TP 5
\fBhalfdelay\fP
returns an error
if its parameter is outside the range 1..255.
.RE
+.SH EXTENSIONS
+This implementation provides four functions which may be used to detect
+if the corresponding flags were set or reset:
+.TS
+l l l
+_ _ _ _
+l l l .
+\fBQuery\fP \fBSet\fP \fBReset\fP
+is_cbreak cbreak nocbreak
+is_echo echo noecho
+is_nl nl nonl
+is_raw raw noraw
+.TE
+.PP
+In each case, the function returns
+.TP 5
+1
+if the flag is set,
+.TP 5
+0
+if the flag is reset, or
+.TP 5
+-1
+if the curses library was not initialized.
+.PP
+These routines are specific to ncurses.
+They were not supported on Version 7, BSD or System V implementations.
+It is recommended that any code depending on ncurses extensions
+be conditioned using NCURSES_VERSION.
.SH PORTABILITY
-These functions are described in the XSI Curses standard, Issue 4.
+Except as noted in the section on extensions,
+these functions are described in the XSI Curses standard, Issue 4.
.PP
The ncurses library obeys the XPG4 standard and the historical practice of the
AT&T curses implementations, in that the echo bit is cleared when curses