.\" authorization. *
.\"***************************************************************************
.\"
-.\" $Id: ncurses.3x,v 1.174 2023/09/23 22:58:27 tom Exp $
-.TH ncurses 3X 2023-09-23 "ncurses 6.4" "Library calls"
-.ie \n(.g .ds `` \(lq
-.el .ds `` ``
-.ie \n(.g .ds '' \(rq
-.el .ds '' ''
-.ie n .ds CW R
-.el \{
-.ie \n(.g .ds CW CR
-.el .ds CW CW
+.\" $Id: ncurses.3x,v 1.179 2023/10/14 19:29:06 tom Exp $
+.TH ncurses 3X 2023-10-14 "ncurses 6.4" "Library calls"
+.ie \n(.g \{\
+.ds `` \(lq
+.ds '' \(rq
+.\}
+.el \{\
+.ie t .ds `` ``
+.el .ds `` ""
+.ie t .ds '' ''
+.el .ds '' ""
.\}
.de bP
.ie n .IP \(bu 4
.el .IP \(bu 2
..
-.de NS
-.ie n .sp
-.el .sp .5
-.ie n .in +4
-.el .in +2
-.nf
-.ft \*(CW
-..
-.de NE
-.fi
-.ft R
-.ie n .in -4
-.el .in -2
-..
+.
.ds n 5
.ds d @TERMINFO@
.SH NAME
\fB\%ncurses\fP \-
character-cell terminal interface with optimized output
.SH SYNOPSIS
-\fB#include <curses.h>\fP
+.nf
+\fB#include <curses.h>
+.fi
.SH DESCRIPTION
The \fBncurses\fP library routines give the user a terminal-independent method
of updating character screens with reasonable optimization.
.SS Initialization
The library uses the locale which the calling program has initialized.
That is normally done with \fBsetlocale\fP(3):
-.NS
+.PP
+.RS 4
+.EX
\fBsetlocale(LC_ALL, "");\fP
-.NE
+.EE
+.RE
.PP
If the locale is not initialized,
the library assumes that characters are printable as in ISO\-8859\-1,
To get character-at-a-time input without echoing (most
interactive, screen oriented programs want this), the following
sequence should be used:
-.NS
+.PP
+.RS 4
+.EX
\fBinitscr(); cbreak(); noecho();\fP
-.NE
+.EE
+.RE
.PP
Most programs would additionally use the sequence:
-.NS
+.PP
+.RS 4
+.EX
\fBintrflush(stdscr, FALSE);\fP
\fBkeypad(stdscr, TRUE);\fP
-.NE
+.EE
+.RE
.PP
Before a \fBcurses\fP program is run, the tab stops of the terminal
should be set and its initialization strings, if defined, must be output.
This can be done by executing the \fB@TPUT@ init\fP command
after the shell environment variable \fBTERM\fP has been exported.
-\fB@TSET@(1)\fP is usually responsible for doing this.
-[See \fBterminfo\fP(\*n) for further details.]
+(The BSD-style \fB\%@TSET@\fP(1) utility also performs this function.)
+See subsection \*(``Tabs and Initialization\*('' of \fBterminfo\fP(\*n).
.SS Datatypes
The \fBncurses\fP library permits manipulation of data structures,
called \fIwindows\fP, which can be thought of as two-dimensional
standard place.
For example, if \fBTERM\fP is set to \fBatt4424\fP, then the
compiled terminal definition is found in
-.NS
+.PP
+.RS 4
+.EX
\fB\*d/a/att4424\fP.
-.NE
+.EE
+.RE
.PP
(The \fBa\fP is copied from the first letter of \fBatt4424\fP to avoid
creation of huge directories.) However, if \fBTERMINFO\fP is set to
\fB$HOME/myterms\fP, \fBcurses\fP first checks
-.NS
+.PP
+.RS 4
+.EX
\fB$HOME/myterms/a/att4424\fP,
-.NE
+.EE
+.RE
.PP
and if that fails, it then checks
-.NS
+.PP
+.RS 4
+.EX
\fB\*d/a/att4424\fP.
-.NE
+.EE
+.RE
.PP
This is useful for developing experimental definitions or when write
permission in \fB\*d\fP is not available.
.SS HOME
Tells \fBncurses\fP where your home directory is.
That is where it may read and write auxiliary terminal descriptions:
-.NS
+.PP
+.RS 4
+.EX
$HOME/.termcap
$HOME/.terminfo
-.NE
+.EE
+.RE
.SS LINES
Like COLUMNS, specify the height of the screen in characters.
See COLUMNS for a detailed description.
It specifies the order of buttons on the mouse.
OS/2 numbers a 3-button mouse inconsistently from other
platforms:
-.NS
+.PP
+.RS 4
+.EX
1 = left
-.br
2 = right
-.br
3 = middle.
-.NE
+.EE
+.RE
.PP
This variable lets you customize the mouse.
The variable must be three numeric digits 1\-3 in any order, e.g., 123 or 321.
ncurses checks for an extended terminfo capability \fBU8\fP.
This is a numeric capability which can be compiled using \fB@TIC@\ \-x\fP.
For example
+.PP
.RS 3
-.ft \*(CW
-.sp
-.nf
+.EX
# linux console, if patched to provide working
-# VT100 shift-in/shift-out, with corresponding font.
-linux-vt100|linux console with VT100 line-graphics,
+# VT100 shift\-in/shift\-out, with corresponding font.
+linux\-vt100|linux console with VT100 line\-graphics,
U8#0, use=linux,
-.sp
+
# uxterm with vt100Graphics resource set to false
-xterm-utf8|xterm relying on UTF-8 line-graphics,
+xterm\-utf8|xterm relying on UTF\-8 line\-graphics,
U8#1, use=xterm,
-.fi
-.ft R
+.EE
.RE
.PP
The name \*(``U8\*('' is chosen to be two characters,
This is the scheme used in System V, which legacy Unix systems use,
and the \fBTERMINFO\fP variable is used by \fIcurses\fP applications on those
systems to override the default location of the terminal database.
-.bP
+.IP \(bu 4
If \fBncurses\fP is built to use hashed databases,
then each entry in this list may be the path of a hashed database file, e.g.,
-.NS
+.RS 4
+.PP
+.RS 4
+.EX
/usr/share/terminfo.db
-.NE
-.IP
+.EE
+.RE
+.PP
rather than
-.NS
+.PP
+.RS 4
+.EX
/usr/share/terminfo/
-.NE
-.IP
+.EE
+.RE
+.PP
The hashed database uses less disk-space and is a little faster than the
directory tree.
However,
some applications assume the existence of the directory tree,
reading it directly
rather than using the terminfo library calls.
+.RE
.bP
If \fBncurses\fP is built with a support for reading termcap files
directly, then an entry in this list may be the path of a termcap file.
-.bP
+.IP \(bu 4
If the \fBTERMINFO\fP variable begins with
\*(``hex:\*('' or \*(``b64:\*('',
\fBncurses\fP uses the remainder of that variable as a compiled terminal
description.
You might produce the base64 format using \fBinfocmp\fP(1M):
-.NS
-TERMINFO="$(infocmp -0 -Q2 -q)"
+.RS 4
+.PP
+.RS 4
+.EX
+TERMINFO="$(infocmp \-0 \-Q2 \-q)"
export TERMINFO
-.NE
-.IP
+.EE
+.RE
+.PP
The compiled description is used if it corresponds to the terminal identified
by the \fBTERM\fP variable.
+.RE
.PP
Setting \fBTERMINFO\fP is the simplest,
but not the only way to set location of the default terminal database.
.PP
If the \fBTERMPATH\fP environment variable is not set,
\fBncurses\fP looks in the files
-.NS
+.PP
+.RS 4
+.EX
/etc/termcap, /usr/share/misc/termcap and $HOME/.termcap,
-.NE
+.EE
+.RE
.PP
in that order.
.PP
The library may be configured to disregard the following variables when the
current user is the superuser (root), or if the application uses setuid or
setgid permissions:
-.NS
+.PP
+.RS 4
+.EX
$TERMINFO, $TERMINFO_DIRS, $TERMPATH, as well as $HOME.
-.NE
+.EE
+.RE
.SH ALTERNATE CONFIGURATIONS
Several different configurations are possible,
depending on the configure script options used when building \fBncurses\fP.
.TP 5
\-\-disable\-overwrite
The standard include for \fBncurses\fP is as noted in \fBSYNOPSIS\fP:
-.NS
+.RS 5
+.PP
+.RS 4
+.EX
\fB#include <curses.h>\fP
-.NE
-.IP
+.EE
+.RE
+.PP
This option is used to avoid filename conflicts when \fBncurses\fP
is not the main implementation of curses of the computer.
If \fBncurses\fP is installed disabling overwrite, it puts its headers in
a subdirectory, e.g.,
-.NS
+.PP
+.RS 4
+.EX
\fB#include <ncurses/curses.h>\fP
-.NE
-.IP
+.EE
+.RE
+.PP
It also omits a symbolic link which would allow you to use \fB\-lcurses\fP
to build executables.
+.RE
.TP 5
\-\-enable\-widec
The configure script renames the library and
puts the header files in a different subdirectory.
All of the library names have a \*(``w\*('' appended to them,
i.e., instead of
-.NS
+.RS 5
+.PP
+.RS 4
+.EX
\fB\-lncurses\fP
-.NE
-.IP
+.EE
+.RE
+.PP
you link with
-.NS
+.PP
+.RS 4
+.EX
\fB\-lncursesw\fP
-.NE
-.IP
+.EE
+.RE
+.PP
You must also enable the wide-character features in the header file
when compiling for the wide-character library
to use the extended (wide-character) functions.
The symbol which enables these features has changed since XSI Curses, Issue 4:
-.RS
.bP
Originally, the wide-character feature required the symbol
\fB_XOPEN_SOURCE_EXTENDED\fP
with the caveat that some other header file than \fBcurses.h\fP
may require a specific value for \fB_XOPEN_SOURCE\fP
(or a system-specific symbol).
-.RE
-.IP
+.PP
The \fBcurses.h\fP file which is installed for the wide-character
library is designed to be compatible with the normal library's header.
Only the size of the \fBWINDOW\fP structure differs, and very few
applications require more than a pointer to \fBWINDOW\fPs.
-.IP
+.PP
If the headers are installed allowing overwrite,
the wide-character library's headers should be installed last,
to allow applications to be built using either library
from the same set of headers.
+.RE
.TP 5
\-\-with\-pthread
The configure script renames the library.
than assuming it is always in the debug library.
.SH FILES
.TP 5
-@DATADIR@/tabset
-directory containing initialization files for the terminal capability database
-@TERMINFO@
-terminal capability database
-.SH SEE ALSO
-\fBterminfo\fP(\*n) and related pages whose names begin
-\*(``curs_\*('' for detailed routine descriptions.
-.br
-\fBcurs_variables\fP(3X)
-.br
-\fBuser_caps\fP(5) for user-defined capabilities
+.I @DATADIR@/tabset
+tab stop initialization database
+.TP
+.I \*d
+compiled terminal capability database
.SH EXTENSIONS
The \fBncurses\fP library can be compiled with an option (\fB\-DUSE_GETCAP\fP)
that falls back to the old-style /etc/termcap file if the terminal setup code
.SH AUTHORS
Zeyd M. Ben-Halim, Eric S. Raymond, Thomas E. Dickey.
Based on \fIpcurses\fP by Pavel Curtis.
+.SH SEE ALSO
+\fB\%terminfo\fP(\*n) and related pages whose names begin
+\*(``curs_\*('' for detailed routine descriptions.
+.br
+\fB\%curs_variables\fP(3X)
+.br
+\fB\%user_caps\fP(5) for user-defined capabilities