]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - man/ncurses.3x
ncurses 6.4 - patch 20231007
[ncurses.git] / man / ncurses.3x
index dc308a6ecbb13a24bb1fed5635e28341349d5fc5..170b50c8833f119155545ebbbcb9ef76a5014738 100644 (file)
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: ncurses.3x,v 1.157 2023/04/23 23:17:26 tom Exp $
-.hy 0
-.TH ncurses 3X ""
-.ie \n(.g .ds `` \(lq
-.el       .ds `` ``
-.ie \n(.g .ds '' \(rq
-.el       .ds '' ''
+.\" $Id: ncurses.3x,v 1.178 2023/10/07 22:17:08 tom Exp $
+.TH ncurses 3X 2023-10-07 "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 C                  \" Courier
-..
-.de NE
-.fi
-.ft R
-.ie n  .in -4
-.el    .in -2
-..
+.
 .ds n 5
 .ds d @TERMINFO@
 .SH NAME
-\fBncurses\fP \- CRT screen handling and optimization package
+\fB\%ncurses\fP \-
+character-cell terminal interface with optimized output
 .SH SYNOPSIS
-\fB#include <curses.h>\fP
-.br
+.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.
@@ -89,8 +83,9 @@ A program using these routines must be linked with the \fB\-lncurses\fP option,
 or (if it has been generated) with the debugging library \fB\-lncurses_g\fP.
 (Your system integrator may also have installed these libraries under
 the names \fB\-lcurses\fP and \fB\-lcurses_g\fP.)
-The ncurses_g library generates trace logs (in a file called \*(``trace\*('' in the
-current directory) that describe curses actions.
+The ncurses_g library generates trace logs
+(in a file called \*(``trace\*('' in the current directory)
+that describe curses actions.
 See also the section on \fBALTERNATE CONFIGURATIONS\fP.
 .PP
 The \fBncurses\fP package supports: overall screen, window and pad
@@ -99,12 +94,14 @@ terminal and \fBcurses\fP input and output options; environment query
 routines; color manipulation; use of soft label keys; terminfo capabilities;
 and access to low-level terminal-manipulation routines.
 .SS Initialization
-.PP
 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,
@@ -121,15 +118,21 @@ The routine \fBendwin\fP(3X) must be called before exiting.
 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.
@@ -138,7 +141,6 @@ 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.]
 .SS Datatypes
-.PP
 The \fBncurses\fP library permits manipulation of data structures,
 called \fIwindows\fP, which can be thought of as two-dimensional
 arrays of characters representing all or part of a CRT screen.
@@ -188,7 +190,6 @@ The video attributes, line
 drawing characters, and input values use names, defined in \fB<curses.h>\fP,
 such as \fBA_REVERSE\fP, \fBACS_HLINE\fP, and \fBKEY_LEFT\fP.
 .SS Environment variables
-.PP
 If the environment variables \fBLINES\fP and \fBCOLUMNS\fP are set, or if the
 program is executing in a window environment, line and column information in
 the environment will override information read by \fIterminfo\fP.
@@ -201,21 +202,30 @@ If the environment variable \fBTERMINFO\fP is defined, any program using
 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.
@@ -315,7 +325,6 @@ There is a naming convention which relates many of the normal/wide variants:
 a \*(``_w\*('' is inserted into the name.
 For example, \fBwaddch\fP becomes \fBwadd_wch\fP.
 .RE
-.PP
 .\"
 .SS Routine Name Index
 The following table lists the \fBcurses\fP routines provided in
@@ -463,16 +472,20 @@ insstr/\fBcurs_insstr\fP(3X)
 instr/\fBcurs_instr\fP(3X)
 intrflush/\fBcurs_inopts\fP(3X)
 inwstr/\fBcurs_inwstr\fP(3X)
+is_cbreak/\fBcurs_inopts\fP(3X)*
 is_cleared/\fBcurs_opaque\fP(3X)*
+is_echo/\fBcurs_inopts\fP(3X)*
 is_idcok/\fBcurs_opaque\fP(3X)*
 is_idlok/\fBcurs_opaque\fP(3X)*
 is_immedok/\fBcurs_opaque\fP(3X)*
 is_keypad/\fBcurs_opaque\fP(3X)*
 is_leaveok/\fBcurs_opaque\fP(3X)*
 is_linetouched/\fBcurs_touch\fP(3X)
+is_nl/\fBcurs_inopts\fP(3X)*
 is_nodelay/\fBcurs_opaque\fP(3X)*
 is_notimeout/\fBcurs_opaque\fP(3X)*
 is_pad/\fBcurs_opaque\fP(3X)*
+is_raw/\fBcurs_inopts\fP(3X)*
 is_scrollok/\fBcurs_opaque\fP(3X)*
 is_subwin/\fBcurs_opaque\fP(3X)*
 is_syncok/\fBcurs_opaque\fP(3X)*
@@ -594,7 +607,7 @@ notimeout/\fBcurs_inopts\fP(3X)
 overlay/\fBcurs_overlay\fP(3X)
 overwrite/\fBcurs_overlay\fP(3X)
 pair_content/\fBcurs_color\fP(3X)
-pecho_wchar/\fBcurs_pad\fP(3X)*
+pecho_wchar/\fBcurs_pad\fP(3X)
 pechochar/\fBcurs_pad\fP(3X)
 pnoutrefresh/\fBcurs_pad\fP(3X)
 prefresh/\fBcurs_pad\fP(3X)
@@ -644,7 +657,7 @@ slk_refresh/\fBcurs_slk\fP(3X)
 slk_restore/\fBcurs_slk\fP(3X)
 slk_set/\fBcurs_slk\fP(3X)
 slk_touch/\fBcurs_slk\fP(3X)
-slk_wset/\fBcurs_slk\fP(3X)*
+slk_wset/\fBcurs_slk\fP(3X)
 standend/\fBcurs_attr\fP(3X)
 standout/\fBcurs_attr\fP(3X)
 start_color/\fBcurs_color\fP(3X)
@@ -663,7 +676,7 @@ tigetflag/\fBcurs_terminfo\fP(3X)
 tigetnum/\fBcurs_terminfo\fP(3X)
 tigetstr/\fBcurs_terminfo\fP(3X)
 timeout/\fBcurs_inopts\fP(3X)
-tiparm/\fBcurs_terminfo\fP(3X)*
+tiparm/\fBcurs_terminfo\fP(3X)
 tiparm_s/\fBcurs_terminfo\fP(3X)*
 tiscan_s/\fBcurs_terminfo\fP(3X)*
 touchline/\fBcurs_touch\fP(3X)
@@ -818,12 +831,10 @@ are provided both as macros and functions.
 .PP
 Routines that return pointers return \fBNULL\fP on error.
 .SH ENVIRONMENT
-.PP
 The following environment symbols are useful for customizing the
 runtime behavior of the \fBncurses\fP library.
 The most important ones have been already discussed in detail.
 .SS CC command-character
-.PP
 When set, change occurrences of the command_character
 (i.e., the \fBcmdch\fP capability)
 of the loaded terminfo entries to the value of this variable.
@@ -833,7 +844,6 @@ Because this name is also used in development environments to represent
 the C compiler's name, \fBncurses\fP ignores it if it does not happen to
 be a single character.
 .SS BAUDRATE
-.PP
 The debugging library checks this environment variable when the application
 has redirected output to a file.
 The variable's numeric value is used for the baudrate.
@@ -841,7 +851,6 @@ If no value is found, \fBncurses\fP uses 9600.
 This allows testers to construct repeatable test-cases
 that take into account costs that depend on baudrate.
 .SS COLUMNS
-.PP
 Specify the width of the screen in characters.
 Applications running in a windowing environment usually are able to
 obtain the width of the window in which they are executing.
@@ -867,7 +876,6 @@ Use the \fBuse_env\fP function to disable all use of external environment
 Use the \fBuse_tioctl\fP function to update \fBCOLUMNS\fP or \fBLINES\fP
 to match the screen size obtained from system calls or the terminal database.
 .SS ESCDELAY
-.PP
 Specifies the total time, in milliseconds, for which ncurses will
 await a character sequence, e.g., a function key.
 The default value, 1000 milliseconds, is enough for most uses.
@@ -894,33 +902,34 @@ does not create problems when compiling an application.
 .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
-.PP
 Like COLUMNS, specify the height of the screen in characters.
 See COLUMNS for a detailed description.
 .SS MOUSE_BUTTONS_123
-.PP
 This applies only to the OS/2 EMX port.
 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.
 If it is not specified, \fBncurses\fP uses 132.
 .SS NCURSES_ASSUMED_COLORS
-.PP
 Override the compiled-in assumption that the
 terminal's default colors are white-on-black
 (see \fBdefault_colors\fP(3X)).
@@ -941,7 +950,6 @@ mapping coordinates,
 explicitly saving and restoring the original screen contents.
 Setting the environment variable \fBNCGDB\fP has the same effect.
 .SS NCURSES_GPM_TERMS
-.PP
 This applies only to ncurses configured to use the GPM interface.
 .PP
 If present,
@@ -953,20 +961,17 @@ using the built-in support for xterm, etc.
 If the environment variable is absent,
 ncurses will attempt to open GPM if \fBTERM\fP contains \*(``linux\*(''.
 .SS NCURSES_NO_HARD_TABS
-.PP
 \fBNcurses\fP may use tabs as part of the cursor movement optimization.
 In some cases,
 your terminal driver may not handle these properly.
 Set this environment variable to disable the feature.
 You can also adjust your \fBstty\fP(1) settings to avoid the problem.
 .SS NCURSES_NO_MAGIC_COOKIE
-.PP
 Some terminals use a magic-cookie feature which requires special handling
 to make highlighting and other video attributes display properly.
 You can suppress the highlighting entirely for these terminals by
 setting this environment variable.
 .SS NCURSES_NO_PADDING
-.PP
 Most of the terminal descriptions in the terminfo database are written
 for real \*(``hardware\*('' terminals.
 Many people use terminal emulators
@@ -1026,7 +1031,6 @@ As a special case, the low-level calls such as \fBputp\fP still use the
 standard output.
 But high-level curses calls do not.
 .SS NCURSES_NO_UTF8_ACS
-.PP
 During initialization, the \fBncurses\fP library
 checks for special cases where VT100 line-drawing (and the corresponding
 alternate character set capabilities) described in the terminfo are known
@@ -1048,27 +1052,24 @@ As an alternative to the environment variable,
 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
+.EE
 .RE
 .PP
 The name \*(``U8\*('' is chosen to be two characters,
 to permit it to be used by applications that use ncurses'
 termcap interface.
 .SS NCURSES_TRACE
-.PP
 During initialization, the \fBncurses\fP debugging library
 checks the NCURSES_TRACE environment variable.
 If it is defined, to a numeric value, \fBncurses\fP calls the \fBtrace\fP
@@ -1081,7 +1082,6 @@ file \fBtrace\fP to the current directory.
 .PP
 See \fBcurs_trace\fP(3X) for more information.
 .SS TERM
-.PP
 Denotes your terminal type.
 Each terminal type is distinct, though many are similar.
 .PP
@@ -1111,7 +1111,6 @@ the \fBTERM\fP environment variable exists.
 In either case, setting it directs \fBncurses\fP to ignore
 the usual place for this information, e.g., /etc/termcap.
 .SS TERMINFO
-.PP
 \fBncurses\fP can be configured to read from multiple terminal databases.
 The \fBTERMINFO\fP variable overrides the location for
 the default terminal database.
@@ -1123,40 +1122,53 @@ using subdirectories named by the first letter of the terminal names therein.
 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.
@@ -1181,9 +1193,7 @@ ncurses library, i.e.,
 @TERMINFO@ (corresponding to the TERMINFO variable)
 .RE
 .RE
-.PP
 .SS TERMINFO_DIRS
-.PP
 Specifies a list of locations to search for terminal descriptions.
 Each location in the list is a terminal database as described in
 the section on the \fBTERMINFO\fP variable.
@@ -1192,7 +1202,6 @@ The list is separated by colons (i.e., ":") on Unix, semicolons on OS/2 EMX.
 There is no corresponding feature in System V terminfo;
 it is an extension developed for \fBncurses\fP.
 .SS TERMPATH
-.PP
 If \fBTERMCAP\fP does not hold a file name then \fBncurses\fP checks
 the \fBTERMPATH\fP environment variable.
 This is a list of filenames separated by spaces or colons (i.e., ":") on Unix,
@@ -1200,20 +1209,25 @@ semicolons on OS/2 EMX.
 .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
-.PP
 Several different configurations are possible,
 depending on the configure script options used when building \fBncurses\fP.
 There are a few main options whose effects are visible to the applications
@@ -1221,20 +1235,28 @@ developer using \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
@@ -1242,20 +1264,26 @@ 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
@@ -1272,17 +1300,17 @@ Alternatively, you can enable the feature by defining \fBNCURSES_WIDECHAR\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.
@@ -1344,13 +1372,6 @@ than assuming it is always in the debug library.
 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
 .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
@@ -1398,7 +1419,6 @@ A small number of local differences (that is, individual differences between
 the XSI Curses and \fBncurses\fP calls) are described in \fBPORTABILITY\fP
 sections of the library man pages.
 .SS Error checking
-.PP
 In many cases, X/Open Curses is vague about error conditions,
 omitting some of the SVr4 documentation.
 .PP
@@ -1411,7 +1431,6 @@ to tell an application which of several possible errors were detected.
 Relying on this (or some other) extension will adversely affect the
 portability of curses applications.
 .SS Extensions versus portability
-.PP
 Most of the extensions provided by ncurses have not been standardized.
 Some have been incorporated into other implementations, such as
 PDCurses or NetBSD curses.
@@ -1446,7 +1465,6 @@ This implementation can also be configured to provide a set of functions which
 improve the ability to manage multiple screens.
 See \fBcurs_sp_funcs\fP(3X) for details.
 .SS Padding differences
-.PP
 In historic curses versions, delays embedded in the capabilities \fBcr\fP,
 \fBind\fP, \fBcub1\fP, \fBff\fP and \fBtab\fP activated corresponding delay
 bits in the UNIX tty driver.
@@ -1550,10 +1568,16 @@ to include <stdarg.h> before <curses.h> because they either
 have allowed for a special type, or (like ncurses) include <stdarg.h>
 directly to provide a portable interface.
 .SH NOTES
-.PP
 If standard output from a \fBncurses\fP program is re-directed to something
 which is not a tty, screen updates will be directed to standard error.
 This was an undocumented feature of AT&T System V Release 3 curses.
 .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