tput
{{Short description|Standard Unix operating system command}}
{{lowercase|title=tput}}
{{Infobox software
| name = tput
| logo =
| screenshot =
| screenshot size =
| caption =
| author =
| developer =
| released = {{Start date and age|1980s}}
| latest release version =
| latest release date =
| operating system = Unix and Unix-like
| platform = Cross-platform
| genre = Command
| license =
| website =
}}
In computing, tput is a standard Unix operating system command which makes use of terminal capabilities.
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.{{cite web
|url=https://groups.google.com/forum/embed/#!topic/mod.sources/G1VegA0Aa_w
|title=Public-domain tput(1) program
|first=Badri
|last=Lokanathan
|date=1986-08-28
|access-date=2008-04-22
|url=https://groups.google.com/forum/embed/#!topic/mod.sources/Eq3EPGxuYrI
|title=Public-domain TPUT (corrected implementation)
|first=Badri
|last=Lokanathan
|date=1986-09-19
|access-date=2008-04-22
}} 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.{{Cite book
|url=https://books.google.com/books?id=GsUMLqtYI1UC&q=tput
|title=Termcap and terminfo
|last1=Strang
|first1=John
|last2=Mui
|first2=Linda
|last3=O'Reilly
|first3=Tim
|publisher=O'Reilly
|year=1988
|page=[https://books.google.com/books?id=GsUMLqtYI1UC&pg=PA56 56–57]
|isbn=0-937175-22-6
}} 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).{{cite web
|url=http://minnie.tuhs.org/Unix_History/4bsd
|title=3BSD/4BSD versions
|date=2000-06-25
|publisher=The Unix Heritage Society
|access-date=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 newsgroup
|url=https://groups.google.com/forum/#!topic/comp.sources.unix/tC8cAf6ZHjM
|author=Ross Ridge
|title=mytinfo - a replacement for terminfo and termcap
|newsgroup=comp.sources.unix
|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
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
References
{{Reflist}}
Further reading
- {{cite book|
title=Linux and UNIX shell programming|
series=Safari Tech Books Online|
chapter=Creating screen output|
first=D. S. W.|
last=Tansley|
publisher=Addison-Wesley|
year=2000|
isbn=978-0-201-67472-9|
url-access=registration|
url=https://archive.org/details/linuxunixshellpr00davi}}
External links
{{Wikibooks|Guide to Unix|Commands}}
=Manual pages=
- {{man|cu|tput|SUS}}
- {{man|1|tput|Linux}}
- [http://invisible-island.net/ncurses/man/tput.1.html tput(1) manual page for ncurses]
- [http://www.ibm.com/support/knowledgecenter/en/ssw_aix_61/com.ibm.aix.cmds5/tput.htm AIX]
- {{webarchive |url=https://web.archive.org/web/20130513061455/http://www.tenacitymedia.com/cgi-bin/bsdi-man?proto=1.1&query=tput&msection=1&apropos=0 |date=May 13, 2013 |title=BSDI }}
- [http://uw714doc.sco.com/en/man/html.1/tput.1.html SCO]
- {{webarchive |url= https://web.archive.org/web/20160304022957/http://h20565.www2.hpe.com/hpsc/doc/public/display?docId=emr_na-c02273396 |date=Mar 4, 2016 |title=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.oracle.com/cd/E23824_01/html/821-1461/tput-1.html Sun]
- {{webarchive |url=https://web.archive.org/web/20120207000157/http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51_HTML/MAN/MAN1/0386____.HTM |date=February 7, 2012 |title=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]
{{Unix commands}}