Curses (pun on cursor optimization) is an Application Programming Interface for Unix operating systems, conceived by Ken Arnold for the creation of text user interfaces (TUI) for applications on terminals.
A complete guide for NCurses is available here.
This library allows the programmer to code for terminals without having to account for porting on the different terminals, by mapping the screen as a matrix of characters.
This enables the programmer to make the I/O not limited to either the user entering only ASCII characters or the program only outputting line by line.
In the beginning, programs could only input or output plain text, but commands existed to go beyond it.
The termcap file was then invented, listing all the "terminal capacities"; that is, commands helping to go beyond plain text, such as by adding colour. This format was later replaced by terminfo, standing for "terminal info".
Unfortunately, there was much variety among the terminals, which made the work of the programmers who wanted to manipulate the contents of the terminal screen very difficult, by forcing them either to restrict themselves to a set of terminals or to risk code bloat by coding for all the terminals on the market.
Ken Arnold studied at Berkeley, where he received his bachelor's degree in computer science in 1985, and was acquainted with the BSD project, as the president of the Berkeley Computer Club and the Computer Science Undergraduates Association.
One of his contributions for 2BSD and 4BSD was the creation of a library for controlling cursor movement, screen editing, and window creation on ASCII display terminals, inspiring himself from the vi editor code source. He then participated in the creation of Rogue, with several other coders.
This library was then included in the System V Release 4.0.
Although the development of curses ended circa 1995, other derived versions were developed:
- ncurses (next curses) was created by Zeyd Ben-Halim in 1993 from pcurses, freeware clone of the Bell version created by Pavel Curtis and maintained from 1982 to 1986.
- PDCurses, created in 1987 for the MS-DOS and Windows systems.
In addition, other libraries, though unrelated, exist for other platforms:
- Various variations on conio for MS-DOS (and sometimes the Windows Console).
- SMG$ for OpenVMS.
Software using curses
- Lynx (web browser)
- Pine (email client)
- GNU Alpine (GPL fork of Pine) (ncurses)
- Pico (text editor)
- GNU Nano (GPL fork of Pico)