4 The ncurses (new curses) library is a free software emulation of
5 curses in System V Release 4.0, and more. It uses terminfo format,
6 supports pads and color and multiple highlights and forms characters
7 and function-key mapping, and has all the other SYSV-curses
8 enhancements over BSD curses.
10 In mid-June 1995, the maintainer of 4.4BSD curses declared that he
11 considered 4.4BSD curses obsolete, and is encouraging the keepers of
12 Unix releases such as BSD/OS, freeBSD and netBSD to switch over to
15 The ncurses code was developed under GNU/Linux. It has been in use for
16 some time with OpenBSD as the system curses library, and on FreeBSD
17 and NetBSD as an external package. It should port easily to any
18 ANSI/POSIX-conforming UNIX. It has even been ported to OS/2 Warp!
20 The distribution includes the library and support utilities, including
21 a terminfo compiler tic(1), a decompiler infocmp(1), clear(1),
22 tput(1), tset(1), and a termcap conversion tool captoinfo(1). Full
23 manual pages are provided for the library and tools.
25 The ncurses distribution is available via anonymous FTP at the GNU
26 distribution site [1]ftp://ftp.gnu.org/gnu/ncurses/ .
27 It is also available at [2]ftp://invisible-island.net/ncurses/ .
31 This release is designed to be upward compatible from ncurses 5.0 and
32 5.3; very few applications will require recompilation, depending on
33 the platform. These are the highlights from the change-log since
37 * add the remaining functions for X/Open curses wide-character
41 These are only available if the library is configured using the
42 --enable-widec option.
43 * write getyx() and related 2-return macros in terms of getcury(),
45 * simplify ifdef for bool declaration in curses.h
46 * modify ifdef's in curses.h that disabled use of __attribute__()
47 for g++, since recent versions implement the cases which ncurses
49 * add key_defined() function, to tell which keycode a string is
52 New features and improvements:
54 + implement logic in lib_mouse.c to handle position reports
55 which are generated when XFree86 xterm is initialized with
56 private modes 1002 or 1003. These are returned to the
57 application as the REPORT_MOUSE_POSITION mask, which was not
59 + modify soft-key initialization to use A_REVERSE if A_STANDOUT
60 would not be shown when colors are used, i.e., if ncv#1 is
61 set in the terminfo as is done in "screen".
62 + add configure option for FreeBSD sysmouse, --with-sysmouse,
63 and implement library support for that.
66 o allow it to run from fallback terminfo data.
67 o reset colors after each color test, correct a place
68 where exit_standout_mode was used instead of
70 o improve bce test by making it set colors other than
73 o handle a case where an entry has no description, and
74 capabilities begin on the same line as the entry name.
75 o allow a terminfo entry with a leading 2-character name.
76 o improved warnings when suppressing items to fit in
77 termcap's 1023-byte limit.
78 o add check for multiple "tc=" clauses in a termcap.
79 o correct logic for resolving "use=" clauses allow infocmp
80 and tic to show cancelled capabilities.
81 o check for incomplete line-drawing character mapping.
82 o check for missing/empty/illegal terminfo name.
84 o modify tput to use the same parameter analysis as
85 tparm() does, to provide for user-defined strings, e.g.,
86 for xterm title, a corresponding capability might be
89 o use the system's default values for CKILL and other
90 default control characters.
91 o correct interchanged defaults for kill and interrupt
92 characters, which caused it to report unnecessarily.
95 * prevent recursion in wgetch() via wgetnstr() if the connection
96 cannot be switched between cooked/raw modes because it is not a
98 * correct a case in _nc_remove_string(), used by define_key(), to
99 avoid infinite loop if the given string happens to be a substring
100 of other strings which are assigned to keys.
101 * modify logic of acsc to use the original character if no mapping
102 is defined, rather than a null.
103 * several improvements for handling multi-cell display of wide
105 + modify setcchar() to allow converting control characters to
107 + correct handling of multibyte characters in waddch_literal()
108 which force wrapping because they are started too late on the
110 + modify setcchar() to allow for wchar_t input strings that
111 have more than one spacing character.
112 * other fixes for wide-character support:
113 + rewrote lib_acs.c to allow PutAttrChar() to decide how to
114 render alternate-characters, i.e., to work with Linux console
116 + implement a workaround so that line-drawing works with
117 screen's crippled UTF-8 support (tested with 3.9.13). This
118 only works with the wide-character support (--enable-widec);
119 the normal library will simply suppress line-drawing when
120 running in a UTF-8 locale in screen.
121 + corrections to lib_get_wstr.c:
122 o null-terminate buffer passed to setcchar(), which
124 o map special characters such as erase- and
125 kill-characters into key-codes so those will work as
126 expected even if they are not mentioned in the terminfo.
127 * modify setupterm() to check if the terminfo and terminal-modes
128 have already been read. This ensures that it does not reinvoke
129 def_prog_mode() when an application calls more than one function,
130 such as tgetent() and initscr().
131 * fix form_driver() cases for REQ_CLR_EOF, REQ_CLR_EOL,
132 REQ_DEL_CHAR, REQ_DEL_PREV and REQ_NEW_LINE, which did not ensure
133 the cursor was at the editing position before making
135 * correct keybound(), which reported definitions in the wrong table,
136 i.e., the list of definitions which are disabled by keyok().
137 * fixes related to safe_sprintf.c:
138 + correct an allocation size in safe_sprintf.c for the "*"
140 + correct safe_sprintf.c to not return a null pointer if the
141 format happens to be an empty string.
142 + make return value from _nc_printf_string() consistent.
143 Before, depending on whether --enable-safe-sprintf was used,
144 it might not be cached for reallocating.
145 * other low-level improvements to the optimization code include:
146 + if the output is a socket or other non-tty device, use 1
147 millisecond for the cost in mvcur; previously it was 9
148 milliseconds because the baudrate was not known.
149 + modify lib_getch.c to avoid recursion via wgetnstr() when the
150 input is not a tty and consequently mode-changes do not work.
151 + fix several places in tack/pad.c which tested and used the
152 parameter- and parameterless strings inconsistently.
153 + change several tputs() calls in scrolling code to use putp(),
154 to enable padding which may be needed for some terminals.
155 + improve mvcur() by checking if it is safe to move when video
156 attributes are set (msgr), and if not, reset/restore
157 attributes within that function rather than doing it
158 separately in the GoTo() function in tty_update.c.
159 + use tputs() rather than putp() in a few cases in tty_update.c
160 since the corresponding delays are proportional to the number
161 of lines affected: repeat_char, clr_eos,
162 change_scroll_region.
163 * correct line/column reference in adjust_window(), needed to make
164 special windows such as curscr track properly when resizing.
165 * fix a potential recursion between napms() and _nc_timed_wait()
166 * rewrote lib_insch.c, combining it with lib_insstr.c so both handle
167 tab and other control characters consistently.
168 * do not try to open gpm mouse driver if standard output is not a
169 tty; the gpm library does not make this check.
175 --with-abi-version option.
176 addresses platforms where packagers have diverged
177 from ncurses ABI numbering.
179 --with-manpage-format=catonly
180 addresses behavior of BSDI, allow install of
181 man+cat files on NetBSD, whose behavior has
182 diverged by requiring both to be present.
184 --with-manpage-aliases
185 extends "--with-manpage-aliases" to provide the
186 option of generating ".so" files rather than
187 symbolic links for manpage aliases.
190 workaround to force libtool on Darwin generate the
191 "same" library names as with the "--with-shared"
192 option. The Darwin ld program does not work well
193 with a zero as the minor-version value.
196 simplifies defining TRACE to incorporate trace() in
199 + fixes/improvements for cross-compiling:
200 o allow BUILD_CC and related configure script variables to
201 be overridden from the environment.
202 o use AC_CHECK_TOOL to get proper values for AR and LD for
204 o use $cross_compiling variable in configure script rather
205 than comparing $host_alias and $target alias, since
206 "host" is traditionally misused in autoconf to refer to
208 o modify run_tic.in to avoid using wrong shared libraries
209 when cross-compiling.
210 + fixes for Mac OS X:
211 o fix a redefinition of $RANLIB in the configure script
212 when libtool is used.
213 o modify MKlib_gen.sh to avoid passing "#" tokens through
214 the C preprocessor. This works around Mac OS X's
215 preprocessor, which insists on adding a blank on each
217 + workarounds for broken tools:
218 o add configure check for wchar_t and wint_t types, rather
219 than rely on preprocessor definitions. Also work around
220 for gcc fixinclude bug which creates a shadow copy of
221 curses.h if it sees these symbols apparently typedef'd.
222 o modify configure script to omit -Winline for gcc 3.3,
223 since that feature is broken.
224 o several script fixes to work around the ironically named
225 POSIXLY_CORRECT feature of GNU sed 4.0.
226 o modify configure script to avoid using "head -1", which
227 does not work if POSIXLY_CORRECT (sic) is set.
228 o update configure script to reflect fix for
229 AC_PROG_GCC_TRADITIONAL, which is broken in autoconf
230 2.5x for Mac OS X 10.2.3.
231 o repair check for missing C++ compiler, which is broken
232 in autoconf 2.5x by hardcoding it to g++.
233 + corrected ifdef's relating to configure check for wchar_t,
235 + remove configure script check to allow -Wconversion for older
237 + modify configure script to accommodate libtool 1.5, as well
238 as add an parameter to the "--with-libtool" option which can
239 specify the pathname of libtool.
240 + change several sed scripts to avoid using "\+" since it is
241 not a BRE (basic regular expression). One instance caused
242 terminfo.5 to be misformatted on FreeBSD.
243 + use '%' as sed substitute delimiter in run_tic script to
244 avoid problems with pathname delimiters such as ':' and '@'.
245 + add -D_XOPEN_SOURCE=500 if needed when configuring with
246 "--enable-widec", to get mbstate_t declaration on HPUX 11.11.
248 + adjust include-options in CF_ETIP_DEFINES to avoid missing
249 ncurses_dll.h, fixing special definitions that may be needed
251 + modify CF_LIB_SUFFIX for Itanium releases of HP-UX, which use
253 + improve ifdef's to guard against redefinition of wchar_t and
255 + remove an #undef for KEY_EVENT from curses.tail used in the
256 experimental NCURSES_WGETCH_EVENTS feature. The #undef
257 confuses Debian dpkg's build script.
261 The ncurses package is fully compatible with SVr4 (System V Release 4)
263 * All 257 of the SVr4 calls have been implemented (and are
265 * Full support for SVr4 curses features including keyboard mapping,
266 color, forms-drawing with ACS characters, and automatic
267 recognition of keypad and function keys.
268 * An emulation of the SVr4 panels library, supporting a stack of
269 windows with backing store, is included.
270 * An emulation of the SVr4 menus library, supporting a uniform but
271 flexible interface for menu programming, is included.
272 * An emulation of the SVr4 form library, supporting data collection
273 through on-screen forms, is included.
274 * Binary terminfo entries generated by the ncurses tic(1)
275 implementation are bit-for-bit-compatible with the entry format
277 * The utilities have options to allow you to filter terminfo entries
278 for use with less capable curses/terminfo versions such as the
281 The ncurses package also has many useful extensions over SVr4:
282 * The API is 8-bit clean and base-level conformant with the X/OPEN
283 curses specification, XSI curses (that is, it implements all BASE
284 level features, but not all EXTENDED features). Most
285 EXTENDED-level features not directly concerned with wide-character
286 support are implemented, including many function calls not
287 supported under SVr4 curses (but portability of all calls is
288 documented so you can use the SVr4 subset only).
289 * Unlike SVr3 curses, ncurses can write to the rightmost-bottommost
290 corner of the screen if your terminal has an insert-character
292 * Ada95 and C++ bindings.
293 * Support for mouse event reporting with X Window xterm and OS/2
295 * Extended mouse support via Alessandro Rubini's gpm package.
296 * The function wresize() allows you to resize windows, preserving
298 * The function use_default_colors() allows you to use the terminal's
299 default colors for the default color pair, achieving the effect of
301 * The functions keyok() and define_key() allow you to better control
302 the use of function keys, e.g., disabling the ncurses KEY_MOUSE,
303 or by defining more than one control sequence to map to a given
305 * Support for 16-color terminals, such as aixterm and XFree86 xterm.
306 * Better cursor-movement optimization. The package now features a
307 cursor-local-movement computation more efficient than either BSD's
309 * Super hardware scrolling support. The screen-update code
310 incorporates a novel, simple, and cheap algorithm that enables it
311 to make optimal use of hardware scrolling, line-insertion, and
312 line-deletion for screen-line movements. This algorithm is more
313 powerful than the 4.4BSD curses quickch() routine.
314 * Real support for terminals with the magic-cookie glitch. The
315 screen-update code will refrain from drawing a highlight if the
316 magic- cookie unattributed spaces required just before the
317 beginning and after the end would step on a non-space character.
318 It will automatically shift highlight boundaries when doing so
319 would make it possible to draw the highlight without changing the
320 visual appearance of the screen.
321 * It is possible to generate the library with a list of pre-loaded
322 fallback entries linked to it so that it can serve those terminal
323 types even when no terminfo tree or termcap file is accessible
324 (this may be useful for support of screen-oriented programs that
325 must run in single-user mode).
326 * The tic(1)/captoinfo utility provided with ncurses has the ability
327 to translate many termcaps from the XENIX, IBM and AT&T extension
329 * A BSD-like tset(1) utility is provided.
330 * The ncurses library and utilities will automatically read terminfo
331 entries from $HOME/.terminfo if it exists, and compile to that
332 directory if it exists and the user has no write access to the
333 system directory. This feature makes it easier for users to have
334 personal terminfo entries without giving up access to the system
336 * You may specify a path of directories to search for compiled
337 descriptions with the environment variable TERMINFO_DIRS (this
338 generalizes the feature provided by TERMINFO under stock System
340 * In terminfo source files, use capabilities may refer not just to
341 other entries in the same source file (as in System V) but also to
342 compiled entries in either the system terminfo directory or the
343 user's $HOME/.terminfo directory.
344 * A script (capconvert) is provided to help BSD users transition
345 from termcap to terminfo. It gathers the information in a TERMCAP
346 environment variable and/or a ~/.termcap local entries file and
347 converts it to an equivalent local terminfo tree under
349 * Automatic fallback to the /etc/termcap file can be compiled in
350 when it is not possible to build a terminfo tree. This feature is
351 neither fast nor cheap, you don't want to use it unless you have
353 * The table-of-entries utility toe makes it easy for users to see
354 exactly what terminal types are available on the system.
355 * The library meets the XSI requirement that every macro entry point
356 have a corresponding function which may be linked (and will be
357 prototype-checked) if the macro definition is disabled with
359 * An HTML "Introduction to Programming with NCURSES" document
360 provides a narrative introduction to the curses programming
365 Numerous bugs present in earlier versions have been fixed; the library
366 is far more reliable than it used to be. Bounds checking in many
367 `dangerous' entry points has been improved. The code is now type-safe
368 according to gcc -Wall. The library has been checked for malloc leaks
369 and arena corruption by the Purify memory-allocation tester.
371 The ncurses code has been tested with a wide variety of applications
372 including (versions starting with those noted):
375 Curses Development Kit
376 [3]http://invisible-island.net/cdk/
377 [4]http://www.vexus.ca/products/CDK/
381 [5]http://invisible-island.net/ded/
384 the underlying application used in Slackware's setup, and the
385 basis for similar applications on GNU/Linux.
386 [6]http://invisible-island.net/dialog/
389 the character-screen WWW browser
390 [7]http://lynx.isc.org/release/
394 [8]http://www.ibiblio.org/mc/
398 [9]http://www.mutt.org/
401 file-transfer utility
402 [10]http://www.ncftp.com/
405 New vi versions 1.50 are able to use ncurses versions 1.9.7 and
407 [11]http://www.bostic.com/vi/
410 Lynx-like info browser.
411 [12]http://dione.ids.pl/~pborys/software/pinfo/
414 newsreader, supporting color, MIME [13]http://www.tin.org/
417 Volks-Hypertext browser for the Jargon File
418 [14]http://www.debian.org/Packages/unstable/text/vh.html
420 as well as some that use ncurses for the terminfo support alone:
424 [15]http://www.netsonic.fi/~walker/minicom.html
428 [16]http://invisible-island.net/vile/
430 The ncurses distribution includes a selection of test programs
431 (including a few games).
433 Who's Who and What's What
435 Zeyd Ben-Halim started it from a previous package pcurses, written by
436 Pavel Curtis. Eric S. Raymond continued development. Jürgen Pfeifer
437 wrote most of the form and menu libraries. Ongoing work is being done
438 by [17]Thomas Dickey. Thomas Dickey acts as the maintainer for the
439 Free Software Foundation, which holds the copyright on ncurses.
440 Contact the current maintainers at [18]bug-ncurses@gnu.org.
442 To join the ncurses mailing list, please write email to
443 bug-ncurses-request@gnu.org containing the line:
444 subscribe <name>@<host.domain>
446 This list is open to anyone interested in helping with the development
447 and testing of this package.
449 Beta versions of ncurses and patches to the current release are made
450 available at [19]ftp://invisible-island.net/ncurses/ .
454 * Extended-level XPG4 conformance, with internationalization
456 * Ports to more systems, including DOS and Windows.
458 We need people to help with these projects. If you are interested in
459 working on them, please join the ncurses list.
461 Other Related Resources
463 The distribution provides a newer version of the terminfo-format
464 terminal description file maintained by [20]Eric Raymond . Unlike the
465 older version, the termcap and terminfo data are provided in the same
468 You can find lots of information on terminal-related topics not
469 covered in the terminfo file at [21]Richard Shuford's archive .
473 1. ftp://ftp.gnu.org/gnu/ncurses/
474 2. ftp://invisible-island.net/ncurses/
475 3. http://invisible-island.net/cdk/
476 4. http://www.vexus.ca/products/CDK/
477 5. http://invisible-island.net/ded/
478 6. http://invisible-island.net/dialog/
479 7. http://lynx.isc.org/release/
480 8. http://www.ibiblio.org/mc/
481 9. http://www.mutt.org/
482 10. http://www.ncftp.com/
483 11. http://www.bostic.com/vi/
484 12. http://dione.ids.pl/~pborys/software/pinfo/
485 13. http://www.tin.org/
486 14. http://www.debian.org/Packages/unstable/text/vh.html
487 15. http://www.netsonic.fi/~walker/minicom.html
488 16. http://invisible-island.net/vile/
489 17. mailto:dickey@invisible-island.net
490 18. mailto:bug-ncurses@gnu.org
491 19. ftp://invisible-island.net/ncurses/
492 20. http://www.catb.org/~esr/terminfo/
493 21. http://www.cs.utk.edu/~shuford/terminal_index.html