1.\" $OpenBSD: tput.1,v 1.23 2016/12/28 22:47:11 schwarze Exp $ 2.\" $NetBSD: tput.1,v 1.4 1994/12/07 08:49:10 jtc Exp $ 3.\" 4.\" Copyright (c) 1989, 1990, 1993 5.\" The Regents of the University of California. All rights reserved. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions 9.\" are met: 10.\" 1. Redistributions of source code must retain the above copyright 11.\" notice, this list of conditions and the following disclaimer. 12.\" 2. Redistributions in binary form must reproduce the above copyright 13.\" notice, this list of conditions and the following disclaimer in the 14.\" documentation and/or other materials provided with the distribution. 15.\" 3. Neither the name of the University nor the names of its contributors 16.\" may be used to endorse or promote products derived from this software 17.\" without specific prior written permission. 18.\" 19.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29.\" SUCH DAMAGE. 30.\" 31.\" @(#)tput.1 8.2 (Berkeley) 3/19/94 32.\" 33.Dd $Mdocdate: December 28 2016 $ 34.Dt TPUT 1 35.Os 36.Sh NAME 37.Nm tput , 38.Nm clear 39.Nd terminal capability interface 40.Sh SYNOPSIS 41.Nm tput 42.Op Fl T Ar term 43.Ar attribute 44.Op Ar attribute-args 45.Ar ... 46.Nm tput 47.Op Fl T Ar term 48.Fl S 49.Nm clear 50.Op Fl T Ar term 51.Sh DESCRIPTION 52The 53.Nm 54utility makes terminal-dependent information available to users or shell 55applications. 56When invoked as 57.Nm clear 58it provides the same functionality as 59.Nm tput Cm clear . 60.Pp 61The options are as follows: 62.Bl -tag -width Ds 63.It Fl S 64The attributes are read from stdin instead of the command line. 65.It Fl T 66The terminal name as found in the 67.Xr terminfo 5 68database; for example, 69.Dq vt100 70or 71.Dq xterm . 72If not specified, 73.Nm 74retrieves the 75.Ev TERM 76variable from the environment. 77.El 78.Pp 79.Nm 80outputs a string if the 81.Ar attribute 82is of type string or a number if it is of type integer. 83If the 84.Ar attribute 85is of type boolean, 86.Nm 87exits 0 if the terminal has the capability or 1 if it 88does not. 89Each 90.Ar attribute 91should be a string defined in either 92.Xr terminfo 5 93or 94.Xr termcap 5 . 95.Pp 96If the 97.Ar attribute 98is of type string and takes arguments (e.g., cursor movement, 99the 100.Xr terminfo 5 101.Dq cup 102sequence) the arguments are taken from the command line immediately 103following the attribute. 104.Pp 105The following special attributes are available: 106.Bl -tag -width Ar 107.It clear 108Clear the screen (the 109.Xr terminfo 5 110.Dq clear 111sequence). 112.It init 113Print the 114.Xr terminfo 5 115initialization strings for the specified terminal. 116.It longname 117Print the descriptive name of the user's terminal type. 118.It reset 119Reset the terminal (using the 120.Xr terminfo 5 121reset sequences). 122.El 123.Sh ENVIRONMENT 124.Bl -tag -width Ds 125.It Ev TERM 126Determine the terminal type. 127.El 128.Sh EXIT STATUS 129The exit value of 130.Nm 131is based on the last attribute specified. 132If the attribute is of type string or of type integer the exit 133value is as follows: 134.Pp 135.Bl -tag -offset indent -width Ds -compact 136.It 0 137The requested string was written successfully. 138.It 2 139Usage error. 140.It 3 141Unknown terminal type. 142.It 4 143Unknown attribute name. 144.It >4 145An error occurred. 146.El 147.Pp 148If the attribute is of type boolean, 149.Nm 150exits with a value of 0 if the terminal has this attribute or 1511 if it does not. 152.Sh EXAMPLES 153Clear the screen and go to line 5 column 10: 154.Pp 155.Dl $ tput clear cup 5 10 156.Pp 157Go to line 6 column 11 and delete 6 characters: 158.Pp 159.Dl $ tput cup 6 11 dch 6 160.Sh SEE ALSO 161.Xr terminfo 3 , 162.Xr terminfo 5 163.Sh STANDARDS 164The 165.Nm 166utility is compliant with the 167.St -p1003.1-2008 168specification. 169.Pp 170The flag 171.Op Fl S 172and the attribute 173.Cm longname 174are extensions to that specification. 175.Sh HISTORY 176The 177.Nm clear 178utility first appeared in 179.Bx 2 . 180The 181.Nm 182utility appeared in 183.Bx 4.4 . 184.Sh BUGS 185.Nm 186can't really distinguish between different types of attributes. 187