.\" authorization. *
.\"***************************************************************************
.\"
-.\" $Id: curs_util.3x,v 1.66 2023/03/11 20:28:02 tom Exp $
-.TH curs_util 3X ""
+.\" $Id: curs_util.3x,v 1.77 2023/09/16 23:37:03 tom Exp $
+.TH curs_util 3X 2023-09-16 "ncurses 6.4" "Library calls"
.ie \n(.g .ds `` \(lq
.el .ds `` ``
.ie \n(.g .ds '' \(rq
.ie n .IP \(bu 4
.el .IP \(bu 2
..
-.na
-.hy 0
.SH NAME
-\fBdelay_output\fP,
-\fBfilter\fP,
-\fBflushinp\fP,
-\fBgetwin\fP,
-\fBkey_name\fP,
-\fBkeyname\fP,
-\fBnofilter\fP,
-\fBputwin\fP,
-\fBunctrl\fP,
-\fBuse_env\fP,
-\fBuse_tioctl\fP,
-\fBwunctrl\fP \- miscellaneous \fBcurses\fP utility routines
-.ad
-.hy
+\fB\%delay_output\fP,
+\fB\%filter\fP,
+\fB\%flushinp\fP,
+\fB\%getwin\fP,
+\fB\%key_name\fP,
+\fB\%keyname\fP,
+\fB\%nofilter\fP,
+\fB\%putwin\fP,
+\fB\%unctrl\fP,
+\fB\%use_env\fP,
+\fB\%use_tioctl\fP,
+\fB\%wunctrl\fP \-
+miscellaneous \fIcurses\fR utility routines
.SH SYNOPSIS
\fB#include <curses.h>\fP
.sp
\fBconst char *key_name(wchar_t \fIw\fB);\fR
.sp
\fBvoid filter(void);\fP
-.br
-\fBvoid nofilter(void);\fP
.sp
\fBvoid use_env(bool \fIf\fB);\fR
-.br
-\fBvoid use_tioctl(bool \fIf\fB);\fR
.sp
\fBint putwin(WINDOW *\fIwin\fB, FILE *\fIfilep\fB);\fR
.br
\fBint delay_output(int \fIms\fB);\fR
.br
\fBint flushinp(void);\fP
+.sp
+/* extensions */
.br
+\fBvoid nofilter(void);\fP
+.br
+\fBvoid use_tioctl(bool \fIf\fB);\fR
.SH DESCRIPTION
.SS unctrl
-.PP
The \fBunctrl\fP routine returns a character string which is a printable
-representation of the character \fIc\fP, ignoring attributes.
-Control characters are displayed in the \fB^\fIX\fR notation.
-Printing characters are displayed as is.
-.PP
-The corresponding \fBwunctrl\fP returns a printable representation of
-a wide character.
-.SS keyname/key_name
-.PP
-The \fBkeyname\fP routine returns a character string
-corresponding to the key \fIc\fP:
+representation of the character \fIc\fP:
.bP
Printable characters are displayed as themselves,
e.g., a one-character string containing the key.
.bP
Control characters are displayed in the \fB^\fIX\fR notation.
.bP
+Printing characters are displayed as is.
+.bP
DEL (character 127) is displayed as \fB^?\fP.
.bP
Values above 128 are either meta characters
or are displayed as themselves.
In the latter case, the values may not be printable;
this follows the X/Open specification.
+.PP
+The corresponding \fBwunctrl\fP returns a printable representation of
+a complex character \fIc\fP.
+.PP
+In both \fBunctrl\fP and \fBwunctrl\fP the attributes and color associated
+with the character parameter are ignored.
+.SS keyname/key_name
+The \fBkeyname\fP routine returns a character string
+corresponding to the key \fIc\fP.
+Key codes are different from character codes.
.bP
-Values above 256 may be the names of the names of function keys.
+Key codes below 256 are characters.
+They are displayed using \fBunctrl\fP.
.bP
-Otherwise (if there is no corresponding name) the function returns null,
-to denote an error.
+Values above 256 may be the codes for function keys.
+The function key name is displayed.
+.bP
+Otherwise (if there is no corresponding name and the key is not a character)
+the function returns null, to denote an error.
X/Open also lists an \*(``UNKNOWN KEY\*('' return value,
which some implementations return rather than null.
.LP
-The corresponding \fBkey_name\fP returns a character string corresponding
+The corresponding \fBkey_name\fP returns
+a multibyte character string corresponding
to the wide-character value \fIw\fP.
-The two functions do not return the same set of strings;
-the latter returns null where the former would display a meta character.
+The two functions (\fBkeyname\fP and \fBkey_name\fP)
+do not return the same set of strings:
+.bP
+\fBkeyname\fP returns null where \fBkey_name\fP would display a meta character.
+.bP
+\fBkey_name\fP does not return the name of a function key.
.SS filter/nofilter
-.PP
The \fBfilter\fP routine, if used, must be called before \fBinitscr\fP or
\fBnewterm\fP are called.
Calling \fBfilter\fP causes these changes in initialization:
The limitation arises because the \fBfilter\fP routine modifies the
in-memory copy of the terminal information.
.SS use_env
-.PP
The \fBuse_env\fP routine, if used,
should be called before \fBinitscr\fP or
\fBnewterm\fP are called
\fBNcurses\fP also updates the screen size in response to \fBSIGWINCH\fP,
unless overridden by the \fBLINES\fP or \fBCOLUMNS\fP environment variables,
.SS use_tioctl
-.PP
The \fBuse_tioctl\fP routine, if used,
should be called before \fBinitscr\fP or \fBnewterm\fP are called
(because those compute the screen size).
.PP
The \fBuse_env\fP and \fBuse_tioctl\fP routines combine as
summarized here:
+.PP
.TS
center tab(/);
l l l
T}
.TE
.SS putwin/getwin
-.PP
The \fBputwin\fP routine writes all data associated
with window (or pad) \fIwin\fP into
the file to which \fIfilep\fP points.
created in the application using \fBinit_pair\fP,
they will not be colored when the window is refreshed.
.SS delay_output
-.PP
The \fBdelay_output\fP routine inserts an \fIms\fP millisecond pause
in output.
This routine should not be used extensively because
If no padding character is specified,
this uses \fBnapms\fP to perform the delay.
.SS flushinp
-.PP
The \fBflushinp\fP routine throws away any typeahead that has been typed by the
user and has not yet been read by the program.
.SH RETURN VALUE
.RE
.SH PORTABILITY
.SS filter
-.PP
The SVr4 documentation describes the action of \fBfilter\fP only in the vaguest
terms.
The description here is adapted from the XSI Curses standard (which
erroneously fails to describe the disabling of \fBcuu\fP).
.SS keyname
-.PP
The \fBkeyname\fP function may return the names of user-defined
string capabilities which are defined in the terminfo entry via the \fB\-x\fP
option of \fB@TIC@\fP.
The \fBuse_extended_names\fP(3X) function controls whether this data is
loaded when the terminal description is read by the library.
.SS nofilter/use_tioctl
-.PP
The \fBnofilter\fP and \fBuse_tioctl\fP routines are specific to \fBncurses\fP.
They were not supported on Version 7, BSD or System V implementations.
It is recommended that any code depending on \fBncurses\fP extensions
be conditioned using NCURSES_VERSION.
.SS putwin/getwin file-format
-.PP
The \fBputwin\fP and \fBgetwin\fP functions have several issues with
portability:
.bP
This implementation reduces the problem on writes by flushing the output.
However, reading from a file written using mixed schemes may not be successful.
.SS unctrl/wunctrl
-.PP
The XSI Curses standard, Issue 4 describes these functions.
It states that \fBunctrl\fP and \fBwunctrl\fP will return a null pointer if
unsuccessful, but does not define any error conditions.
matching the behavior of SVr4 curses.
Other implementations may not do that.
.SS use_env/use_tioctl
-.PP
If \fBncurses\fP is configured to provide the sp-functions extension,
the state of \fBuse_env\fP and \fBuse_tioctl\fP may be updated before
creating each \fIscreen\fP rather than once only
(\fBcurs_sp_funcs\fP(3X)).
This feature of \fBuse_env\fP
-is not provided by other implementation of curses.
+is not provided by other implementations of curses.
.SH SEE ALSO
\fBcurses\fP(3X),
\fBcurs_initscr\fP(3X),