⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tset.1

📁 早期freebsd实现
💻 1
字号:
.\" Copyright (c) 1985, 1990, 1993.\"	The Regents of the University of California.  All rights reserved..\".\" Redistribution and use in source and binary forms, with or without.\" modification, are permitted provided that the following conditions.\" are met:.\" 1. Redistributions of source code must retain the above copyright.\"    notice, this list of conditions and the following disclaimer..\" 2. Redistributions in binary form must reproduce the above copyright.\"    notice, this list of conditions and the following disclaimer in the.\"    documentation and/or other materials provided with the distribution..\" 3. All advertising materials mentioning features or use of this software.\"    must display the following acknowledgement:.\"	This product includes software developed by the University of.\"	California, Berkeley and its contributors..\" 4. Neither the name of the University nor the names of its contributors.\"    may be used to endorse or promote products derived from this software.\"    without specific prior written permission..\".\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION).\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF.\" SUCH DAMAGE..\".\"	@(#)tset.1	8.1 (Berkeley) 6/9/93.\".Dd June 9, 1993.Dt TSET 1.Os BSD 4.Sh NAME.Nm tset.Nd terminal initialization.Sh SYNOPSIS.Nm tset.Op Fl IQrSs.Op Fl.Op Fl e Ar ch.Op Fl i Ar ch.Op Fl k Ar ch.Op Fl m Ar mapping.Op Ar terminal.br.Nm reset.Op Fl IQrSs.Op Fl.Op Fl e Ar ch.Op Fl i Ar ch.Op Fl k Ar ch.Op Fl m Ar mapping.Op Ar terminal.Sh DESCRIPTION.Nm Tsetinitializes terminals..Nm Tsetfirst determines the type of terminal that you are using.This determination is done as follows, using the first terminal type found..sp.Bl -bullet -compact -offset indent.ItThe.Ar terminalargument specified on the command line..ItThe value of the.Ev TERMenvironmental variable..ItThe terminal type associated with the standard error output device in the.Pa /etc/ttysfile..ItThe default terminal type, ``unknown''..El.PpIf the terminal type was not specified on the command-line, the.Fl moption mappings are then applied (see below for more information).Then, if the terminal type begins with a question mark (``?''), the user isprompted for confirmation of the terminal type.An empty response confirms the type, or, another type can be entered tospecify a new type.Once the terminal type has been determined, the termcap entry for the terminalis retrieved.If no termcap entry is found for the type, the user is prompted for anotherterminal type..PpOnce the termcap entry is retrieved, the window size, backspace, interruptand line kill characters (among many other things) are set and the terminaland tab initialization strings are sent to the standard error output.Finally, if the erase, interrupt and line kill characters have changed,or are not set to their default values, their values are displayed to thestandard error output..PpWhen invoked as.Nm reset ,.Nm tsetsets cooked and echo modes, turns off cbreak and raw modes, turns onnewline translation and resets any unset special characters to theirdefault values before doing the terminal initialization described above.This is useful after a program dies leaving a terminal in a abnormal state.Note, you may have to type.Dq Li <LF>reset<LF>(the line-feed character is normally control-J) to get the terminalto work, as carriage-return may no longer work in the abnormal state.Also, the terminal will often not echo the command..PpThe options are as follows:.Bl -tag -width flag.It FlThe terminal type is displayed to the standard output, and the terminal isnot initialized in any way..It Fl eSet the erase character to.Ar ch ..It Fl IDo not send the terminal or tab initialization strings to the terminal..It Fl iSet the interrupt character to.Ar ch ..It Fl kSet the line kill character to.Ar ch ..It Fl mSpecify a mapping from a port type to a terminal.See below for more information..It Fl QDon't display any values for the erase, interrupt and line kill characters..It Fl rPrint the terminal type to the standard error output..It Fl SPrint the terminal type and the termcap entry to the standard output.See the section below on setting the environment for details..It Fl sPrint the sequence of shell commands to initialize the environment variables.Ev TERMand.Ev TERMCAPto the standard output.See the section below on setting the environment for details..El.PpThe arguments for the.Fl e ,.Fl iand.Fl koptions may either be entered as actual characters or by using the.Dq hatnotation, i.e. control-h may be specified as.Dq Li ^Hor.Dq Li ^h ..Sh SETTING THE ENVIRONMENTIt is often desirable to enter the terminal type and information aboutthe terminal's capabilities into the shell's environment.This is done using the.Fl Sand.Fl soptions..PpWhen the.Fl Soption is specified, the terminal type and the termcap entry are writtento the standard output, separated by a space and without a terminatingnewline.This can be assigned to an array by.Nm cshand.Nm kshusers and then used like any other shell array..PpWhen the.Fl soption is specified, the commands to enter the information into theshell's environment are written to the standard output.If the.Ev SHELLenvironmental variable ends in ``csh'', the commands are for the.Nm csh ,otherwise, they are for.Xr sh .Note, the.Nm cshcommands set and unset the shell variable.Dq noglob ,leaving it unset.The following line in the.Pa .loginor.Pa .profilefiles will initialize the environment correctly:.Bd -literal -offset indenteval \`tset -s options ... \`.Ed.PpTo demonstrate a simple use of the.Fl Soption, the following lines in the.Pa .loginfile have an equivalent effect:.Bd -literal -offset indentset noglobset term=(`tset -S options ...`)setenv TERM $term[1]setenv TERMCAP "$term[2]"unset termunset noglob.Ed.Sh TERMINAL TYPE MAPPINGWhen the terminal is not hardwired into the system (or the current systeminformation is incorrect) the terminal type derived from the.Pa /etc/ttysfile or the.Ev TERMenvironmental variable is often something generic like.Dq network ,.Dq dialup ,or.Dq unknown .When.Nm tsetis used in a startup script.Pf ( Pa .profilefor.Xr sh 1users or.Pa .loginfor.Xr csh 1users) it is often desirable to provide information about the type ofterminal used on such ports.The purpose of the.Fl moption is to.Dq mapfrom some set of conditions to a terminal type, that is, totell.Nm tset``If I'm on this port at a particular speed, guess that I'm on thatkind of terminal''..PpThe argument to the.Fl moption consists of an optional port type, an optional operator, an optionalbaud rate specification, an optional colon (``:'') character and a terminaltype.The port type is a string (delimited by either the operator or the coloncharacter).The operator may be any combination of:.Dq Li \&> ,.Dq Li \&< ,.Dq Li \&@ ,and.Dq Li \&! ;.Dq Li \&>means greater than,.Dq Li \&<means less than,.Dq Li \&@means equal toand.Dq Li \&!inverts the sense of the test.The baud rate is specified as a number and is compared with the speedof the standard error output (which should be the control terminal).The terminal type is a string..PpIf the terminal type is not specified on the command line, the.Fl mmappings are applied to the terminal type.If the port type and baud rate match the mapping, the terminal type specifiedin the mapping replaces the current type.If more than one mapping is specified, the first applicable mapping is used..PpFor example, consider the following mapping:.Dq Li dialup>9600:vt100 .The port type is.Dq Li dialup ,the operator is.Dq Li > ,the baud rate specification is.Dq Li 9600 ,and the terminal type is.Dq Li vt100 .The result of this mapping is to specify that if the terminal type is.Dq Li dialup ,and the baud rate is greater than 9600 baud, a terminal type of.Dq Li vt100will be used..PpIf no port type is specified, the terminal type will match any port type,for example,.Dq Li -m dialup:vt100 -m :?xtermwill cause any dialup port, regardless of baud rate, to match the terminaltype.Dq Li vt100 ,and any non-dialup port type to match the terminal type.Dq Li ?xterm .Note, because of the leading question mark, the user will bequeried on a default port as to whether they are actually using an.Ar xtermterminal..PpNo whitespace characters are permitted in the.Fl moption argument.Also, to avoid problems with metacharacters, it is suggested that the entire.Fl moption argument be placed within single quote characters, and that.Nm cshusers insert a backslash character (``\e'') before any exclamationmarks (``!'')..Sh ENVIRONMENTThe.Nm tsetcommand utilizes the.Ev SHELLand.Ev TERMenvironment variables..Sh FILES.Bl -tag -width /usr/share/misc/termcap -compact.It Pa /etc/ttyssystem port name to terminal type mapping database.It Pa /usr/share/misc/termcapterminal capability database.El.Sh SEE ALSO.Xr csh 1 ,.Xr sh 1 ,.Xr stty 1 ,.Xr tty 4 ,.Xr termcap 5 ,.Xr ttys 5 ,.Xr environ 7.Sh HISTORYThe.Nm tsetcommand appeared in.Bx 3.0 ..Sh COMPATIBILITYThe.Fl A ,.Fl E ,.Fl h ,.Fl uand.Fl voptions have been deleted from the.Nm tsetutility.None of them were documented in 4.3BSD and all are of limited utility atbest.The.Fl a ,.Fl dand.Fl poptions are similarly not documented or useful, but were retained as theyappear to be in widespread use.It is strongly recommended that any usage of these three options bechanged to use the.Fl moption instead.The.Fl noption remains, but has no effect.It is still permissible to specify the.Fl e ,.Fl iand.Fl koptions without arguments, although it is strongly recommended that suchusage be fixed to explicitly specify the character..PpExecuting.Nm tsetas.Nm resetno longer implies the.Fl Qoption.Also, the interaction between the.Floption and the.Ar terminalargument in some historic implementations of.Nm tsethas been removed..PpFinally, the.Nm tsetimplementation has been completely redone (as part of the addition to thesystem of a.St -p1003.1-88compliant terminal interface) and will no longer compile on systems witholder terminal interfaces.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -