778
791
ing the runtime behavior of the <STRONG>ncurses</STRONG> library. The most
779
792
important ones have been already discussed in detail.
781
CC When set, change occurrences of the command_character
782
(i.e., the <STRONG>cmdch</STRONG> capability) of the loaded terminfo
783
entries to the value of this variable. Very few ter-
784
minfo entries provide this feature.
786
Because this name is also used in development envi-
787
ronments to represent the C compiler's name, <STRONG>ncurses</STRONG>
788
ignores it if it does not happen to be a single char-
792
The debugging library checks this environment vari-
793
able when the application has redirected output to a
794
file. The variable's numeric value is used for the
795
baudrate. If no value is found, <STRONG>ncurses</STRONG> uses 9600.
796
This allows testers to construct repeatable test-
797
cases that take into account costs that depend on
801
Specify the width of the screen in characters.
802
Applications running in a windowing environment usu-
803
ally are able to obtain the width of the window in
804
which they are executing. If neither the <STRONG>COLUMNS</STRONG>
805
value nor the terminal's screen size is available,
806
<STRONG>ncurses</STRONG> uses the size which may be specified in the
807
terminfo database (i.e., the <STRONG>cols</STRONG> capability).
809
It is important that your application use a correct
810
size for the screen. This is not always possible
811
because your application may be running on a host
812
which does not honor NAWS (Negotiations About Window
813
Size), or because you are temporarily running as
814
another user. However, setting <STRONG>COLUMNS</STRONG> and/or <STRONG>LINES</STRONG>
815
overrides the library's use of the screen size
816
obtained from the operating system.
818
Either <STRONG>COLUMNS</STRONG> or <STRONG>LINES</STRONG> symbols may be specified
819
independently. This is mainly useful to circumvent
820
legacy misfeatures of terminal descriptions, e.g.,
821
xterm which commonly specifies a 65 line screen. For
822
best results, <STRONG>lines</STRONG> and <STRONG>cols</STRONG> should not be specified
823
in a terminal description for terminals which are run
826
Use the <STRONG>use_env</STRONG> function to disable all use of exter-
827
nal environment (but not including system calls) to
828
determine the screen size. Use the <STRONG>use_tioctl</STRONG> func-
829
tion to update <STRONG>COLUMNS</STRONG> or <STRONG>LINES</STRONG> to match the screen
830
size obtained from system calls or the terminal data-
834
Specifies the total time, in milliseconds, for which
835
ncurses will await a character sequence, e.g., a
836
function key. The default value, 1000 milliseconds,
837
is enough for most uses. However, it is made a vari-
838
able to accommodate unusual applications.
840
The most common instance where you may wish to change
841
this value is to work with slow hosts, e.g., running
842
on a network. If the host cannot read characters
843
rapidly enough, it will have the same effect as if
844
the terminal did not send characters rapidly enough.
845
The library will still see a timeout.
847
Note that xterm mouse events are built up from char-
848
acter sequences received from the xterm. If your
849
application makes heavy use of multiple-clicking, you
850
may wish to lengthen this default value because the
851
timeout applies to the composed multi-click event as
852
well as the individual clicks.
854
In addition to the environment variable, this imple-
855
mentation provides a global variable with the same
856
name. Portable applications should not rely upon the
857
presence of ESCDELAY in either form, but setting the
858
environment variable rather than the global variable
859
does not create problems when compiling an applica-
862
HOME Tells <STRONG>ncurses</STRONG> where your home directory is. That is
863
where it may read and write auxiliary terminal
870
Like COLUMNS, specify the height of the screen in
871
characters. See COLUMNS for a detailed description.
874
This applies only to the OS/2 EMX port. It specifies
875
the order of buttons on the mouse. OS/2 numbers a
876
3-button mouse inconsistently from other platforms:
882
This variable lets you customize the mouse. The
883
variable must be three numeric digits 1-3 in any
884
order, e.g., 123 or 321. If it is not specified,
885
<STRONG>ncurses</STRONG> uses 132.
887
NCURSES_ASSUMED_COLORS
888
Override the compiled-in assumption that the termi-
889
nal's default colors are white-on-black (see
890
<STRONG><A HREF="default_colors.3x.html">default_colors(3x)</A></STRONG>). You may set the foreground and
891
background color values with this environment vari-
892
able by proving a 2-element list: foreground,back-
893
ground. For example, to tell ncurses to not assume
894
anything about the colors, set this to "-1,-1". To
895
make it green-on-black, set it to "2,0". Any posi-
896
tive value from zero to the terminfo <STRONG>max_colors</STRONG> value
900
This applies only to the MinGW port of ncurses.
902
The <STRONG>Console2</STRONG> program's handling of the Microsoft Con-
903
sole API call <STRONG>CreateConsoleScreenBuffer</STRONG> is defective.
904
Applications which use this will hang. However, it
905
is possible to simulate the action of this call by
906
mapping coordinates, explicitly saving and restoring
907
the original screen contents. Setting the environ-
908
ment variable <STRONG>NCGDB</STRONG> has the same effect.
911
This applies only to ncurses configured to use the
914
If present, the environment variable is a list of one
915
or more terminal names against which the TERM envi-
916
ronment variable is matched. Setting it to an empty
917
value disables the GPM interface; using the built-in
918
support for xterm, etc.
920
If the environment variable is absent, ncurses will
921
attempt to open GPM if TERM contains "linux".
924
<STRONG>Ncurses</STRONG> may use tabs as part of the cursor movement
925
optimization. In some cases, your terminal driver
926
may not handle these properly. Set this environment
927
variable to disable the feature. You can also adjust
928
your <STRONG>stty</STRONG> settings to avoid the problem.
930
NCURSES_NO_MAGIC_COOKIE
931
Some terminals use a magic-cookie feature which
932
requires special handling to make highlighting and
933
other video attributes display properly. You can
934
suppress the highlighting entirely for these termi-
935
nals by setting this environment variable.
938
Most of the terminal descriptions in the terminfo
939
database are written for real "hardware" terminals.
940
Many people use terminal emulators which run in a
941
windowing environment and use curses-based applica-
942
tions. Terminal emulators can duplicate all of the
943
important aspects of a hardware terminal, but they do
944
not have the same limitations. The chief limitation
945
of a hardware terminal from the standpoint of your
946
application is the management of dataflow, i.e., tim-
947
ing. Unless a hardware terminal is interfaced into a
948
terminal concentrator (which does flow control), it
949
(or your application) must manage dataflow, prevent-
950
ing overruns. The cheapest solution (no hardware
951
cost) is for your program to do this by pausing after
952
operations that the terminal does slowly, such as
953
clearing the display.
955
As a result, many terminal descriptions (including
956
the vt100) have delay times embedded. You may wish
957
to use these descriptions, but not want to pay the
960
Set the NCURSES_NO_PADDING environment variable to
961
disable all but mandatory padding. Mandatory padding
962
is used as a part of special control sequences such
966
This setting is obsolete. Before changes
968
<STRONG>o</STRONG> started with 5.9 patch 20120825 and
970
<STRONG>o</STRONG> continued though 5.9 patch 20130126
972
<STRONG>ncurses</STRONG> enabled buffered output during terminal ini-
973
tialization. This was done (as in SVr4 curses) for
974
performance reasons. For testing purposes, both of
975
<STRONG>ncurses</STRONG> and certain applications, this feature was
976
made optional. Setting the NCURSES_NO_SETBUF vari-
977
able disabled output buffering, leaving the output in
978
the original (usually line buffered) mode.
980
In the current implementation, ncurses performs its
981
own buffering and does not require this workaround.
982
It does not modify the buffering of the standard out-
985
The reason for the change was to make the behavior
986
for interrupts and other signals more robust. One
987
drawback is that certain nonconventional programs
988
would mix ordinary stdio calls with ncurses calls and
989
(usually) work. This is no longer possible since
990
ncurses is not using the buffered standard output but
991
its own output (to the same file descriptor). As a
992
special case, the low-level calls such as <STRONG>putp</STRONG> still
993
use the standard output. But high-level curses calls
997
During initialization, the <STRONG>ncurses</STRONG> library checks for
998
special cases where VT100 line-drawing (and the cor-
999
responding alternate character set capabilities)
1000
described in the terminfo are known to be missing.
1001
Specifically, when running in a UTF-8 locale, the
1002
Linux console emulator and the GNU screen program
1003
ignore these. Ncurses checks the TERM environment
1004
variable for these. For other special cases, you
1005
should set this environment variable. Doing this
1006
tells ncurses to use Unicode values which correspond
1007
to the VT100 line-drawing glyphs. That works for the
1008
special cases cited, and is likely to work for termi-
1011
When setting this variable, you should set it to a
1012
nonzero value. Setting it to zero (or to a nonnum-
1013
ber) disables the special check for "linux" and
1016
As an alternative to the environment variable,
1017
ncurses checks for an extended terminfo capability
1018
<STRONG>U8</STRONG>. This is a numeric capability which can be com-
1019
piled using <STRONG>tic</STRONG> <STRONG>-x</STRONG>. For example
1021
# linux console, if patched to provide working
1022
# VT100 shift-in/shift-out, with corresponding font.
1023
linux-vt100|linux console with VT100 line-graphics,
1026
# uxterm with vt100Graphics resource set to false
1027
xterm-utf8|xterm relying on UTF-8 line-graphics,
1030
The name "U8" is chosen to be two characters, to per-
1031
mit it to be used by applications that use ncurses'
1035
During initialization, the <STRONG>ncurses</STRONG> debugging library
1036
checks the NCURSES_TRACE environment variable. If it
1037
is defined, to a numeric value, <STRONG>ncurses</STRONG> calls the
1038
<STRONG>trace</STRONG> function, using that value as the argument.
1040
The argument values, which are defined in <STRONG>curses.h</STRONG>,
1041
provide several types of information. When running
1042
with traces enabled, your application will write the
1043
file <STRONG>trace</STRONG> to the current directory.
1045
TERM Denotes your terminal type. Each terminal type is
1046
distinct, though many are similar.
1048
<STRONG>TERM</STRONG> is commonly set by terminal emulators to help
1049
applications find a workable terminal description.
1050
Some of those choose a popular approximation, e.g.,
1051
"ansi", "vt100", "xterm" rather than an exact fit.
1052
Not infrequently, your application will have problems
1053
with that approach, e.g., incorrect function-key def-
1056
If you set <STRONG>TERM</STRONG> in your environment, it has no effect
1057
on the operation of the terminal emulator. It only
1058
affects the way applications work within the termi-
1059
nal. Likewise, as a general rule (<STRONG>xterm</STRONG> being a rare
1060
exception), terminal emulators which allow you to
1061
specify <STRONG>TERM</STRONG> as a parameter or configuration value do
1062
not change their behavior to match that setting.
1065
If the <STRONG>ncurses</STRONG> library has been configured with <EM>term-</EM>
1066
<EM>cap</EM> support, <STRONG>ncurses</STRONG> will check for a terminal's
1067
description in termcap form if it is not available in
1068
the terminfo database.
1070
The TERMCAP environment variable contains either a
1071
terminal description (with newlines stripped out), or
1072
a file name telling where the information denoted by
1073
the TERM environment variable exists. In either
1074
case, setting it directs <STRONG>ncurses</STRONG> to ignore the usual
1075
place for this information, e.g., /etc/termcap.
1078
Overrides the directory in which <STRONG>ncurses</STRONG> searches for
1079
your terminal description. This is the simplest, but
1080
not the only way to change the list of directories.
1081
The complete list of directories in order follows:
1083
<STRONG>o</STRONG> the last directory to which <STRONG>ncurses</STRONG> wrote, if
1084
any, is searched first
1086
<STRONG>o</STRONG> the directory specified by the TERMINFO environ-
1089
<STRONG>o</STRONG> $HOME/.terminfo
1091
<STRONG>o</STRONG> directories listed in the TERMINFO_DIRS environ-
1094
<STRONG>o</STRONG> one or more directories whose names are config-
1095
ured and compiled into the ncurses library, i.e.,
1097
<STRONG>o</STRONG> /usr/local/ncurses/share/ter-
1098
minfo:/usr/share/terminfo (corresponding to
1099
the TERMINFO_DIRS variable)
1101
<STRONG>o</STRONG> /usr/share/terminfo (corresponding to the
1105
Specifies a list of directories to search for termi-
1106
nal descriptions. The list is separated by colons
1107
(i.e., ":") on Unix, semicolons on OS/2 EMX.
1109
All of the terminal descriptions are in terminfo
1110
form. Normally these are stored in a directory tree,
1111
using subdirectories named by the first letter of the
1112
terminal names therein.
1114
If <STRONG>ncurses</STRONG> is built with a hashed database, then each
1115
entry in this list can also be the path of the corre-
1116
sponding database file.
1118
If <STRONG>ncurses</STRONG> is built with a support for reading term-
1119
cap files directly, then an entry in this list may be
1120
the path of a termcap file.
1123
If TERMCAP does not hold a file name then <STRONG>ncurses</STRONG>
1124
checks the TERMPATH environment variable. This is a
1125
list of filenames separated by spaces or colons
1126
(i.e., ":") on Unix, semicolons on OS/2 EMX.
1128
If the TERMPATH environment variable is not set,
1129
<STRONG>ncurses</STRONG> looks in the files /etc/termcap,
1130
/usr/share/misc/termcap and $HOME/.termcap, in that
795
When set, change occurrences of the command_character
796
(i.e., the <STRONG>cmdch</STRONG> capability) of the loaded terminfo
797
entries to the value of this variable. Very few terminfo
798
entries provide this feature.
800
Because this name is also used in development environments
801
to represent the C compiler's name, <STRONG>ncurses</STRONG> ignores it if
802
it does not happen to be a single character.
806
<H3><a name="h3-BAUDRATE">BAUDRATE</a></H3><PRE>
807
The debugging library checks this environment variable
808
when the application has redirected output to a file. The
809
variable's numeric value is used for the baudrate. If no
810
value is found, <STRONG>ncurses</STRONG> uses 9600. This allows testers to
811
construct repeatable test-cases that take into account
812
costs that depend on baudrate.
816
<H3><a name="h3-COLUMNS">COLUMNS</a></H3><PRE>
817
Specify the width of the screen in characters. Applica-
818
tions running in a windowing environment usually are able
819
to obtain the width of the window in which they are exe-
820
cuting. If neither the <STRONG>COLUMNS</STRONG> value nor the terminal's
821
screen size is available, <STRONG>ncurses</STRONG> uses the size which may
822
be specified in the terminfo database (i.e., the <STRONG>cols</STRONG>
825
It is important that your application use a correct size
826
for the screen. This is not always possible because your
827
application may be running on a host which does not honor
828
NAWS (Negotiations About Window Size), or because you are
829
temporarily running as another user. However, setting
830
<STRONG>COLUMNS</STRONG> and/or <STRONG>LINES</STRONG> overrides the library's use of the
831
screen size obtained from the operating system.
833
Either <STRONG>COLUMNS</STRONG> or <STRONG>LINES</STRONG> symbols may be specified indepen-
834
dently. This is mainly useful to circumvent legacy mis-
835
features of terminal descriptions, e.g., xterm which com-
836
monly specifies a 65 line screen. For best results, <STRONG>lines</STRONG>
837
and <STRONG>cols</STRONG> should not be specified in a terminal description
838
for terminals which are run as emulations.
840
Use the <STRONG>use_env</STRONG> function to disable all use of external
841
environment (but not including system calls) to determine
842
the screen size. Use the <STRONG>use_tioctl</STRONG> function to update
843
<STRONG>COLUMNS</STRONG> or <STRONG>LINES</STRONG> to match the screen size obtained from
844
system calls or the terminal database.
848
<H3><a name="h3-ESCDELAY">ESCDELAY</a></H3><PRE>
849
Specifies the total time, in milliseconds, for which
850
ncurses will await a character sequence, e.g., a function
851
key. The default value, 1000 milliseconds, is enough for
852
most uses. However, it is made a variable to accommodate
853
unusual applications.
855
The most common instance where you may wish to change this
856
value is to work with slow hosts, e.g., running on a net-
857
work. If the host cannot read characters rapidly enough,
858
it will have the same effect as if the terminal did not
859
send characters rapidly enough. The library will still
862
Note that xterm mouse events are built up from character
863
sequences received from the xterm. If your application
864
makes heavy use of multiple-clicking, you may wish to
865
lengthen this default value because the timeout applies to
866
the composed multi-click event as well as the individual
869
In addition to the environment variable, this implementa-
870
tion provides a global variable with the same name. Por-
871
table applications should not rely upon the presence of
872
ESCDELAY in either form, but setting the environment vari-
873
able rather than the global variable does not create prob-
874
lems when compiling an application.
878
<H3><a name="h3-HOME">HOME</a></H3><PRE>
879
Tells <STRONG>ncurses</STRONG> where your home directory is. That is where
880
it may read and write auxiliary terminal descriptions:
887
<H3><a name="h3-LINES">LINES</a></H3><PRE>
888
Like COLUMNS, specify the height of the screen in charac-
889
ters. See COLUMNS for a detailed description.
893
<H3><a name="h3-MOUSE_BUTTONS_123">MOUSE_BUTTONS_123</a></H3><PRE>
894
This applies only to the OS/2 EMX port. It specifies the
895
order of buttons on the mouse. OS/2 numbers a 3-button
896
mouse inconsistently from other platforms:
902
This variable lets you customize the mouse. The variable
903
must be three numeric digits 1-3 in any order, e.g., 123
904
or 321. If it is not specified, <STRONG>ncurses</STRONG> uses 132.
908
<H3><a name="h3-NCURSES_ASSUMED_COLORS">NCURSES_ASSUMED_COLORS</a></H3><PRE>
909
Override the compiled-in assumption that the terminal's
910
default colors are white-on-black (see <STRONG>default_col-</STRONG>
911
<STRONG><A HREF="default_colors.3x.html">ors(3x)</A></STRONG>). You may set the foreground and background color
912
values with this environment variable by proving a 2-ele-
913
ment list: foreground,background. For example, to tell
914
ncurses to not assume anything about the colors, set this
915
to "-1,-1". To make it green-on-black, set it to "2,0".
916
Any positive value from zero to the terminfo <STRONG>max_colors</STRONG>
921
<H3><a name="h3-NCURSES_CONSOLE2">NCURSES_CONSOLE2</a></H3><PRE>
922
This applies only to the MinGW port of ncurses.
924
The <STRONG>Console2</STRONG> program's handling of the Microsoft Console
925
API call <STRONG>CreateConsoleScreenBuffer</STRONG> is defective. Applica-
926
tions which use this will hang. However, it is possible
927
to simulate the action of this call by mapping coordi-
928
nates, explicitly saving and restoring the original screen
929
contents. Setting the environment variable <STRONG>NCGDB</STRONG> has the
934
<H3><a name="h3-NCURSES_GPM_TERMS">NCURSES_GPM_TERMS</a></H3><PRE>
935
This applies only to ncurses configured to use the GPM
938
If present, the environment variable is a list of one or
939
more terminal names against which the TERM environment
940
variable is matched. Setting it to an empty value dis-
941
ables the GPM interface; using the built-in support for
944
If the environment variable is absent, ncurses will
945
attempt to open GPM if TERM contains "linux".
949
<H3><a name="h3-NCURSES_NO_HARD_TABS">NCURSES_NO_HARD_TABS</a></H3><PRE>
950
<STRONG>Ncurses</STRONG> may use tabs as part of the cursor movement opti-
951
mization. In some cases, your terminal driver may not
952
handle these properly. Set this environment variable to
953
disable the feature. You can also adjust your <STRONG>stty</STRONG> set-
954
tings to avoid the problem. NCURSES_NO_MAGIC_COOKIE Some
955
terminals use a magic-cookie feature which requires spe-
956
cial handling to make highlighting and other video
957
attributes display properly. You can suppress the high-
958
lighting entirely for these terminals by setting this
959
environment variable.
963
<H3><a name="h3-NCURSES_NO_PADDING">NCURSES_NO_PADDING</a></H3><PRE>
964
Most of the terminal descriptions in the terminfo database
965
are written for real "hardware" terminals. Many people
966
use terminal emulators which run in a windowing environ-
967
ment and use curses-based applications. Terminal emula-
968
tors can duplicate all of the important aspects of a hard-
969
ware terminal, but they do not have the same limitations.
970
The chief limitation of a hardware terminal from the
971
standpoint of your application is the management of
972
dataflow, i.e., timing. Unless a hardware terminal is
973
interfaced into a terminal concentrator (which does flow
974
control), it (or your application) must manage dataflow,
975
preventing overruns. The cheapest solution (no hardware
976
cost) is for your program to do this by pausing after
977
operations that the terminal does slowly, such as clearing
980
As a result, many terminal descriptions (including the
981
vt100) have delay times embedded. You may wish to use
982
these descriptions, but not want to pay the performance
985
Set the NCURSES_NO_PADDING environment variable to disable
986
all but mandatory padding. Mandatory padding is used as a
987
part of special control sequences such as <EM>flash</EM>.
991
<H3><a name="h3-NCURSES_NO_SETBUF">NCURSES_NO_SETBUF</a></H3><PRE>
992
This setting is obsolete. Before changes
994
<STRONG>o</STRONG> started with 5.9 patch 20120825 and
996
<STRONG>o</STRONG> continued though 5.9 patch 20130126
998
<STRONG>ncurses</STRONG> enabled buffered output during terminal initial-
999
ization. This was done (as in SVr4 curses) for perfor-
1000
mance reasons. For testing purposes, both of <STRONG>ncurses</STRONG> and
1001
certain applications, this feature was made optional.
1002
Setting the NCURSES_NO_SETBUF variable disabled output
1003
buffering, leaving the output in the original (usually
1004
line buffered) mode.
1006
In the current implementation, ncurses performs its own
1007
buffering and does not require this workaround. It does
1008
not modify the buffering of the standard output.
1010
The reason for the change was to make the behavior for
1011
interrupts and other signals more robust. One drawback is
1012
that certain nonconventional programs would mix ordinary
1013
stdio calls with ncurses calls and (usually) work. This
1014
is no longer possible since ncurses is not using the
1015
buffered standard output but its own output (to the same
1016
file descriptor). As a special case, the low-level calls
1017
such as <STRONG>putp</STRONG> still use the standard output. But high-
1018
level curses calls do not.
1022
<H3><a name="h3-NCURSES_NO_UTF8_ACS">NCURSES_NO_UTF8_ACS</a></H3><PRE>
1023
During initialization, the <STRONG>ncurses</STRONG> library checks for spe-
1024
cial cases where VT100 line-drawing (and the corresponding
1025
alternate character set capabilities) described in the
1026
terminfo are known to be missing. Specifically, when run-
1027
ning in a UTF-8 locale, the Linux console emulator and the
1028
GNU screen program ignore these. Ncurses checks the TERM
1029
environment variable for these. For other special cases,
1030
you should set this environment variable. Doing this
1031
tells ncurses to use Unicode values which correspond to
1032
the VT100 line-drawing glyphs. That works for the special
1033
cases cited, and is likely to work for terminal emulators.
1035
When setting this variable, you should set it to a nonzero
1036
value. Setting it to zero (or to a nonnumber) disables
1037
the special check for "linux" and "screen".
1039
As an alternative to the environment variable, ncurses
1040
checks for an extended terminfo capability <STRONG>U8</STRONG>. This is a
1041
numeric capability which can be compiled using <STRONG>tic</STRONG> <STRONG>-x</STRONG>.
1044
# linux console, if patched to provide working
1045
# VT100 shift-in/shift-out, with corresponding font.
1046
linux-vt100|linux console with VT100 line-graphics,
1049
# uxterm with vt100Graphics resource set to false
1050
xterm-utf8|xterm relying on UTF-8 line-graphics,
1053
The name "U8" is chosen to be two characters, to permit it
1054
to be used by applications that use ncurses' termcap
1059
<H3><a name="h3-NCURSES_TRACE">NCURSES_TRACE</a></H3><PRE>
1060
During initialization, the <STRONG>ncurses</STRONG> debugging library
1061
checks the NCURSES_TRACE environment variable. If it is
1062
defined, to a numeric value, <STRONG>ncurses</STRONG> calls the <STRONG>trace</STRONG> func-
1063
tion, using that value as the argument.
1065
The argument values, which are defined in <STRONG>curses.h</STRONG>, pro-
1066
vide several types of information. When running with
1067
traces enabled, your application will write the file <STRONG>trace</STRONG>
1068
to the current directory.
1070
See <STRONG><A HREF="curs_trace.3x.html">curs_trace(3x)</A></STRONG> for more information.
1074
<H3><a name="h3-TERM">TERM</a></H3><PRE>
1075
Denotes your terminal type. Each terminal type is dis-
1076
tinct, though many are similar.
1078
<STRONG>TERM</STRONG> is commonly set by terminal emulators to help appli-
1079
cations find a workable terminal description. Some of
1080
those choose a popular approximation, e.g., "ansi",
1081
"vt100", "xterm" rather than an exact fit. Not infre-
1082
quently, your application will have problems with that
1083
approach, e.g., incorrect function-key definitions.
1085
If you set <STRONG>TERM</STRONG> in your environment, it has no effect on
1086
the operation of the terminal emulator. It only affects
1087
the way applications work within the terminal. Likewise,
1088
as a general rule (<STRONG>xterm</STRONG> being a rare exception), terminal
1089
emulators which allow you to specify <STRONG>TERM</STRONG> as a parameter
1090
or configuration value do not change their behavior to
1095
<H3><a name="h3-TERMCAP">TERMCAP</a></H3><PRE>
1096
If the <STRONG>ncurses</STRONG> library has been configured with <EM>termcap</EM>
1097
support, <STRONG>ncurses</STRONG> will check for a terminal's description
1098
in termcap form if it is not available in the terminfo
1101
The TERMCAP environment variable contains either a termi-
1102
nal description (with newlines stripped out), or a file
1103
name telling where the information denoted by the TERM
1104
environment variable exists. In either case, setting it
1105
directs <STRONG>ncurses</STRONG> to ignore the usual place for this infor-
1106
mation, e.g., /etc/termcap.
1110
<H3><a name="h3-TERMINFO">TERMINFO</a></H3><PRE>
1111
Overrides the directory in which <STRONG>ncurses</STRONG> searches for your
1112
terminal description. This is the simplest, but not the
1113
only way to change the list of directories. The complete
1114
list of directories in order follows:
1116
<STRONG>o</STRONG> the last directory to which <STRONG>ncurses</STRONG> wrote, if any,
1119
<STRONG>o</STRONG> the directory specified by the TERMINFO environment
1122
<STRONG>o</STRONG> $HOME/.terminfo
1124
<STRONG>o</STRONG> directories listed in the TERMINFO_DIRS environment
1127
<STRONG>o</STRONG> one or more directories whose names are configured
1128
and compiled into the ncurses library, i.e.,
1130
<STRONG>o</STRONG> /usr/local/ncurses/share/ter-
1131
minfo:/usr/share/terminfo (corresponding to the
1132
TERMINFO_DIRS variable)
1134
<STRONG>o</STRONG> /usr/share/terminfo (corresponding to the TER-
1139
<H3><a name="h3-TERMINFO_DIRS">TERMINFO_DIRS</a></H3><PRE>
1140
Specifies a list of directories to search for terminal
1141
descriptions. The list is separated by colons (i.e., ":")
1142
on Unix, semicolons on OS/2 EMX.
1144
All of the terminal descriptions are in terminfo form.
1145
Normally these are stored in a directory tree, using sub-
1146
directories named by the first letter of the terminal
1149
If <STRONG>ncurses</STRONG> is built with a hashed database, then each
1150
entry in this list can also be the path of the correspond-
1153
If <STRONG>ncurses</STRONG> is built with a support for reading termcap
1154
files directly, then an entry in this list may be the path
1159
<H3><a name="h3-TERMPATH">TERMPATH</a></H3><PRE>
1160
If TERMCAP does not hold a file name then <STRONG>ncurses</STRONG> checks
1161
the TERMPATH environment variable. This is a list of
1162
filenames separated by spaces or colons (i.e., ":") on
1163
Unix, semicolons on OS/2 EMX.
1165
If the TERMPATH environment variable is not set, <STRONG>ncurses</STRONG>
1166
looks in the files /etc/termcap, /usr/share/misc/termcap
1167
and $HOME/.termcap, in that order.
1133
1169
The library may be configured to disregard the following
1134
1170
variables when the current user is the superuser (root),
1135
1171
or if the application uses setuid or setgid permissions:
1137
$TERMINFO, $TERMINFO_DIRS, $TERMPATH, as well as
1173
$TERMINFO, $TERMINFO_DIRS, $TERMPATH, as well as $HOME.
1142
1177
<H2><a name="h2-ALTERNATE-CONFIGURATIONS">ALTERNATE CONFIGURATIONS</a></H2><PRE>
1143
Several different configurations are possible, depending
1144
on the configure script options used when building
1145
<STRONG>ncurses</STRONG>. There are a few main options whose effects are
1178
Several different configurations are possible, depending
1179
on the configure script options used when building
1180
<STRONG>ncurses</STRONG>. There are a few main options whose effects are
1146
1181
visible to the applications developer using <STRONG>ncurses</STRONG>:
1148
1183
--disable-overwrite
1149
The standard include for <STRONG>ncurses</STRONG> is as noted in <STRONG>SYN-</STRONG>
1184
The standard include for <STRONG>ncurses</STRONG> is as noted in <STRONG>SYN-</STRONG>
1150
1185
<STRONG>OPSIS</STRONG>:
1152
<STRONG>#include</STRONG> <STRONG><curses.h></STRONG>
1187
<STRONG>#include</STRONG> <STRONG><curses.h></STRONG>
1154
This option is used to avoid filename conflicts when
1155
<STRONG>ncurses</STRONG> is not the main implementation of curses of
1156
the computer. If <STRONG>ncurses</STRONG> is installed disabling
1157
overwrite, it puts its headers in a subdirectory,
1189
This option is used to avoid filename conflicts when
1190
<STRONG>ncurses</STRONG> is not the main implementation of curses of
1191
the computer. If <STRONG>ncurses</STRONG> is installed disabling
1192
overwrite, it puts its headers in a subdirectory,
1160
<STRONG>#include</STRONG> <STRONG><ncurses/curses.h></STRONG>
1195
<STRONG>#include</STRONG> <STRONG><ncurses/curses.h></STRONG>
1162
It also omits a symbolic link which would allow you
1197
It also omits a symbolic link which would allow you
1163
1198
to use <STRONG>-lcurses</STRONG> to build executables.
1166
The configure script renames the library and (if the
1167
<STRONG>--disable-overwrite</STRONG> option is used) puts the header
1201
The configure script renames the library and (if the
1202
<STRONG>--disable-overwrite</STRONG> option is used) puts the header
1168
1203
files in a different subdirectory. All of the
1169
library names have a "w" appended to them, i.e.,
1204
library names have a "w" appended to them, i.e.,
1172
<STRONG>-lncurses</STRONG>
1207
<STRONG>-lncurses</STRONG>
1176
<STRONG>-lncursesw</STRONG>
1211
<STRONG>-lncursesw</STRONG>
1178
1213
You must also define <STRONG>_XOPEN_SOURCE_EXTENDED</STRONG> when com-
1179
piling for the wide-character library to use the
1180
extended (wide-character) functions. The <STRONG>curses.h</STRONG>
1181
file which is installed for the wide-character
1182
library is designed to be compatible with the normal
1214
piling for the wide-character library to use the
1215
extended (wide-character) functions. The <STRONG>curses.h</STRONG>
1216
file which is installed for the wide-character
1217
library is designed to be compatible with the normal
1183
1218
library's header. Only the size of the <STRONG>WINDOW</STRONG> struc-
1184
ture differs, and very few applications require more
1185
than a pointer to <STRONG>WINDOW</STRONG>s. If the headers are
1186
installed allowing overwrite, the wide-character
1187
library's headers should be installed last, to allow
1188
applications to be built using either library from
1219
ture differs, and very few applications require more
1220
than a pointer to <STRONG>WINDOW</STRONG>s. If the headers are
1221
installed allowing overwrite, the wide-character
1222
library's headers should be installed last, to allow
1223
applications to be built using either library from
1189
1224
the same set of headers.
1240
1275
The <STRONG>ncurses</STRONG> library can be compiled with an option
1241
1276
(<STRONG>-DUSE_GETCAP</STRONG>) that falls back to the old-style /etc/term-
1242
1277
cap file if the terminal setup code cannot find a terminfo
1243
entry corresponding to <STRONG>TERM</STRONG>. Use of this feature is not
1244
recommended, as it essentially includes an entire termcap
1245
compiler in the <STRONG>ncurses</STRONG> startup code, at significant cost
1278
entry corresponding to <STRONG>TERM</STRONG>. Use of this feature is not
1279
recommended, as it essentially includes an entire termcap
1280
compiler in the <STRONG>ncurses</STRONG> startup code, at significant cost
1246
1281
in core and startup cycles.
1248
The <STRONG>ncurses</STRONG> library includes facilities for capturing
1249
mouse events on certain terminals (including xterm). See
1283
The <STRONG>ncurses</STRONG> library includes facilities for capturing
1284
mouse events on certain terminals (including xterm). See
1250
1285
the <STRONG><A HREF="curs_mouse.3x.html">curs_mouse(3x)</A></STRONG> manual page for details.
1252
The <STRONG>ncurses</STRONG> library includes facilities for responding to
1253
window resizing events, e.g., when running in an xterm.
1254
See the <STRONG><A HREF="resizeterm.3x.html">resizeterm(3x)</A></STRONG> and <STRONG><A HREF="wresize.3x.html">wresize(3x)</A></STRONG> manual pages for
1255
details. In addition, the library may be configured with
1287
The <STRONG>ncurses</STRONG> library includes facilities for responding to
1288
window resizing events, e.g., when running in an xterm.
1289
See the <STRONG><A HREF="resizeterm.3x.html">resizeterm(3x)</A></STRONG> and <STRONG><A HREF="wresize.3x.html">wresize(3x)</A></STRONG> manual pages for
1290
details. In addition, the library may be configured with
1256
1291
a SIGWINCH handler.
1258
The <STRONG>ncurses</STRONG> library extends the fixed set of function key
1259
capabilities of terminals by allowing the application
1260
designer to define additional key sequences at runtime.
1293
The <STRONG>ncurses</STRONG> library extends the fixed set of function key
1294
capabilities of terminals by allowing the application
1295
designer to define additional key sequences at runtime.
1261
1296
See the <STRONG><A HREF="define_key.3x.html">define_key(3x)</A></STRONG> <STRONG><A HREF="key_defined.3x.html">key_defined(3x)</A></STRONG>, and <STRONG><A HREF="keyok.3x.html">keyok(3x)</A></STRONG> man-
1262
1297
ual pages for details.
1264
1299
The <STRONG>ncurses</STRONG> library can exploit the capabilities of termi-
1265
nals which implement the ISO-6429 SGR 39 and SGR 49 con-
1300
nals which implement the ISO-6429 SGR 39 and SGR 49 con-
1266
1301
trols, which allow an application to reset the terminal to
1267
its original foreground and background colors. From the
1268
users' perspective, the application is able to draw col-
1269
ored text on a background whose color is set indepen-
1270
dently, providing better control over color contrasts.
1302
its original foreground and background colors. From the
1303
users' perspective, the application is able to draw col-
1304
ored text on a background whose color is set indepen-
1305
dently, providing better control over color contrasts.
1271
1306
See the <STRONG><A HREF="default_colors.3x.html">default_colors(3x)</A></STRONG> manual page for details.
1273
The <STRONG>ncurses</STRONG> library includes a function for directing
1274
application output to a printer attached to the terminal
1308
The <STRONG>ncurses</STRONG> library includes a function for directing
1309
application output to a printer attached to the terminal
1275
1310
device. See the <STRONG><A HREF="curs_print.3x.html">curs_print(3x)</A></STRONG> manual page for details.
1279
1314
<H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
1280
The <STRONG>ncurses</STRONG> library is intended to be BASE-level confor-
1315
The <STRONG>ncurses</STRONG> library is intended to be BASE-level confor-
1281
1316
mant with XSI Curses. The EXTENDED XSI Curses functional-
1282
1317
ity (including color support) is supported.
1284
A small number of local differences (that is, individual
1285
differences between the XSI Curses and <STRONG>ncurses</STRONG> calls) are
1286
described in <STRONG>PORTABILITY</STRONG> sections of the library man
1319
A small number of local differences (that is, individual
1320
differences between the XSI Curses and <STRONG>ncurses</STRONG> calls) are
1321
described in <STRONG>PORTABILITY</STRONG> sections of the library man
1289
Unlike other implementations, this one checks parameters
1290
such as pointers to WINDOW structures to ensure they are
1291
not null. The main reason for providing this behavior is
1324
Unlike other implementations, this one checks parameters
1325
such as pointers to WINDOW structures to ensure they are
1326
not null. The main reason for providing this behavior is
1292
1327
to guard against programmer error. The standard interface
1293
1328
does not provide a way for the library to tell an applica-
1294
tion which of several possible errors were detected.
1295
Relying on this (or some other) extension will adversely
1329
tion which of several possible errors were detected.
1330
Relying on this (or some other) extension will adversely
1296
1331
affect the portability of curses applications.
1298
1333
This implementation also contains several extensions:
1300
<STRONG>o</STRONG> The routine <STRONG>has_key</STRONG> is not part of XPG4, nor is it
1301
present in SVr4. See the <STRONG><A HREF="curs_getch.3x.html">curs_getch(3x)</A></STRONG> manual page
1335
<STRONG>o</STRONG> The routine <STRONG>has_key</STRONG> is not part of XPG4, nor is it
1336
present in SVr4. See the <STRONG><A HREF="curs_getch.3x.html">curs_getch(3x)</A></STRONG> manual page
1304
<STRONG>o</STRONG> The routine <STRONG>slk_attr</STRONG> is not part of XPG4, nor is it
1339
<STRONG>o</STRONG> The routine <STRONG>slk_attr</STRONG> is not part of XPG4, nor is it
1305
1340
present in SVr4. See the <STRONG><A HREF="curs_slk.3x.html">curs_slk(3x)</A></STRONG> manual page for
1308
1343
<STRONG>o</STRONG> The routines <STRONG>getmouse</STRONG>, <STRONG>mousemask</STRONG>, <STRONG>ungetmouse</STRONG>, <STRONG>mousein-</STRONG>
1309
1344
<STRONG>terval</STRONG>, and <STRONG>wenclose</STRONG> relating to mouse interfacing are
1310
not part of XPG4, nor are they present in SVr4. See
1345
not part of XPG4, nor are they present in SVr4. See
1311
1346
the <STRONG><A HREF="curs_mouse.3x.html">curs_mouse(3x)</A></STRONG> manual page for details.
1313
<STRONG>o</STRONG> The routine <STRONG>mcprint</STRONG> was not present in any previous
1314
curses implementation. See the <STRONG><A HREF="curs_print.3x.html">curs_print(3x)</A></STRONG> manual
1348
<STRONG>o</STRONG> The routine <STRONG>mcprint</STRONG> was not present in any previous
1349
curses implementation. See the <STRONG><A HREF="curs_print.3x.html">curs_print(3x)</A></STRONG> manual
1315
1350
page for details.
1317
<STRONG>o</STRONG> The routine <STRONG>wresize</STRONG> is not part of XPG4, nor is it
1318
present in SVr4. See the <STRONG><A HREF="wresize.3x.html">wresize(3x)</A></STRONG> manual page for
1352
<STRONG>o</STRONG> The routine <STRONG>wresize</STRONG> is not part of XPG4, nor is it
1353
present in SVr4. See the <STRONG><A HREF="wresize.3x.html">wresize(3x)</A></STRONG> manual page for
1321
<STRONG>o</STRONG> The WINDOW structure's internal details can be hidden
1322
from application programs. See <STRONG><A HREF="curs_opaque.3x.html">curs_opaque(3x)</A></STRONG> for
1356
<STRONG>o</STRONG> The WINDOW structure's internal details can be hidden
1357
from application programs. See <STRONG><A HREF="curs_opaque.3x.html">curs_opaque(3x)</A></STRONG> for
1323
1358
the discussion of <STRONG>is_scrollok</STRONG>, etc.
1325
1360
<STRONG>o</STRONG> This implementation can be configured to provide rudi-
1326
mentary support for multi-threaded applications. See
1361
mentary support for multi-threaded applications. See
1327
1362
<STRONG><A HREF="curs_threads.3x.html">curs_threads(3x)</A></STRONG> for details.
1329
<STRONG>o</STRONG> This implementation can also be configured to provide
1364
<STRONG>o</STRONG> This implementation can also be configured to provide
1330
1365
a set of functions which improve the ability to manage
1331
1366
multiple screens. See <STRONG><A HREF="curs_sp_funcs.3x.html">curs_sp_funcs(3x)</A></STRONG> for details.
1333
In historic curses versions, delays embedded in the capa-
1368
In historic curses versions, delays embedded in the capa-
1334
1369
bilities <STRONG>cr</STRONG>, <STRONG>ind</STRONG>, <STRONG>cub1</STRONG>, <STRONG>ff</STRONG> and <STRONG>tab</STRONG> activated corresponding
1335
delay bits in the UNIX tty driver. In this implementa-
1336
tion, all padding is done by sending NUL bytes. This
1337
method is slightly more expensive, but narrows the inter-
1338
face to the UNIX kernel significantly and increases the
1370
delay bits in the UNIX tty driver. In this implementa-
1371
tion, all padding is done by sending NUL bytes. This
1372
method is slightly more expensive, but narrows the inter-
1373
face to the UNIX kernel significantly and increases the
1339
1374
package's portability correspondingly.
1343
1378
<H2><a name="h2-NOTES">NOTES</a></H2><PRE>
1344
The header file <STRONG><curses.h></STRONG> automatically includes the
1379
The header file <STRONG><curses.h></STRONG> automatically includes the
1345
1380
header files <STRONG><stdio.h></STRONG> and <STRONG><unctrl.h></STRONG>.
1347
If standard output from a <STRONG>ncurses</STRONG> program is re-directed
1348
to something which is not a tty, screen updates will be
1382
If standard output from a <STRONG>ncurses</STRONG> program is re-directed
1383
to something which is not a tty, screen updates will be
1349
1384
directed to standard error. This was an undocumented fea-
1350
1385
ture of AT&T System V Release 3 curses.
1354
1389
<H2><a name="h2-AUTHORS">AUTHORS</a></H2><PRE>
1355
Zeyd M. Ben-Halim, Eric S. Raymond, Thomas E. Dickey.
1390
Zeyd M. Ben-Halim, Eric S. Raymond, Thomas E. Dickey.
1356
1391
Based on pcurses by Pavel Curtis.