1*01869ca4Swiz.\" $NetBSD: tset.1,v 1.22 2017/07/03 21:34:22 wiz Exp $ 2fb937a59Sjtc.\" 3fb937a59Sjtc.\" Copyright (c) 1985, 1990, 1993 4fb937a59Sjtc.\" The Regents of the University of California. All rights reserved. 5dab5e017Scgd.\" 6dab5e017Scgd.\" Redistribution and use in source and binary forms, with or without 7dab5e017Scgd.\" modification, are permitted provided that the following conditions 8dab5e017Scgd.\" are met: 9dab5e017Scgd.\" 1. Redistributions of source code must retain the above copyright 10dab5e017Scgd.\" notice, this list of conditions and the following disclaimer. 11dab5e017Scgd.\" 2. Redistributions in binary form must reproduce the above copyright 12dab5e017Scgd.\" notice, this list of conditions and the following disclaimer in the 13dab5e017Scgd.\" documentation and/or other materials provided with the distribution. 1489aaa1bbSagc.\" 3. Neither the name of the University nor the names of its contributors 15dab5e017Scgd.\" may be used to endorse or promote products derived from this software 16dab5e017Scgd.\" without specific prior written permission. 17dab5e017Scgd.\" 18dab5e017Scgd.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19dab5e017Scgd.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20dab5e017Scgd.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21dab5e017Scgd.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22dab5e017Scgd.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23dab5e017Scgd.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24dab5e017Scgd.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25dab5e017Scgd.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26dab5e017Scgd.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27dab5e017Scgd.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28dab5e017Scgd.\" SUCH DAMAGE. 29dab5e017Scgd.\" 30fb937a59Sjtc.\" @(#)tset.1 8.1 (Berkeley) 6/9/93 31dab5e017Scgd.\" 32258cf0abSroy.Dd April 5, 2012 33dab5e017Scgd.Dt TSET 1 349e44e9b5Sgarbled.Os 35dab5e017Scgd.Sh NAME 369f84449aSmrg.Nm tset , 379f84449aSmrg.Nm reset 38dab5e017Scgd.Nd terminal initialization 39dab5e017Scgd.Sh SYNOPSIS 402aa5d6b7Slukem.Nm 4198eb8895Sroy.Op Fl IQrs 42dab5e017Scgd.Op Fl 43dab5e017Scgd.Op Fl e Ar ch 44dab5e017Scgd.Op Fl i Ar ch 45dab5e017Scgd.Op Fl k Ar ch 46dab5e017Scgd.Op Fl m Ar mapping 47dab5e017Scgd.Op Ar terminal 48d23bde9aSjoerg.Pp 49dab5e017Scgd.Nm reset 5098eb8895Sroy.Op Fl IQrs 51dab5e017Scgd.Op Fl 52dab5e017Scgd.Op Fl e Ar ch 53dab5e017Scgd.Op Fl i Ar ch 54dab5e017Scgd.Op Fl k Ar ch 55dab5e017Scgd.Op Fl m Ar mapping 56dab5e017Scgd.Op Ar terminal 57dab5e017Scgd.Sh DESCRIPTION 582aa5d6b7Slukem.Nm 59dab5e017Scgdinitializes terminals. 602aa5d6b7Slukem.Nm 61dab5e017Scgdfirst determines the type of terminal that you are using. 62dab5e017ScgdThis determination is done as follows, using the first terminal type found. 63d23bde9aSjoerg.Pp 64dab5e017Scgd.Bl -bullet -compact -offset indent 65dab5e017Scgd.It 66dab5e017ScgdThe 67dab5e017Scgd.Ar terminal 68dab5e017Scgdargument specified on the command line. 69dab5e017Scgd.It 70dab5e017ScgdThe value of the 71dab5e017Scgd.Ev TERM 72dab5e017Scgdenvironmental variable. 73dab5e017Scgd.It 74dab5e017ScgdThe terminal type associated with the standard error output device in the 75dab5e017Scgd.Pa /etc/ttys 76dab5e017Scgdfile. 77dab5e017Scgd.It 78d417f09eSlukemThe default terminal type, 79d417f09eSlukem.Dq unknown . 80dab5e017Scgd.El 81dab5e017Scgd.Pp 82dab5e017ScgdIf the terminal type was not specified on the command-line, the 83dab5e017Scgd.Fl m 84dab5e017Scgdoption mappings are then applied (see below for more information). 85dab5e017ScgdThen, if the terminal type begins with a question mark (``?''), the user is 86dab5e017Scgdprompted for confirmation of the terminal type. 87dab5e017ScgdAn empty response confirms the type, or, another type can be entered to 88dab5e017Scgdspecify a new type. 89258cf0abSroyOnce the terminal type has been determined, the terminfo entry for the terminal 90dab5e017Scgdis retrieved. 9198eb8895SroyIf no terminfo entry is found for the type, the user is prompted for another 92dab5e017Scgdterminal type. 93dab5e017Scgd.Pp 9498eb8895SroyOnce the terminfo entry is retrieved, the window size, backspace, interrupt 95dab5e017Scgdand line kill characters (among many other things) are set and the terminal 96dab5e017Scgdand tab initialization strings are sent to the standard error output. 97dab5e017ScgdFinally, if the erase, interrupt and line kill characters have changed, 98dab5e017Scgdor are not set to their default values, their values are displayed to the 99dab5e017Scgdstandard error output. 100dab5e017Scgd.Pp 101dab5e017ScgdWhen invoked as 102dab5e017Scgd.Nm reset , 1032aa5d6b7Slukem.Nm 104dab5e017Scgdsets cooked and echo modes, turns off cbreak and raw modes, turns on 105dab5e017Scgdnewline translation and resets any unset special characters to their 106dab5e017Scgddefault values before doing the terminal initialization described above. 107dab5e017ScgdThis is useful after a program dies leaving a terminal in a abnormal state. 108dab5e017ScgdNote, you may have to type 109*01869ca4Swiz.Dq Li <LF>reset<LF> 110dab5e017Scgd(the line-feed character is normally control-J) to get the terminal 111dab5e017Scgdto work, as carriage-return may no longer work in the abnormal state. 112dab5e017ScgdAlso, the terminal will often not echo the command. 113dab5e017Scgd.Pp 114dab5e017ScgdThe options are as follows: 115dab5e017Scgd.Bl -tag -width flag 116dab5e017Scgd.It Fl 117dab5e017ScgdThe terminal type is displayed to the standard output, and the terminal is 118dab5e017Scgdnot initialized in any way. 119ce746548Swiz.It Fl e 120ce746548SwizSet the erase character to 121ce746548Swiz.Ar ch . 122dab5e017Scgd.It Fl I 123dab5e017ScgdDo not send the terminal or tab initialization strings to the terminal. 124dab5e017Scgd.It Fl i 125dab5e017ScgdSet the interrupt character to 126dab5e017Scgd.Ar ch . 127dab5e017Scgd.It Fl k 128dab5e017ScgdSet the line kill character to 129dab5e017Scgd.Ar ch . 130dab5e017Scgd.It Fl m 131dab5e017ScgdSpecify a mapping from a port type to a terminal. 132dab5e017ScgdSee below for more information. 1338d582663Scgd.It Fl Q 1348d582663ScgdDon't display any values for the erase, interrupt and line kill characters. 135dab5e017Scgd.It Fl r 136dab5e017ScgdPrint the terminal type to the standard error output. 137dab5e017Scgd.It Fl s 13898eb8895SroyPrint the sequence of shell commands to initialize the environment variable 139dab5e017Scgd.Ev TERM 140dab5e017Scgdto the standard output. 1418d582663ScgdSee the section below on setting the environment for details. 142dab5e017Scgd.El 143dab5e017Scgd.Pp 144dab5e017ScgdThe arguments for the 145dab5e017Scgd.Fl e , 146dab5e017Scgd.Fl i 147dab5e017Scgdand 148dab5e017Scgd.Fl k 149dab5e017Scgdoptions may either be entered as actual characters or by using the 150dab5e017Scgd.Dq hat 151dab5e017Scgdnotation, i.e. control-h may be specified as 152dab5e017Scgd.Dq Li ^H 153dab5e017Scgdor 154dab5e017Scgd.Dq Li ^h . 155dab5e017Scgd.Sh SETTING THE ENVIRONMENT 1568d582663ScgdIt is often desirable to enter the terminal type and information about 1578d582663Scgdthe terminal's capabilities into the shell's environment. 1588d582663ScgdThis is done using the 159dab5e017Scgd.Fl s 16098eb8895Sroyoption. 1618d582663Scgd.Pp 1628d582663ScgdWhen the 1638d582663Scgd.Fl s 1648d582663Scgdoption is specified, the commands to enter the information into the 1658d582663Scgdshell's environment are written to the standard output. 166dab5e017ScgdIf the 167dab5e017Scgd.Ev SHELL 168d417f09eSlukemenvironmental variable ends in 169d417f09eSlukem.Dq csh , 170d417f09eSlukemthe commands are for the 171d417f09eSlukem.Xr csh 1 , 172dab5e017Scgdotherwise, they are for 173d417f09eSlukem.Xr sh 1 . 1748d582663ScgdNote, the 175d417f09eSlukem.Xr csh 1 176d417f09eSlukemcommands 177d417f09eSlukem.Ic set 178d417f09eSlukemand 179d417f09eSlukem.Ic unset 180d417f09eSlukemthe shell variable 1818d582663Scgd.Dq noglob , 1828d582663Scgdleaving it unset. 183dab5e017ScgdThe following line in the 184dab5e017Scgd.Pa .login 185dab5e017Scgdor 186dab5e017Scgd.Pa .profile 187dab5e017Scgdfiles will initialize the environment correctly: 188dab5e017Scgd.Bd -literal -offset indent 189dab5e017Scgdeval \`tset -s options ... \` 190dab5e017Scgd.Ed 1918d582663Scgd.Pp 1928d582663ScgdTo demonstrate a simple use of the 1938d582663Scgd.Fl S 1948d582663Scgdoption, the following lines in the 1958d582663Scgd.Pa .login 1968d582663Scgdfile have an equivalent effect: 1978d582663Scgd.Bd -literal -offset indent 1988d582663Scgdset noglob 1998d582663Scgdset term=(`tset -S options ...`) 2008d582663Scgdsetenv TERM $term[1] 2018d582663Scgdunset term 2028d582663Scgdunset noglob 2038d582663Scgd.Ed 204dab5e017Scgd.Sh TERMINAL TYPE MAPPING 205dab5e017ScgdWhen the terminal is not hardwired into the system (or the current system 206dab5e017Scgdinformation is incorrect) the terminal type derived from the 207dab5e017Scgd.Pa /etc/ttys 208dab5e017Scgdfile or the 209dab5e017Scgd.Ev TERM 210dab5e017Scgdenvironmental variable is often something generic like 211dab5e017Scgd.Dq network , 212dab5e017Scgd.Dq dialup , 213dab5e017Scgdor 214dab5e017Scgd.Dq unknown . 215dab5e017ScgdWhen 2162aa5d6b7Slukem.Nm 217dab5e017Scgdis used in a startup script 218dab5e017Scgd.Pf ( Pa .profile 219dab5e017Scgdfor 220dab5e017Scgd.Xr sh 1 221dab5e017Scgdusers or 222dab5e017Scgd.Pa .login 223dab5e017Scgdfor 224dab5e017Scgd.Xr csh 1 225dab5e017Scgdusers) it is often desirable to provide information about the type of 226dab5e017Scgdterminal used on such ports. 227dab5e017ScgdThe purpose of the 228dab5e017Scgd.Fl m 229dab5e017Scgdoption is to 230dab5e017Scgd.Dq map 231dab5e017Scgdfrom some set of conditions to a terminal type, that is, to 232dab5e017Scgdtell 2332aa5d6b7Slukem.Nm 234dab5e017Scgd``If I'm on this port at a particular speed, guess that I'm on that 235dab5e017Scgdkind of terminal''. 236dab5e017Scgd.Pp 237dab5e017ScgdThe argument to the 238dab5e017Scgd.Fl m 239dab5e017Scgdoption consists of an optional port type, an optional operator, an optional 240dab5e017Scgdbaud rate specification, an optional colon (``:'') character and a terminal 241dab5e017Scgdtype. 242dab5e017ScgdThe port type is a string (delimited by either the operator or the colon 243dab5e017Scgdcharacter). 244dab5e017ScgdThe operator may be any combination of: 245*01869ca4Swiz.Dq Li \&> , 246*01869ca4Swiz.Dq Li \&< , 247dab5e017Scgd.Dq Li \&@ , 248dab5e017Scgdand 249dab5e017Scgd.Dq Li \&! ; 250*01869ca4Swiz.Dq Li \&> 251dab5e017Scgdmeans greater than, 252*01869ca4Swiz.Dq Li \&< 253dab5e017Scgdmeans less than, 254dab5e017Scgd.Dq Li \&@ 255dab5e017Scgdmeans equal to 256dab5e017Scgdand 257dab5e017Scgd.Dq Li \&! 258dab5e017Scgdinverts the sense of the test. 259dab5e017ScgdThe baud rate is specified as a number and is compared with the speed 260dab5e017Scgdof the standard error output (which should be the control terminal). 261dab5e017ScgdThe terminal type is a string. 262dab5e017Scgd.Pp 263dab5e017ScgdIf the terminal type is not specified on the command line, the 264dab5e017Scgd.Fl m 265dab5e017Scgdmappings are applied to the terminal type. 266dab5e017ScgdIf the port type and baud rate match the mapping, the terminal type specified 267dab5e017Scgdin the mapping replaces the current type. 268dab5e017ScgdIf more than one mapping is specified, the first applicable mapping is used. 269dab5e017Scgd.Pp 2708d582663ScgdFor example, consider the following mapping: 271*01869ca4Swiz.Dq Li dialup>9600:vt100 . 272dab5e017ScgdThe port type is 273dab5e017Scgd.Dq Li dialup , 274dab5e017Scgdthe operator is 275*01869ca4Swiz.Dq Li > , 276dab5e017Scgdthe baud rate specification is 277dab5e017Scgd.Dq Li 9600 , 278dab5e017Scgdand the terminal type is 279dab5e017Scgd.Dq Li vt100 . 280dab5e017ScgdThe result of this mapping is to specify that if the terminal type is 281dab5e017Scgd.Dq Li dialup , 282dab5e017Scgdand the baud rate is greater than 9600 baud, a terminal type of 283dab5e017Scgd.Dq Li vt100 284dab5e017Scgdwill be used. 285dab5e017Scgd.Pp 286dab5e017ScgdIf no port type is specified, the terminal type will match any port type, 287dab5e017Scgdfor example, 288dab5e017Scgd.Dq Li -m dialup:vt100 -m :?xterm 289dab5e017Scgdwill cause any dialup port, regardless of baud rate, to match the terminal 290dab5e017Scgdtype 291dab5e017Scgd.Dq Li vt100 , 292dab5e017Scgdand any non-dialup port type to match the terminal type 293dab5e017Scgd.Dq Li ?xterm . 294dab5e017ScgdNote, because of the leading question mark, the user will be 295dab5e017Scgdqueried on a default port as to whether they are actually using an 296dab5e017Scgd.Ar xterm 297dab5e017Scgdterminal. 298dab5e017Scgd.Pp 299dab5e017ScgdNo whitespace characters are permitted in the 300dab5e017Scgd.Fl m 301dab5e017Scgdoption argument. 302dab5e017ScgdAlso, to avoid problems with metacharacters, it is suggested that the entire 303dab5e017Scgd.Fl m 304dab5e017Scgdoption argument be placed within single quote characters, and that 3052aa5d6b7Slukem.Xr csh 1 306dab5e017Scgdusers insert a backslash character (``\e'') before any exclamation 307dab5e017Scgdmarks (``!''). 308dab5e017Scgd.Sh ENVIRONMENT 309dab5e017ScgdThe 3102aa5d6b7Slukem.Nm 3118a49ec08Sperrycommand uses the 312dab5e017Scgd.Ev SHELL 313dab5e017Scgdand 314dab5e017Scgd.Ev TERM 315dab5e017Scgdenvironment variables. 316dab5e017Scgd.Sh FILES 31798eb8895Sroy.Bl -tag -width /usr/share/misc/terminfo -compact 318dab5e017Scgd.It Pa /etc/ttys 319dab5e017Scgdsystem port name to terminal type mapping database 32098eb8895Sroy.It Pa /usr/share/misc/terminfo 321dab5e017Scgdterminal capability database 322dab5e017Scgd.El 323dab5e017Scgd.Sh COMPATIBILITY 324dab5e017ScgdThe 325dab5e017Scgd.Fl A , 326dab5e017Scgd.Fl E , 327dab5e017Scgd.Fl h , 328dab5e017Scgd.Fl u 329dab5e017Scgdand 330dab5e017Scgd.Fl v 331dab5e017Scgdoptions have been deleted from the 3322aa5d6b7Slukem.Nm 333dab5e017Scgdutility. 33434a98169SperryNone of them were documented in 33534a98169Sperry.Bx 4.3 33634a98169Sperryand all are of limited utility at 337dab5e017Scgdbest. 338dab5e017ScgdThe 339dab5e017Scgd.Fl a , 340dab5e017Scgd.Fl d 341dab5e017Scgdand 342dab5e017Scgd.Fl p 343dab5e017Scgdoptions are similarly not documented or useful, but were retained as they 344dab5e017Scgdappear to be in widespread use. 345dab5e017ScgdIt is strongly recommended that any usage of these three options be 346dab5e017Scgdchanged to use the 347dab5e017Scgd.Fl m 348dab5e017Scgdoption instead. 349dab5e017ScgdThe 350dab5e017Scgd.Fl n 351dab5e017Scgdoption remains, but has no effect. 352dab5e017ScgdIt is still permissible to specify the 353dab5e017Scgd.Fl e , 354dab5e017Scgd.Fl i 355dab5e017Scgdand 356dab5e017Scgd.Fl k 357dab5e017Scgdoptions without arguments, although it is strongly recommended that such 358dab5e017Scgdusage be fixed to explicitly specify the character. 359dab5e017Scgd.Pp 360dab5e017ScgdExecuting 3612aa5d6b7Slukem.Nm 362dab5e017Scgdas 363dab5e017Scgd.Nm reset 364dab5e017Scgdno longer implies the 365dab5e017Scgd.Fl Q 366dab5e017Scgdoption. 367dab5e017ScgdAlso, the interaction between the 368dab5e017Scgd.Fl 369dab5e017Scgdoption and the 370dab5e017Scgd.Ar terminal 371dab5e017Scgdargument in some historic implementations of 3722aa5d6b7Slukem.Nm 373dab5e017Scgdhas been removed. 374dab5e017Scgd.Pp 37598eb8895SroyThe 37698eb8895Sroy.Fl E 37798eb8895Sroyand 37898eb8895Sroy.Fl S 37998eb8895Sroyoptions have been removed as they only make sense for termcap and 38098eb8895Sroy.Nm 38198eb8895Sroynow uses terminfo. 38298eb8895SroyAs such, the 38398eb8895Sroy.Ev TERMCAP 38498eb8895Sroyentry has been removed from 38598eb8895Sroy.Fl s . 38698eb8895Sroy.Pp 387dab5e017ScgdFinally, the 3882aa5d6b7Slukem.Nm 389dab5e017Scgdimplementation has been completely redone (as part of the addition to the 390dab5e017Scgdsystem of a 391dab5e017Scgd.St -p1003.1-88 392dab5e017Scgdcompliant terminal interface) and will no longer compile on systems with 393dab5e017Scgdolder terminal interfaces. 3946ffe8aa8Swiz.Sh SEE ALSO 3956ffe8aa8Swiz.Xr csh 1 , 3966ffe8aa8Swiz.Xr sh 1 , 3976ffe8aa8Swiz.Xr stty 1 , 3986ffe8aa8Swiz.Xr tty 4 , 3996ffe8aa8Swiz.Xr terminfo 5 , 4006ffe8aa8Swiz.Xr ttys 5 , 4016ffe8aa8Swiz.Xr environ 7 4026ffe8aa8Swiz.Sh HISTORY 4036ffe8aa8SwizThe 40442346787Sreed.Nm reset 40542346787Sreedand 40642346787Sreed.Nm tset 40742346787Sreedcommands appeared in 40842346787Sreed.Bx 1 . 409