http://invisible-island.net/ncurses/


Announcing ncurses 6.0

Overview

The ncurses (new curses) library is a free software emulation of curses in System V Release 4.0 (SVr4), 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 SVr4-curses enhancements over BSD curses. SVr4 curses is better known today as X/Open Curses.

In mid-June 1995, the maintainer of 4.4BSD curses declared that he considered 4.4BSD curses obsolete, and encouraged the keepers of unix releases such as BSD/OS, FreeBSD and NetBSD to switch over to ncurses.

Since 1995, ncurses has been ported to many systems:

The distribution includes the library and support utilities, including

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/gnu/ncurses/
http://ftp.gnu.org/gnu/ncurses/

It is also available at

ftp://invisible-island.net/ncurses/
http://invisible-mirror.net/archives/ncurses/

Release Notes

These notes are for ncurses 6.0, released August 8, 2015.

This release is designed to be source-compatible with ncurses 5.0 through 5.9; providing a new application binary interface (ABI). Although the source can still be configured to support the ncurses 5 ABI, the intent of the release is to provide extensions which are generally useful, but binary-incompatible with ncurses 5:

There are, of course, numerous other improvements, including

The release notes mention some bug-fixes, but are focused on new features and improvements to existing features log since ncurses 5.9 release.

While the intent of the release is to provide a new stable ABI, there are other development activities which are summarized below.

Library improvements

Output buffering

X/Open curses provides more than one initialization function:

They are documented in X/Open as if initscr calls newterm using stdout for output stream, and in turn newterm calls setupterm using fileno(stdout) for the file descriptor. As long as an implementation acts as if it does this, it conforms. In practice, implementations do what is implied. This creates a problem: the low-level setupterm function's file descriptor is unbuffered, while newterm implies buffered output. X/Open Curses says that all output is done through the file descriptor, and does not say how the output stream is actually used.

Initially, ncurses used the file descriptor (obtained from the output stream passed to newterm) for changing the terminal modes, and relied upon the output parameter of newterm for buffered output. Later (to avoid using unsafe buffered I/O in signal handlers), ncurses was modified to use the file descriptor (unbuffered output) when cleaning up on receipt of a signal. Otherwise (when not handling a signal), it continued to use the buffered output.

That approach worked reasonably well and as a side effect, using the same buffered output as an application might use for printf meant that no flushing was needed when switching between normal- and screen-modes.

There were a couple of problems:

Conveniently, solving the second problem (by making ncurses do its own output buffering) also fixed the first one. But there were special cases to resolve: low-level functions such as mvcur, putp, vidattr explicitly use the standard output. Those functions were reused internally, and required modification to distinguish whether they were used by the high-level or low-level interfaces.

Finally, there may still be a few programs which should be modified to improve their portability, e.g., adding an

fflush(stdout);

when switching from “shell” mode to “program” (curses) mode. Those are fairly rare because most programmers have learned not to mix printf and printw.

Symbol versioning

This release introduces symbol-versioning to ncurses because without it, the change of ABI would be less successful. A lengthy discussion will be presented in Symbol versioning in ncurses. These notes summarize what has changed, and what can be done with the new release.

Symbol-versioning allows the developers of a library to mark each public symbol (both data and functions) with an identifier denoting the library name and the version for which it was built. By doing this, users of the library have a way to help ensure that applications do not accidentally load an incompatible library. In addition, private symbols can be hidden entirely.

This release provides sample files for the four principal configurations of ncurses libraries: ncurses, ncursesw, ncursest and ncursestw. Each sample is given in two forms:

.map
These list all public symbols, together with version names.
.sym
These list all public symbols, without version names.

The sample files are generated by scripts which take into account a few special cases such as tack to omit many of the ncurses private symbols (beginning with “_nc_”). Here is are counts of globals versus locals:

Config Symbols Globals Locals "_nc_"
ncurses 976 796 180 332
ncursesw 1089 905 184 343
ncursest 979 804 175 358
ncursestw 1098 914 184 372

Although only four sample configurations are presented, each is formed by merging symbols from several combinations of configure-script options, taking into account advice from downstream packagers. Because they are formed by merging, the sample files may list a symbol which is not in a given package. That is expected. The samples have been tested and are working with systems (such as Fedora, FreeBSD and Debian) which fully support this feature. There are other systems which do not support the feature, and a few (such as Solaris) which provide incomplete support.

The version-naming convention used allows these sample files to build distinct libraries for ABI 5 and 6. Version names consist of

For example, running nm -D on the libraries in the ncurses6 test package shows these symbol-versions:

