Tput

Last updated

tput
Initial release1980s;40 years ago (1980s)
Operating system Unix and Unix-like
Platform Cross-platform
Type Command

In computing, tput is a standard Unix operating system command which makes use of terminal capabilities.

Contents

Depending on the system, tput uses the terminfo or termcap database, as well as looking into the environment for the terminal type.

History

Tput was provided in UNIX System V in the early 1980s. A clone of the AT&T tput was submitted to volume 7 of the mod.sources newsgroup (later comp.sources.unix) in September 1986. [1] [2] In contrast to the System V program, the clone used termcap rather than terminfo. It accepted command-line parameters for the cm (cursor addressing) capability, and recognized terminfo capability names.

System V Release 3 provided an improved version which combined the different initialization capabilities as a new option init, and the reset capabilities as reset, thereby simplifying use of tput for initializing or reinitializing the terminal. [3] System V Release 3.2 added several printer-specific capabilities to the terminfo database, such as swidm (enter_doublewide_mode) which tput could use. It also added capabilities for color.

System V Release 4 defined additional terminfo capabilities including standardized ANSI color capabilities setaf and setab, which could be used by tput.

BSD platforms provided a different implementation of tput in 4.3BSD-Reno (June 1990). [4] It used termcap, recognizing only termcap capability names, and did not accept command-line parameters for cursor-addressing. FreeBSD used this in 1994, improving it by accepting one or two numeric command-line parameters. [5]

Ross Ridge's mytinfo package in 1992 [6] provided a tput which accepted either termcap or terminfo capability names. Like the Reno implementation, it did not pass command-line arguments to parameterized capabilities. ncurses incorporated the mytinfo code in June 1995. The initial version added a -S option, and interpreted command-line parameters as described in the System V Release 4 documentation.

Portability

The Open Group defines one option (-T, to specify the terminal type) and three keywords (init, clear and reset). Most implementations accept the name of a terminal capability together with any parameters that may be needed for that. However, some implementations expect a termcap name, while others expect a terminfo name.

All System V Release 4 implementations, as well as those which are designed to be compatible, also recognize a -S option (to tell tput to read data from the standard input), and an additional keyword longname. They also accept command-line parameters, usually distinguishing numeric from string parameters by the form of the parameter, checking for all-numeric characters. That makes it impossible for example to set a function-key label to a string of digits. Using a different approach, ncurses determines the expected type of the parameters with a table of the terminfo capabilities which use string parameters, eliminating the ambiguity.

See also

Related Research Articles

ncurses

ncurses is a programming library providing an application programming interface (API) that allows the programmer to write text-based user interfaces in a terminal-independent manner. It is a toolkit for developing "GUI-like" application software that runs under a terminal emulator. It also optimizes screen changes, in order to reduce the latency experienced when using remote shells.

vi Keyboard-oriented text editor

vi is a screen-oriented text editor originally created for the Unix operating system. The portable subset of the behavior of vi and programs based on it, and the ex editor language supported within these programs, is described by the Single Unix Specification and POSIX.

ANSI escape code Method using in-band signaling to control the formatting, color, and other output options on video text terminals

ANSI escape sequences are a standard for in-band signaling to control cursor location, color, font styling, and other options on video text terminals and terminal emulators. Certain sequences of bytes, most starting with an ASCII escape character and a bracket character, are embedded into text. The terminal interprets these sequences as commands, rather than text to display verbatim.

ls

In computing, ls is a command to list computer files in Unix and Unix-like operating systems. ls is specified by POSIX and the Single UNIX Specification. When invoked without any arguments, ls lists the files in the current working directory. The command is also available in the EFI shell. In other environments, such as DOS, OS/2, and Microsoft Windows, similar functionality is provided by the dir command. The numerical computing environments MATLAB and GNU Octave include an ls function with similar functionality.

Computer terminal Computer input/output device; an electronic or electromechanical hardware device that is used for entering data into, and displaying data from, a computer or a computing system update programming

A computer terminal is an electronic or electromechanical hardware device that can be used for entering data into, and transcribing data from, a computer or a computing system. The teletype was an example of an early day hardcopy terminal, and predated the use of a computer screen by decades.

curses (programming library)

curses is a terminal control library for Unix-like systems, enabling the construction of text user interface (TUI) applications.

The archiver, also known simply as ar, is a Unix utility that maintains groups of files as a single archive file. Today, ar is generally used only to create and update static library files that the link editor or linker uses and for generating .deb packages for the Debian family; it can be used to create archives for any purpose, but has been largely replaced by tar for purposes other than static libraries. An implementation of ar is included as one of the GNU Binutils.

