The ncurses (new curses) library is a free software emulation of curses in System V Release 4.0, and more. It uses terminfo format, supports pads and color and multiple highlights and forms characters and function-key mapping, and has all the other SYSV-curses enhancements over BSD curses.
In mid-June 1995, the maintainer of 4.4BSD curses declared that he considered 4.4BSD curses obsolete, and is encouraging the keepers of Unix releases such as BSD/OS, freeBSD and netBSD to switch over to ncurses.
The ncurses code was developed under GNU/Linux. It should port easily to any ANSI/POSIX-conforming UNIX. It has even been ported to OS/2 Warp!
The distribution includes the library and support utilities, including a terminfo compiler tic(1), a decompiler infocmp(1), clear(1), tput(1), tset(1), and a termcap conversion tool captoinfo(1). Full manual pages are provided for the library and tools.
The ncurses distribution is available via anonymous FTP at the
GNU distribution site ftp://ftp.gnu.org/pub/gnu/ncurses.
It is also available at ftp://invisible-island.net/ncurses.
This release is designed to be upward compatible from ncurses 5.0 and 5.1; very few applications will require recompilation, depending on the platform. These are the highlights from the change-log since ncurses 5.1 release.
ospeedvariable back to
shortto match its use in legacy applications. It was altered after ncurses 4.2 to
speed_tto repair a type mismatch which was introduced after 1.9.4 in 1995. The principal users of termcap continued to use
short, which is not the same size.
NOTE: A few applications will have to be
recompiled (about 1% of the programs in a typical Linux
distribution, 10% of the programs that use ncurses). These
are easy to identify with
_nc_can_clear_with(), which was built with the configure --enable-expanded option but not used.
chtypevalues in the debug library, and for better access and buffer limit checking.
New features and improvements:
tgoto()to make it better support existing termcap applications which use hardcoded strings rather than obtain all of their information from the termcap file. If the string does not appear to be a terminfo string (i.e., does not refer to a "%p" parameter, or terminfo-style padding), and termcap support is configured,
tgoto()will interpret it as termcap. Otherwise, as before, it will use
tgoto()changes work properly, added checks to
ticwhich report capabilities that do not reference the expected number of parameters.
--disable-root-environadds runtime checks which tell ncurses to disregard $TERMINFO and similar environment variables if the current user is root, or running setuid/setgid.
--disable-assumed-colorallows you to use the pre-5.1 convention of default colors used for color-pair 0 to be configured (see assume_default_colors()).
--program-prefix, including the manpage names and cross references.
--with-databaseallows you to specify a different terminfo source-file to install. On OS/2 EMX, the default is misc/emx.src, otherwise misc/terminfo.src
--with-default-terminfo-dirallows you to specify the default terminfo database directory.
--with-libtoolallows you to build with
libtool uses a different
notation for numbering shared library versions from the
existing ncurses configuration.
--with-manpage-tblcauses the manpages to be preprocessed by tbl(1) prior to installation,
--without-curses-hcauses the installation process to install curses.h as ncurses.h and make appropriate changes to headers and manpages.
--install-prefixconfigure option from
DESTDIR(the latter has become common usage although the name is misleading).
ld -rpathoptions (e.g., Linux, and Solaris) to use an absolute pathname for the build tree's lib directory, avoiding confusion with directories relative to the current one with the installed programs.
tic -o, to eliminate dependency on
$TERMINFOvariable for installs.
screen's terminfo entry since otherwise the FreeBSD port makes it pass termcap equivalents to
tgoto, which would be misinterpreted by older versions of ncurses.
curses_version()string to report the version of ncurses with which they are compiled rather than the NCURSES_VERSION string. The function returns the patch level in addition to the major and minor version numbers.
tputprogram so it can be renamed or invoked via a link as 'reset' or 'init', producing the same effect as
no_color_videowith a logic expression which is faster.
Major bug fixes:
manlinks.sedscript introduced in ncurses 5.1 to avoid using ERE "\+", which is not understood by standard versions of
sed. This happens to work with GNU
sed, but is not portable, and was the initial motivation for this release.
tparm()to disallow arithmetic on strings, analyze the varargs list to read strings as strings and numbers as numbers.
tparm()'s internal function
spop()to treat a null pointer as an empty string.
parse_format()in lib_tparm.c to ignore precision if it is longer than 10000.
_nc_safe_strcat(), etc. Made other related changes to check lengths used for
non_dest_scroll_regionin tty_update.c to clear text after it is shifted in rather than before shifting out. Also correct row computation.
rs2capability in xterm-r6 and similar entries where cursor save/restore bracketed the sequence for resetting video attributes. The cursor restore would undo that.
_nc_utf8_outch()to avoid sign-extension when checking for out-of-range value.
$HOMEenvironment variable, to avoid retrieving terminfo descriptions from
postprocess_termcap()to avoid using
strtok(), because it is non-reentrant.
fdsarray to 0's in
poll()only sets the
reventsmembers of that array when there is activity corresponding to the related file.
next_char()function, in case
ticis run on a non-text file (fixes a core dump).
ticto verify that its inputs are really files, in case someone tries to read a directory (or
open_tempfile()in tic.c which made "tic -I" give an ambiguous error message about
adjust_cancels(), which did not check both alternatives when reclassifying an extended name between boolean, number and string, causing an infinite loop in
ticfor parameter counts in capability strings, found/fixed several errors both in the terminfo database and in the include/Caps file.
$GXXconsistently compare against 'yes' rather than test if they are nonnull, since either may be set to the corresponding name of the C or C++ compiler.
configure --targetwill set a default program-prefix.
tcgetattr()to allow for old implementations, e.g., on BeOS, which only defined it as a macro.
testin configure script to use quotes, for instance fixing a problem in the
_nc_tracebits()for CSIZE with a table to simplify working around implementations that define random combinations of the related macros to zero.
_nc_basename(), used to consolidate related code in progs, as well as accommodating OS/2 EMX pathnames.
The ncurses package is fully compatible with SVr4 (System V Release 4) curses:
The ncurses package also has many useful extensions over SVr4:
wresize()allows you to resize windows, preserving their data.
use_default_colors()allows you to use the terminal's default colors for the default color pair, achieving the effect of transparent colors.
define_key()allow you to better control the use of function keys, e.g., disabling the ncurses KEY_MOUSE, or by defining more than one control sequence to map to a given key code.
Numerous bugs present in earlier versions have been fixed; the library is far more reliable than it used to be. Bounds checking in many `dangerous' entry points has been improved. The code is now type-safe according to gcc -Wall. The library has been checked for malloc leaks and arena corruption by the Purify memory-allocation tester.
The ncurses code has been tested with a wide variety of applications including (versions starting with those noted):
as well as some that use ncurses for the terminfo support alone:
The ncurses distribution includes a selection of test programs (including a few games).
The original developers of ncurses are Zeyd Ben-Halim and Eric S. Raymond. Ongoing work is being done by Thomas Dickey and Jürgen Pfeifer. Thomas Dickey acts as the maintainer for the Free Software Foundation, which holds the copyright on ncurses. Contact the current maintainers at firstname.lastname@example.org.
To join the ncurses mailing list, please write email to
email@example.com containing the line:
This list is open to anyone interested in helping with the development and testing of this package.
Beta versions of ncurses and patches to the current release are made available at ftp://invisible-island.net/ncurses.
We need people to help with these projects. If you are interested in working on them, please join the ncurses list.
The distribution includes and uses a version of the terminfo-format terminal description file maintained by Eric Raymond. http://earthspace.net/~esr/terminfo.
You can find lots of information on terminal-related topics not covered in the terminfo file at Richard Shuford's archive.