- Tput
Tput is a standard
Unix computeroperating system command which is used to set terminal features.Depending on the system, "tput" uses the
terminfo ortermcap 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 theAT&T "tput" was submitted to volume 7 of the mod.sources newsgroup (later comp.sources.unix) in September 1986. [cite web
url=http://gatekeeper.hpl.hp.com/archive/pub/usenet/comp.sources.unix/volume7/tput.Z
title=Public-domain tput(1) program
first=Badri
last=Lokanathan
date=1986-08-28
accessdate=2008-04-22] [cite web
url=http://gatekeeper.hpl.hp.com/archive/pub/usenet/comp.sources.unix/volume7/tput2.Z
title=Public-domain TPUT (corrected implementation)
first=Badri
last=Lokanathan
date=1986-09-19
accessdate=2008-04-22] In contrast to the System V program, the clone used termcap rather than terminfo. It accepted command-line parameters for thecm
(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 asreset
, thereby simplifying use of "tput" for initializing or reinitializing the terminal. [citation
url=http://books.google.com/books?id=GsUMLqtYI1UC&dq=tput&source=gbs_summary_s&cad=0
title=Termcap and terminfo
last1=Strang
first1=John
last2=Mui
first2=Linda
last3=O'Reilly
first3=Tim
publisher=O'Reilly
date=1988
page= [http://books.google.com/books?id=GsUMLqtYI1UC&pg=PA56&lpg=PA56&dq=tput&source=web&ots=RnDIfpRWXc&sig=XVEfQkgjzMA7HC2wdAJMEC9bUlI&hl=en 56-57]
isbn=0937175226] System V Release 3.2 added several printer-specific capabilities to the terminfo database, such asswidm
(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 capabilitiessetaf
andsetab
, which could be used by "tput".BSD platforms provided a different implementation of "tput" in 4.3BSD-Reno (June 1990). [cite web
url=http://minnie.tuhs.org/Unix_History/4bsd
title=3BSD/4BSD versions
date=2000-06-25
publisher=The Unix Heritage Society
accessdate=2008-04-20] 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. [cite web
url=http://www.freebsd.org/cgi/cvsweb.cgi/src/usr.bin/tput/tput.c
title=CVS log for src/usr.bin/tput/tput.c
date=May 27, 1994]Ross Ridge's mytinfo package in 1992 [cite web
url=http://www.isc.org/index.pl?/sources/utils/terminal/mytinfo.php
author=Ross Ridge
title=mytinfo posting to comp.sources.unix newsgroup
publisher=Internet Systems Consortium, Inc
date=December 27 1992] 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
andreset
).Most implementations accept the name of a terminal capability together with any parameters that may be needed for that.However, some implementations expect atermcap name, while others expect aterminfo 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 keywordlongname
. 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.ee also
*
List of Unix programs Notes
External links
* [http://www.opengroup.org/onlinepubs/009695399/utilities/tput.html The Open Group Base Specifications Issue 6 "tput"]
Manual pages
* [http://invisible-island.net/ncurses/man/tput.1.html "tput(1)" manual page for ncurses]
* [http://www.ncsa.uiuc.edu/UserInfo/Resources/Hardware/IBMp690/IBM/usr/share/man/info/en_US/a_doc_lib/cmds/aixcmds5/tput.htm AIX]
* [http://marbl.com/cgi-bin/bsdi-man?proto=1.1&query=tput&msection=1&apropos=0 BSDI]
* [http://ou800doc.caldera.com/en/man/html.1/tput.1.html Caldera]
* [http://docs.hp.com/en/B3921-90010/tput.1.html HPUX]
* [http://techpubs.sgi.com/library/tpl/cgi-bin/getdoc.cgi?coll=0650&db=man&fname=/usr/share/catman/u_man/cat1/tput.z SGI]
* [http://docs.sun.com/app/docs/doc/816-5165/tput-1?a=view Sun]
* [http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51_HTML/MAN/MAN1/0386____.HTM Tru64]Tutorials
* [http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x405.html "Colours and Cursor Movement With tput" in Bash Prompt HOWTO]
* [http://www.ibm.com/developerworks/aix/library/au-learningtput/?S_TACT=105AGY06& "Discover tput" on IBM DeveloperWorks]
Wikimedia Foundation. 2010.