0000000000000000 A NCURSES6_TIC_5.0.19991023
0000000000000000 A NCURSES6_TIC_5.1.20000708
0000000000000000 A NCURSES6_TIC_5.5.20051010
0000000000000000 A NCURSES6_TIC_5.7.20081102
0000000000000000 A NCURSES6_TIC_5.9.20150530
0000000000000000 A NCURSES6_TINFO_5.0.19991023
0000000000000000 A NCURSES6_TINFO_5.1.20000708
0000000000000000 A NCURSES6_TINFO_5.2.20001021
0000000000000000 A NCURSES6_TINFO_5.3.20021019
0000000000000000 A NCURSES6_TINFO_5.4.20040208
0000000000000000 A NCURSES6_TINFO_5.5.20051010
0000000000000000 A NCURSES6_TINFO_5.6.20061217
0000000000000000 A NCURSES6_TINFO_5.7.20081102
0000000000000000 A NCURSES6_TINFO_5.8.20110226
0000000000000000 A NCURSES6_TINFO_5.9.20150530
0000000000000000 A NCURSESW6_5.1.20000708
0000000000000000 A NCURSESW6_5.3.20021019
0000000000000000 A NCURSESW6_5.4.20040208
0000000000000000 A NCURSESW6_5.5.20051010
0000000000000000 A NCURSESW6_5.6.20061217
0000000000000000 A NCURSESW6_5.7.20081102
0000000000000000 A NCURSESW6_5.8.20110226
0000000000000000 A NCURSESW6_5.9.20150530

As a special case, this release (which makes the final change for ABI 5) is marked with release version 5.9 and patch date 20150530.

Miscellaneous

The new release has several improvements for performance and building. For instance:

There are also new features in the libraries:

There are a few new configure options dealing with library customization:

Program improvements

Utilities

Most of the termcap-related changes based on development of tctest (termcap library checker) are implemented in the tic and infocmp programs rather than affecting the library. As noted in the discussion of tctest, ncurses's ability to translate between terminfo and termcap formats has been improved at different times, but subject to feedback from "real" termcap users. There are very few of those. Nowadays, virtually all termcap users are using ncurses (or NetBSD, with its own terminfo library) and their programs are actually using terminfo rather than termcap data.

Still, there are a few. A comment about the translation of the ASCII NUL character prompted a review:

As a result of the review, several improvements were made to ncurses translation to/from termcap format — and improving the checks made in tic for consistency of entries. Most of these are not of general interest, except for two new command-line options for tic and infocmp:

Other user-visible improvements and new features include:

Examples

Along with the library and utilities, many improvements were made to the ncurses-examples. Some were made to allow building (and comparison-testing) against NetBSD curses and PDCurses. Both lack some of the X/Open Curses features, necessitating customization. But this activity was useful because it showed some remaining performance issues (which have been resolved in this release).

These changes were made to verify compatibility or compare performance of ncurses:

These changes were made to help with the MinGW port:

These changes were made to verify new extensions in ncurses:

These changes were made to make the examples more useful:

Terminal database

This release provides improvements to tic's “-c” checking option, which was used for example to

There are several new terminal descriptions:

A few entries use extensions (user-defined terminal capabilities):

A few terminals support italics and/or dim capabilities. In particular, screen does not. Documented that, and accommodated the terminals where this feature works with the A_ITALIC extension.

Documentation

As usual, this release

In addition, the mechanism for producing HTML versions of the documentation has been improved:

Interesting bug-fixes

Configuration changes

Major changes

The ncurses 6.0 configure script makes changes to the default value of several configure options, depending on the --with-abi-version option (i.e., whether its value is “5” or “6”):

--enable-const

Feature introduced in 970405 supports the use of const where X/Open Curses should have, but did not. NetBSD curses does something similar with const.

--enable-ext-colors

Extends the cchar_t structure to allow more than 16 colors to be encoded. This applies only to the wide-character (--enable-widec) configuration.

--enable-ext-mouse

Modifies the encoding of mouse state to make room for a 5th mouse button. That allows one to use ncurses with a wheel mouse with xterm or similar X terminal emulators.

--enable-ext-putwin

Modifies the file-format written by putwin to use printable text rather than binary files, allowing getwin to read screen dumps written by differently-configured ncurses libraries. The extended getwin can still read binary screen dumps from the same configuration of ncurses. This does not change the ABI (the binary interface seen by calling applications).

--enable-interop

Modifies the FIELDTYPE structure used for the form library to make it more generic.

--enable-lp64

Allows an application to define _LP64 to declare chtype and mmask_t as simply “unsigned” rather than the configured types using the --with-chtype and --with-mmask_t options.

--enable-sp-funcs

Compile-in support for extended functions which accept a SCREEN pointer, reducing the need for juggling the global SP value with set_term and delscreen.

--with-chtype=uint32_t

Makes chtype explicitly a 32-bit unsigned value.

--with-mmask_t=uint32_t

Makes mmask_t explicitly a 32-bit unsigned value.

--with-tparm-arg=intptr_t

X/Open Curses declares tparm using long for each of the parameters aside from the formatting string, presuming that long and char* are the same size. This configure option uses intptr_t which provides a better guarantee of the sizes.

The configure script no longer checks for antique compilers; c89 is assumed as a minimum. There are a few features from later revisions which are used when available. The configure script makes checks to turn on useful warnings from clang, gcc and icc. You should be able to build ncurses 6.0 with any of the current (or not so current) C compilers available in 2015.

