HOME

TheInfoList



OR:

curses is a
terminal Terminal may refer to: Computing Hardware * Terminal (electronics), a device for joining electrical circuits together * Terminal (telecommunication), a device communicating over a line * Computer terminal, a set of primary input and output devi ...
control
library A library is a collection of materials, books or media that are accessible for use and not just for display purposes. A library provides physical (hard copies) or digital access (soft copies) materials, and may be a physical location or a vi ...
for
Unix-like A Unix-like (sometimes referred to as UN*X or *nix) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Unix-li ...
systems, enabling the construction of text user interface (TUI) applications. The name is a pun on the term " cursor optimization". It is a library of functions that manage an application's display on character-cell terminals (e.g.,
VT100 The VT100 is a video terminal, introduced in August 1978 by Digital Equipment Corporation (DEC). It was one of the first terminals to support ANSI escape codes for cursor control and other tasks, and added a number of extended codes for special ...
).


Overview

Using curses, programmers are able to write text-based applications without writing directly for any specific terminal type. The curses library on the executing system sends the correct control characters based on the terminal type. It provides an abstraction of one or more windows that maps onto the terminal screen. Each window is represented by a character matrix. The programmer sets up the desired appearance of each window, then tells the curses package to update the screen. The library determines a minimal set of changes that are needed to update the display and then executes these using the terminal's specific capabilities and control sequences. In short, this means that the programmer simply creates a character matrix of how the screen should look and lets curses handle the work. The curses API is described in several places. Most implementations of curses use a database that can describe the capabilities of thousands of different terminals. There are a few implementations, such as PDCurses, which use specialized device drivers rather than a terminal database. Most implementations use terminfo; some use
termcap Termcap (''terminal capability'') is a software library and database used on Unix-like computers. It enables programs to use display computer terminals in a device-independent manner, which greatly simplifies the process of writing portable text ...
. Curses has the advantage of back-portability to character-cell terminals and simplicity. For an application that does not require bit-mapped graphics or multiple fonts, an interface implementation using curses will usually be much simpler and faster than one using an X toolkit.


History

The first curses library was written by
Ken Arnold Kenneth Cutts Richard Cabot Arnold (born 1958) is an American computer programmer well known as one of the developers of the 1980s dungeon-crawling video game ''Rogue'', for his contributions to the original Berkeley ( BSD) distribution of Uni ...
and originally released with BSD UNIX, where it was used for several games, most notably ''
Rogue A rogue is a person or entity that flouts accepted norms of behavior. Rogue or rogues may also refer to: Companies * Rogue Ales, a microbrewery in Newport, Oregon * Rogue Arts, a film production company * Rogue Entertainment, a software co ...
''. Some improvements were made to the BSD library in the 1990s as "4.4BSD" curses, e.g., to provide more than one type of video highlighting. However, those are not widely used. The name "curses" is a pun on ''cursor optimization''. Sometimes it is incorrectly stated that curses was used by the vi editor. In fact the code in curses that optimizes moving the cursor from one place on the screen to another was borrowed from vi, which predated curses. According to Goodheart, Ken Arnold's original implementation of curses started by reusing functions from the
termcap Termcap (''terminal capability'') is a software library and database used on Unix-like computers. It enables programs to use display computer terminals in a device-independent manner, which greatly simplifies the process of writing portable text ...
library, and adding to that. A few years later,
Mary Ann Horton Mary Ann Horton (born Mark R. Horton, on November 21, 1955), is a Usenet and Internet pioneer. Horton contributed to Berkeley UNIX (BSD), including the vi editor and terminfo database, (see Acknowlegments section at end of file) created the firs ...
, who had maintained the vi and
termcap Termcap (''terminal capability'') is a software library and database used on Unix-like computers. It enables programs to use display computer terminals in a device-independent manner, which greatly simplifies the process of writing portable text ...
sources at Berkeley, went to
AT&T Corporation AT&T Corporation, originally the American Telephone and Telegraph Company, is the subsidiary of AT&T Inc. that provides voice, video, data, and Internet telecommunications and professional services to businesses, consumers, and government agen ...
and made a different version using terminfo, which became part of UNIX System III and
UNIX System V Unix System V (pronounced: "System Five") is one of the first commercial versions of the Unix operating system. It was originally developed by AT&T and first released in 1983. Four major versions of System V were released, numbered 1, 2, 3, an ...
. Due to licensing restrictions on the latter, the BSD and AT&T versions of the library were developed independently. In addition to the termcap/terminfo improvement, other improvements were made in the AT&T version: ; video highlighting (bold, underline): The BSD version supported only ''standout''. ; line-drawing: The BSD version gave little support here. ; colors: This was not supported in the BSD version. AT&T curses development appears to have halted in the mid-1990s when X/Open Curses was defined. However, development of ncurses and
PDCurses PDCurses is a public domain software programming library for DOS, OS/2, Windows, X11 and Simple DirectMedia Layer, SDL2. It is a continuation of the original curses (programming library), curses system - while development of curses ended in the mi ...
continues. A version of BSD curses continues to be maintained in the
NetBSD NetBSD is a free and open-source Unix operating system based on the Berkeley Software Distribution (BSD). It was the first open-source BSD descendant officially released after 386BSD was forked. It continues to be actively developed and is ava ...
operating system (wide character support, termcap to terminfo migration, etc.).


pcurses and PDCurses