Text-based user interface Type of interface based on outputting to or controlling a text display

In computing, text-based user interfaces (TUI), is a retronym describing a type of user interface (UI) common as an early form of human–computer interaction, before the advent of graphical user interfaces (GUIs). Like GUIs, they may use the entire screen area and accept mouse and other inputs. They may also use color and often structure the display using special graphical characters such as ┌ and ╣, referred to in Unicode as the "box drawing" set. The modern context of use is usually a terminal emulator.

In most Unix and Unix-like operating systems, the ps program displays the currently-running processes. A related Unix utility named top provides a real-time view of the running processes.

nvi Re-implementation of ex/vi

nvi is a re-implementation of the classic Berkeley text editor, ex/vi, traditionally distributed with BSD and, later, Unix systems. It was originally distributed as part of the Fourth Berkeley Software Distribution (4BSD).

The standard Unix command who displays a list of users who are currently logged into the computer.

A bell code is a device control code originally sent to ring a small electromechanical bell on tickers and other teleprinters and teletypewriters to alert operators at the other end of the line, often of an incoming message. Though tickers punched the bell codes into their tapes, printers generally do not print a character when the bell code is received. Bell codes are usually represented by the label "BEL". They have been used since 1870.

init

In Unix-based computer operating systems, init is the first process started during booting of the computer system. Init is a daemon process that continues running until the system is shut down. It is the direct or indirect ancestor of all other processes and automatically adopts all orphaned processes. Init is started by the kernel during the booting process; a kernel panic will occur if the kernel is unable to start it. Init is typically assigned process identifier 1.

clear (Unix)

clear is a computer operating system command which is used to bring the command line on top of the computer terminal. It is available in various Unix shells on Unix and Unix-like operating systems as well as on other systems such as KolibriOS.

Terminfo

Terminfo is a library and database that enables programs to use display terminals in a device-independent manner. Mark Horton implemented the first terminfo library in 1981–1982 as an improvement over termcap. The improvements include

Termcap

Termcap 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 mode applications. Bill Joy wrote the first termcap library in 1978 for the Berkeley Unix operating system; it has since been ported to most Unix and Unix-like environments, even Multics. Joy's design was reportedly influenced by the design of the terminal data store in the earlier Incompatible Timesharing System.

getopts is a built-in Unix shell command for parsing command-line arguments. It is designed to process command line arguments that follow the POSIX Utility Syntax Guidelines, based on the C interface of getopt.

Command-line interface Type of computer interface based on entering text commands and viewing text output

A command-line interface (CLI) processes commands to a computer program in the form of lines of text. The program which handles the interface is called a command-line interpreter or command-line processor. Operating systems implement a command-line interface in a shell for interactive access to operating system functions or services. Such access was primarily provided to users by computer terminals starting in the mid-1960s, and continued to be used throughout the 1970s and 1980s on VAX/VMS, Unix systems and personal computer systems including DOS, CP/M and Apple DOS.

The POSIX terminal interface is the generalized abstraction, comprising both an Application Programming Interface for programs, and a set of behavioural expectations for users of a terminal, as defined by the POSIX standard and the Single Unix Specification. It is a historical development from the terminal interfaces of BSD version 4 and Seventh Edition Unix.

In computing and telecommunications, the capabilities of a terminal are various terminal features, above and beyond what is available from a pure teletypewriter, that host systems can make use of. They are (mainly) of control codes and escape codes that can be sent to or received from the terminal. The escape codes sent to the terminal perform various functions that a CRT terminal is capable of, but that a teletypewriter is not; such as moving the terminal's cursor to positions on the screen, clearing and scrolling all or parts of the screen, turning on and off attached printer devices, programming programmable function keys, changing display colours and attributes, and setting display title strings. The escape codes received from the terminal signify things such as function key, arrow key, and other special key keystrokes.

References

  1. Lokanathan, Badri (1986-08-28). "Public-domain tput(1) program" . Retrieved 2008-04-22.
  2. Lokanathan, Badri (1986-09-19). "Public-domain TPUT (corrected implementation)" . Retrieved 2008-04-22.
  3. Strang, John; Mui, Linda; O'Reilly, Tim (1988). Termcap and terminfo. O'Reilly. p.  56–57. ISBN   0-937175-22-6.
  4. "3BSD/4BSD versions". The Unix Heritage Society. 2000-06-25. Retrieved 2008-04-20.
  5. "CVS log for src/usr.bin/tput/tput.c". May 27, 1994.
  6. Ross Ridge (December 27, 1992). "mytinfo - a replacement for terminfo and termcap". Newsgroup:  comp.sources.unix.

Further reading

Manual pages

Tutorials