The configure script, by the way, makes changes which do not work with systems whose /bin/sh is non-POSIX. This mainly affects Solaris (the other vendor unix systems have followed the POSIX guidelines for the past twenty years). If you must build on Solaris, its xpg4 binaries suffice, e.g.,

#!/bin/sh
WHAT=`hostname|sed -e 's/\..*//'`
OUT=configure.out
cat >>$OUT <<EOF/
** 
`date`
** node: 
$WHAT
** user: 
`id`
** conf: $*
EOF/

 
SHELL=/bin/sh
if test -f /usr/xpg4/bin/sh
then
        CONFIG_SHELL=/usr/xpg4/bin/sh
        export CONFIG_SHELL
        SHELL=$CONFIG_SHELL
fi
 
rm -f config.status config.cache
TOP=$HOME/$WHAT
$SHELL ./configure --verbose \
        --disable-echo \
        --disable-overwrite \
        --enable-warnings \
        --with-warnings \
        --prefix=$TOP $* 2>&1 | tee -a $OUT

Other major changes to the configure script include:

Configuration options

There are several new (or extended) configure options:

--disable-db-install

Do not install the terminal database. This is used to omit features for packages, as done with --without-progs. The option simplifies building cross-compile support packages.

--disable-gnat-projects

This option is used for regression testing

--disable-lib-suffixes

Suppress the “w”, “t” or “tw” suffixes which normally would be added to the library names for the --enable-widec and --with-pthread options.

--with-cxx-shared

When --with-shared is set, build libncurses++ as a shared library. This implicitly relies upon building with gcc/g++, since other compiler suites may have differences in the way shared libraries are built. libtool by the way has similar limitations.

--with-hashed-db

Extended this configure option to simplify building with different versions of Berkeley database using FreeBSD ports.

--with-pc-suffix

If ".pc" files are installed, optionally add a suffix to the files and corresponding package names to separate unusual configurations. If no option value is given (or if it is "none"), no suffix is added. This option is used in the test package for ncurses6.

--with-xterm-kbs

Configure xterm's terminfo entries to use either BS (^H, i.e., ASCII backspace) or DEL (^?, or 127).

Portability

MinGW

Most of the portability-related work since ncurses 5.9 extended and improved the MinGW port introduced in ncurses 5.8.

The MinGW port can be readily cross-compiled:

The MinGW-specific Windows driver accounts for several changes:

Finally, there are other improvements:

Other ports

These changes affect certain platforms (ports):


Features of ncurses

The ncurses package is fully upward-compatible with SVr4 (System V Release 4) curses:

The ncurses package also has many useful extensions over SVr4:

Applications using ncurses

The ncurses distribution includes a selection of test programs (including a few games). These are available separately as ncurses-examples

The ncurses library has been tested with a wide variety of applications including:

cdk

Curses Development Kit

/cdk/

ded

directory-editor

/ded/

dialog

the underlying application used in Slackware's setup, and the basis for similar install/configure applications on many systems.

/dialog/

lynx

the text WWW browser

http://lynx.isc.org/

Midnight Commander

file manager

http://www.midnight-commander.org/

mutt

mail utility

http://www.mutt.org/

ncftp

file-transfer utility

http://www.ncftp.com/

nvi

New vi uses ncurses.

https://sites.google.com/a/bostic.com/keithbostic/nvi

tin

newsreader, supporting color, MIME

http://www.tin.org/

as well as some that use ncurses for the terminfo support alone:

minicom

terminal emulator for serial modem connections

http://alioth.debian.org/projects/minicom/

mosh

a replacement for ssh.

https://mosh.mit.edu/

tack

terminfo action checker

/ncurses/tack.html

tmux

terminal multiplexor

http://tmux.github.io/

vile

vi-like-emacs may be built to use the terminfo, termcap or curses interfaces.

/vile/

and finally, those which use only the termcap interface:

emacs

text editor

http://www.gnu.org/software/emacs/

screen

terminal multiplexor

http://www.gnu.org/software/screen/

vim

text editor

http://www.vim.org/

Development activities

Zeyd Ben-Halim started ncurses from a previous package pcurses, written by Pavel Curtis. Eric S. Raymond continued development. Jürgen Pfeifer wrote most of the form and menu libraries. Ongoing development work is done by Thomas Dickey. Thomas Dickey also acts as the maintainer for the Free Software Foundation, which holds the copyright on ncurses.

Contact the current maintainers at

bug-ncurses@gnu.org

To join the ncurses mailing list, please write email to

bug-ncurses-request@gnu.org
containing the line:

subscribe <name>@<host.domain>

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/ .

There is an archive of the mailing list here:

http://lists.gnu.org/archive/html/bug-ncurses (also https)

Related resources

The release notes make scattered references to these pages, which may be interesting by themselves:

Other resources

The distribution provides a newer version of the terminfo-format terminal description file once maintained by Eric Raymond . Unlike the older version, the termcap and terminfo data are provided in the same file, and provides several user-definable extensions beyond the X/Open specification.

You can find lots of information on terminal-related topics not covered in the terminfo file at Richard Shuford's archive .