Different lines of development started by imitating the AT&T curses, from at least three implementations: pcurses by Pavel Curtis (started in 1982), PDCurses (Public Domain curses) by Mark Hessling to support his editor THE (started in 1987) as well as Rexx/Curses, and PC curses (version 1.4 and earlier by Bjorn Larsson-based inspired by Pavel Curtis' library before 1990.)


ncurses

ncurses (new curses) "originated as pcurses... and was re-issued as ncurses 1.8.1 in late 1993". ncurses is the most widely known implementation of curses, and has motivated further development of other variations, such as BSD curses in the
NetBSD NetBSD is a free and open-source Unix operating system based on the Berkeley Software Distribution (BSD). It was the first open-source BSD descendant officially released after 386BSD was forked. It continues to be actively developed and is ava ...
project.


Portability

Although the ncurses library was initially developed under Linux, OpenBSD, FreeBSD, and NetBSD, it has been ported to many other ANSI/POSIX UNIX systems, mainly by Thomas Dickey. PDCurses, while not identical to ncurses, uses the same function calls and operates the same way as ncurses does except that PDCurses targets different devices, e.g., console windows for
DOS DOS is shorthand for the MS-DOS and IBM PC DOS family of operating systems. DOS may also refer to: Computing * Data over signalling (DoS), multiplexing data onto a signalling channel * Denial-of-service attack (DoS), an attack on a communicat ...
, Win32,
OS/2 OS/2 (Operating System/2) is a series of computer operating systems, initially created by Microsoft and IBM under the leadership of IBM software designer Ed Iacobucci. As a result of a feud between the two companies over how to position OS/2 r ...
, as well as X11. Porting between the two is not difficult. For example, the
roguelike Roguelike (or rogue-like) is a subgenre of role-playing computer games traditionally characterized by a dungeon crawl through procedurally generated levels, turn-based gameplay, grid-based movement, and permanent death of the player charac ...
game '' ADOM'' was written for Linux and ncurses, later ported to DOS and PDCurses.


Screenshots

Image:Tin_console.png, Color newsreader interface for tin Image:Jack-curses-screen.gif, Curses used in Jack


Curses-based software

Curses-based software is software whose
user interface In the industrial design field of human–computer interaction, a user interface (UI) is the space where interactions between humans and machines occur. The goal of this interaction is to allow effective operation and control of the machine f ...
is implemented through the curses library, or a compatible library (such as ncurses). Curses is designed to facilitate GUI-like functionality on a text-only device, such as a PC running in console mode, a hardware ANSI terminal, a
Telnet Telnet is an application protocol used on the Internet or local area network to provide a bidirectional interactive text-oriented communication facility using a virtual terminal connection. User data is interspersed in-band with Telnet control i ...
or SSH client, or similar. Curses-based programs often have a user interface that resembles a traditional graphical user interface, including ' widgets' such as text boxes and scrollable lists, rather than the
command line interface A command-line interpreter or command-line processor uses a command-line interface (CLI) to receive commands from a user in the form of lines of text. This provides a means of setting parameters for the environment, invoking executables and pro ...
(CLI) most commonly found on text-only devices. This can make them more user-friendly than a CLI-based program, while still being able to run on text-only devices. Curses-based software can also have a lighter resource footprint and operate on a wider range of systems (both in terms of hardware and software) than their GUI-based counterparts. This includes old pre-1990 machines along with modern embedded systems using text-only displays. Curses is most commonly associated with
Unix-like A Unix-like (sometimes referred to as UN*X or *nix) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Unix-li ...
operating systems, although implementations for
Microsoft Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for ...
also exist.


See also

*
conio conio.h is a C header file used mostly by MS-DOS compilers to provide console input/output. It is not part of the C standard library or ISO C, nor is it defined by POSIX. This header declares several useful library functions for performing ...
– a similar idea, for
DOS DOS is shorthand for the MS-DOS and IBM PC DOS family of operating systems. DOS may also refer to: Computing * Data over signalling (DoS), multiplexing data onto a signalling channel * Denial-of-service attack (DoS), an attack on a communicat ...
*
S-Lang The S-Lang programming library is a software library for Unix, Windows, VMS, OS/2, and Mac OS X. It provides routines for embedding an interpreter for the S-Lang scripting language, and components to facilitate the creation of text-based appl ...
– an interpreted language with some related features * SMG$ – a similar idea, for
OpenVMS OpenVMS, often referred to as just VMS, is a multi-user, multiprocessing and virtual memory-based operating system. It is designed to support time-sharing, batch processing, transaction processing and workstation applications. Customers using Ope ...
*
Newt A newt is a salamander in the subfamily Pleurodelinae. The terrestrial juvenile phase is called an eft. Unlike other members of the family Salamandridae, newts are semiaquatic, alternating between aquatic and terrestrial habitats. Not all aqua ...
- a similar text UI library based on the slang library


References


External links


NCURSES - Manual Pages

Curses tutorial
(
PDF Portable Document Format (PDF), standardized as ISO 32000, is a file format developed by Adobe in 1992 to present documents, including text formatting and images, in a manner independent of application software, hardware, and operating systems. ...
format)
Public Domain Curses

Interface for Rexx programmers

Tcl Toolkit





NetBSD Curses main manual page

X/Open Curses, Issue 4, Version 2
1996, opengroup.org
X/Open Curses, Issue 7
2009, opengroup.org {{DEFAULTSORT:Curses (Programming Library) Unix software