+.SH ENVIRONMENT
+.PP
+The following environment symbols are useful for customizing the
+runtime behavior of the \fBncurses\fR 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.
+Very few terminfo entries provide this feature.
+.PP
+Because this name is also used in development environments to represent
+the C compiler's name, \fBncurses\fR 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.
+If no value is found, \fBncurses\fR 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.
+If neither the \fBCOLUMNS\fP value nor the terminal's screen size is available,
+\fBncurses\fR uses the size which may be specified in the terminfo database
+(i.e., the \fBcols\fR capability).
+.PP
+It is important that your application use a correct size for the screen.
+This is not always possible because your application may be
+running on a host which does not honor NAWS (Negotiations About Window
+Size), or because you are temporarily running as another user.
+However, setting \fBCOLUMNS\fP and/or \fBLINES\fP overrides the library's
+use of the screen size obtained from the operating system.
+.PP
+Either \fBCOLUMNS\fP or \fBLINES\fP symbols may be specified independently.
+This is mainly useful to circumvent legacy misfeatures of terminal descriptions,
+e.g., xterm which commonly specifies a 65 line screen.
+For best results, \fBlines\fR and \fBcols\fR should not be specified in
+a terminal description for terminals which are run as emulations.
+.PP
+Use the \fBuse_env\fR function to disable all use of external environment
+(but not including system calls) to determine the screen size.
+Use the \fBuse_tioctl\fR 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.
+However, it is made a variable to accommodate unusual applications.
+.PP
+The most common instance where you may wish to change this value
+is to work with slow hosts, e.g., running on a network.
+If the host cannot read characters rapidly enough, it will have the same
+effect as if the terminal did not send characters rapidly enough.
+The library will still see a timeout.
+.PP
+Note that xterm mouse events are built up from character sequences
+received from the xterm.
+If your application makes heavy use of multiple-clicking, you may
+wish to lengthen this default value because the timeout applies
+to the composed multi-click event as well as the individual clicks.
+.PP
+In addition to the environment variable,
+this implementation provides a global variable with the same name.
+Portable applications should not rely upon the presence of ESCDELAY
+in either form,
+but setting the environment variable rather than the global variable
+does not create problems when compiling an application.
+.SS HOME
+Tells \fBncurses\fR where your home directory is.
+That is where it may read and write auxiliary terminal descriptions:
+.NS
+$HOME/.termcap
+$HOME/.terminfo
+.NE
+.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
+1 = left
+.br
+2 = right
+.br
+3 = middle.
+.NE
+.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\fR 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\fR(3X)).
+You may set the foreground and background color values with this environment
+variable by proving a 2-element list: foreground,background.
+For example, to tell ncurses to not assume anything
+about the colors, set this to "\-1,\-1".
+To make it green-on-black, set it to "2,0".
+Any positive value from zero to the terminfo \fBmax_colors\fR value is allowed.
+.SS NCURSES_CONSOLE2
+This applies only to the MinGW port of ncurses.
+.PP
+The \fBConsole2\fP program's handling of the Microsoft Console API call
+\fBCreateConsoleScreenBuffer\fP is defective.
+Applications which use this will hang.
+However, it is possible to simulate the action of this call by
+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,
+the environment variable is a list of one or more terminal names
+against which the \fBTERM\fP environment variable is matched.
+Setting it to an empty value disables the GPM interface;
+using the built-in support for xterm, etc.
+.PP
+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 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
+which run in a windowing environment and use curses-based applications.
+Terminal emulators can duplicate
+all of the important aspects of a hardware terminal, but they do not
+have the same limitations.
+The chief limitation of a hardware terminal from the standpoint
+of your application is the management of dataflow, i.e., timing.
+Unless a hardware terminal is interfaced into a terminal concentrator
+(which does flow control),
+it (or your application) must manage dataflow, preventing overruns.
+The cheapest solution (no hardware cost)
+is for your program to do this by pausing after
+operations that the terminal does slowly, such as clearing the display.
+.PP
+As a result, many terminal descriptions (including the vt100)
+have delay times embedded.
+You may wish to use these descriptions,
+but not want to pay the performance penalty.
+.PP
+Set the NCURSES_NO_PADDING environment variable to disable all but mandatory
+padding.
+Mandatory padding is used as a part of special control
+sequences such as \fIflash\fR.
+.SS NCURSES_NO_SETBUF
+This setting is obsolete.
+Before changes
+.RS 3
+.bP
+started with 5.9 patch 20120825
+and
+.bP
+continued
+though 5.9 patch 20130126
+.RE
+.PP
+\fBncurses\fR enabled buffered output during terminal initialization.
+This was done (as in SVr4 curses) for performance reasons.
+For testing purposes, both of \fBncurses\fR and certain applications,
+this feature was made optional.
+Setting the NCURSES_NO_SETBUF variable
+disabled output buffering, leaving the output in the original (usually
+line buffered) mode.
+.PP
+In the current implementation,
+ncurses performs its own buffering and does not require this workaround.
+It does not modify the buffering of the standard output.
+.PP
+The reason for the change was to make the behavior for interrupts and
+other signals more robust.
+One drawback is that certain nonconventional programs would mix
+ordinary stdio calls with ncurses calls and (usually) work.
+This is no longer possible since ncurses is not using
+the buffered standard output but its own output (to the same file descriptor).
+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\fR library
+checks for special cases where VT100 line-drawing (and the corresponding
+alternate character set capabilities) described in the terminfo are known
+to be missing.
+Specifically, when running in a UTF\-8 locale,
+the Linux console emulator and the GNU screen program ignore these.
+Ncurses checks the \fBTERM\fP environment variable for these.
+For other special cases, you should set this environment variable.
+Doing this tells ncurses to use Unicode values which correspond to
+the VT100 line-drawing glyphs.
+That works for the special cases cited,
+and is likely to work for terminal emulators.
+.PP
+When setting this variable, you should set it to a nonzero value.
+Setting it to zero (or to a nonnumber)
+disables the special check for "linux" and "screen".
+.PP
+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
+.RS 3
+.ft CW
+.sp
+.nf
+# linux console, if patched to provide working
+# 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,
+ U8#1, use=xterm,
+.fi
+.ft
+.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\fR debugging library
+checks the NCURSES_TRACE environment variable.
+If it is defined, to a numeric value, \fBncurses\fR calls the \fBtrace\fR
+function, using that value as the argument.
+.PP
+The argument values, which are defined in \fBcurses.h\fR, provide several
+types of information.
+When running with traces enabled, your application will write the
+file \fBtrace\fR 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
+\fBTERM\fP is commonly set by terminal emulators to help
+applications find a workable terminal description.
+Some of those choose a popular approximation, e.g.,
+\*(``ansi\*('', \*(``vt100\*('', \*(``xterm\*('' rather than an exact fit.
+Not infrequently, your application will have problems with that approach,
+e.g., incorrect function-key definitions.
+.PP
+If you set \fBTERM\fP in your environment,
+it has no effect on the operation of the terminal emulator.
+It only affects the way applications work within the terminal.
+Likewise, as a general rule (\fBxterm\fP being a rare exception),
+terminal emulators which allow you to
+specify \fBTERM\fP as a parameter or configuration value do
+not change their behavior to match that setting.
+.SS TERMCAP
+If the \fBncurses\fR library has been configured with \fItermcap\fR
+support, \fBncurses\fR will check for a terminal's description in
+termcap form if it is not available in the terminfo database.
+.PP
+The \fBTERMCAP\fP environment variable contains
+either a terminal description (with newlines stripped out),
+or a file name telling where the information denoted by
+the \fBTERM\fP environment variable exists.
+In either case, setting it directs \fBncurses\fR 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.
+Terminal descriptions (in terminal format) are stored in terminal databases:
+.bP
+Normally these are stored in a directory tree,
+using subdirectories named by the first letter of the terminal names therein.
+.IP
+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
+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
+/usr/share/terminfo.db
+.NE
+.IP
+rather than
+.NS
+/usr/share/terminfo/
+.NE
+.IP
+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.
+.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
+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)"
+export TERMINFO
+.NE
+.IP
+The compiled description is used if it corresponds to the terminal identified
+by the \fBTERM\fP variable.
+.PP
+Setting \fBTERMINFO\fP is the simplest,
+but not the only way to set location of the default terminal database.
+The complete list of database locations in order follows:
+.RS 3
+.bP
+the last terminal database to which \fBncurses\fR wrote,
+if any, is searched first
+.bP
+the location specified by the TERMINFO environment variable
+.bP
+$HOME/.terminfo
+.bP
+locations listed in the TERMINFO_DIRS environment variable
+.bP
+one or more locations whose names are configured and compiled into the
+ncurses library, i.e.,
+.RS 3
+.bP
+@TERMINFO_DIRS@ (corresponding to the TERMINFO_DIRS variable)
+.bP
+@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.
+The list is separated by colons (i.e., ":") on Unix, semicolons on OS/2 EMX.
+.PP
+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\fR checks
+the \fBTERMPATH\fP environment variable.
+This is a list of filenames separated by spaces or colons (i.e., ":") on Unix,
+semicolons on OS/2 EMX.
+.PP
+If the \fBTERMPATH\fP environment variable is not set,
+\fBncurses\fR looks in the files
+.NS
+/etc/termcap, /usr/share/misc/termcap and $HOME/.termcap,
+.NE
+.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
+$TERMINFO, $TERMINFO_DIRS, $TERMPATH, as well as $HOME.
+.NE
+.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
+developer using \fBncurses\fP:
+.TP 5
+\-\-disable\-overwrite
+The standard include for \fBncurses\fP is as noted in \fBSYNOPSIS\fP:
+.NS
+\fB#include <curses.h>\fR
+.NE
+.IP
+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
+\fB#include <ncurses/curses.h>\fR
+.NE
+.IP
+It also omits a symbolic link which would allow you to use \fB\-lcurses\fP
+to build executables.
+.TP 5
+\-\-enable\-widec
+The configure script renames the library and
+(if the \fB\-\-disable\-overwrite\fP option is used)
+puts the header files in a different subdirectory.
+All of the library names have a "w" appended to them,
+i.e., instead of
+.NS
+\fB\-lncurses\fR
+.NE
+.IP
+you link with
+.NS
+\fB\-lncursesw\fR
+.NE
+.IP
+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
+but that was only valid for XPG4 (1996).
+.bP
+Later, that was deemed conflicting with \fB_XOPEN_SOURCE\fP defined to 500.
+.bP
+As of mid-2018,
+none of the features in this implementation require a \fB_XOPEN_SOURCE\fP
+feature greater than 600.
+However, X/Open Curses, Issue 7 (2009) recommends defining it to 700.
+.bP
+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
+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
+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.
+.TP 5
+\-\-with\-pthread
+The configure script renames the library.
+All of the library names have a "t" appended to them
+(before any "w" added by \fB\-\-enable\-widec\fP).
+.IP
+The global variables such as \fBLINES\fP are replaced by macros to
+allow read-only access.
+At the same time, setter-functions are provided to set these values.
+Some applications (very few) may require changes to work with this convention.
+.TP 5
+\-\-with\-shared
+.TP
+\-\-with\-normal
+.TP
+\-\-with\-debug
+.TP
+\-\-with\-profile
+The shared and normal (static) library names differ by their suffixes,
+e.g., \fBlibncurses.so\fP and \fBlibncurses.a\fP.
+The debug and profiling libraries add a "_g" and a "_p" to the root
+names respectively,
+e.g., \fBlibncurses_g.a\fP and \fBlibncurses_p.a\fP.
+.TP 5
+\-\-with\-trace
+The \fBtrace\fP function normally resides in the debug library,
+but it is sometimes useful to configure this in the shared library.
+Configure scripts should check for the function's existence rather
+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