logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

tset.1 (10561B)


  1. .\" $NetBSD: tset.1,v 1.22 2017/07/03 21:34:22 wiz Exp $
  2. .\"
  3. .\" Copyright (c) 1985, 1990, 1993
  4. .\" The Regents of the University of California. All rights reserved.
  5. .\"
  6. .\" Redistribution and use in source and binary forms, with or without
  7. .\" modification, are permitted provided that the following conditions
  8. .\" are met:
  9. .\" 1. Redistributions of source code must retain the above copyright
  10. .\" notice, this list of conditions and the following disclaimer.
  11. .\" 2. Redistributions in binary form must reproduce the above copyright
  12. .\" notice, this list of conditions and the following disclaimer in the
  13. .\" documentation and/or other materials provided with the distribution.
  14. .\" 3. Neither the name of the University nor the names of its contributors
  15. .\" may be used to endorse or promote products derived from this software
  16. .\" without specific prior written permission.
  17. .\"
  18. .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  19. .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  20. .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  21. .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  22. .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  23. .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  24. .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  25. .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  26. .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  27. .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  28. .\" SUCH DAMAGE.
  29. .\"
  30. .\" @(#)tset.1 8.1 (Berkeley) 6/9/93
  31. .\"
  32. .Dd April 5, 2012
  33. .Dt TSET 1
  34. .Os
  35. .Sh NAME
  36. .Nm tset ,
  37. .Nm reset
  38. .Nd terminal initialization
  39. .Sh SYNOPSIS
  40. .Nm
  41. .Op Fl IQrs
  42. .Op Fl
  43. .Op Fl e Ar ch
  44. .Op Fl i Ar ch
  45. .Op Fl k Ar ch
  46. .Op Fl m Ar mapping
  47. .Op Ar terminal
  48. .Pp
  49. .Nm reset
  50. .Op Fl IQrs
  51. .Op Fl
  52. .Op Fl e Ar ch
  53. .Op Fl i Ar ch
  54. .Op Fl k Ar ch
  55. .Op Fl m Ar mapping
  56. .Op Ar terminal
  57. .Sh DESCRIPTION
  58. .Nm
  59. initializes terminals.
  60. .Nm
  61. first determines the type of terminal that you are using.
  62. This determination is done as follows, using the first terminal type found.
  63. .Pp
  64. .Bl -bullet -compact -offset indent
  65. .It
  66. The
  67. .Ar terminal
  68. argument specified on the command line.
  69. .It
  70. The value of the
  71. .Ev TERM
  72. environmental variable.
  73. .It
  74. The terminal type associated with the standard error output device in the
  75. .Pa /etc/ttys
  76. file.
  77. .It
  78. The default terminal type,
  79. .Dq unknown .
  80. .El
  81. .Pp
  82. If the terminal type was not specified on the command-line, the
  83. .Fl m
  84. option mappings are then applied (see below for more information).
  85. Then, if the terminal type begins with a question mark (``?''), the user is
  86. prompted for confirmation of the terminal type.
  87. An empty response confirms the type, or, another type can be entered to
  88. specify a new type.
  89. Once the terminal type has been determined, the terminfo entry for the terminal
  90. is retrieved.
  91. If no terminfo entry is found for the type, the user is prompted for another
  92. terminal type.
  93. .Pp
  94. Once the terminfo entry is retrieved, the window size, backspace, interrupt
  95. and line kill characters (among many other things) are set and the terminal
  96. and tab initialization strings are sent to the standard error output.
  97. Finally, if the erase, interrupt and line kill characters have changed,
  98. or are not set to their default values, their values are displayed to the
  99. standard error output.
  100. .Pp
  101. When invoked as
  102. .Nm reset ,
  103. .Nm
  104. sets cooked and echo modes, turns off cbreak and raw modes, turns on
  105. newline translation and resets any unset special characters to their
  106. default values before doing the terminal initialization described above.
  107. This is useful after a program dies leaving a terminal in a abnormal state.
  108. Note, you may have to type
  109. .Dq Li <LF>reset<LF>
  110. (the line-feed character is normally control-J) to get the terminal
  111. to work, as carriage-return may no longer work in the abnormal state.
  112. Also, the terminal will often not echo the command.
  113. .Pp
  114. The options are as follows:
  115. .Bl -tag -width flag
  116. .It Fl
  117. The terminal type is displayed to the standard output, and the terminal is
  118. not initialized in any way.
  119. .It Fl e
  120. Set the erase character to
  121. .Ar ch .
  122. .It Fl I
  123. Do not send the terminal or tab initialization strings to the terminal.
  124. .It Fl i
  125. Set the interrupt character to
  126. .Ar ch .
  127. .It Fl k
  128. Set the line kill character to
  129. .Ar ch .
  130. .It Fl m
  131. Specify a mapping from a port type to a terminal.
  132. See below for more information.
  133. .It Fl Q
  134. Don't display any values for the erase, interrupt and line kill characters.
  135. .It Fl r
  136. Print the terminal type to the standard error output.
  137. .It Fl s
  138. Print the sequence of shell commands to initialize the environment variable
  139. .Ev TERM
  140. to the standard output.
  141. See the section below on setting the environment for details.
  142. .El
  143. .Pp
  144. The arguments for the
  145. .Fl e ,
  146. .Fl i
  147. and
  148. .Fl k
  149. options may either be entered as actual characters or by using the
  150. .Dq hat
  151. notation, i.e. control-h may be specified as
  152. .Dq Li ^H
  153. or
  154. .Dq Li ^h .
  155. .Sh SETTING THE ENVIRONMENT
  156. It is often desirable to enter the terminal type and information about
  157. the terminal's capabilities into the shell's environment.
  158. This is done using the
  159. .Fl s
  160. option.
  161. .Pp
  162. When the
  163. .Fl s
  164. option is specified, the commands to enter the information into the
  165. shell's environment are written to the standard output.
  166. If the
  167. .Ev SHELL
  168. environmental variable ends in
  169. .Dq csh ,
  170. the commands are for the
  171. .Xr csh 1 ,
  172. otherwise, they are for
  173. .Xr sh 1 .
  174. Note, the
  175. .Xr csh 1
  176. commands
  177. .Ic set
  178. and
  179. .Ic unset
  180. the shell variable
  181. .Dq noglob ,
  182. leaving it unset.
  183. The following line in the
  184. .Pa .login
  185. or
  186. .Pa .profile
  187. files will initialize the environment correctly:
  188. .Bd -literal -offset indent
  189. eval \`tset -s options ... \`
  190. .Ed
  191. .Pp
  192. To demonstrate a simple use of the
  193. .Fl S
  194. option, the following lines in the
  195. .Pa .login
  196. file have an equivalent effect:
  197. .Bd -literal -offset indent
  198. set noglob
  199. set term=(`tset -S options ...`)
  200. setenv TERM $term[1]
  201. unset term
  202. unset noglob
  203. .Ed
  204. .Sh TERMINAL TYPE MAPPING
  205. When the terminal is not hardwired into the system (or the current system
  206. information is incorrect) the terminal type derived from the
  207. .Pa /etc/ttys
  208. file or the
  209. .Ev TERM
  210. environmental variable is often something generic like
  211. .Dq network ,
  212. .Dq dialup ,
  213. or
  214. .Dq unknown .
  215. When
  216. .Nm
  217. is used in a startup script
  218. .Pf ( Pa .profile
  219. for
  220. .Xr sh 1
  221. users or
  222. .Pa .login
  223. for
  224. .Xr csh 1
  225. users) it is often desirable to provide information about the type of
  226. terminal used on such ports.
  227. The purpose of the
  228. .Fl m
  229. option is to
  230. .Dq map
  231. from some set of conditions to a terminal type, that is, to
  232. tell
  233. .Nm
  234. ``If I'm on this port at a particular speed, guess that I'm on that
  235. kind of terminal''.
  236. .Pp
  237. The argument to the
  238. .Fl m
  239. option consists of an optional port type, an optional operator, an optional
  240. baud rate specification, an optional colon (``:'') character and a terminal
  241. type.
  242. The port type is a string (delimited by either the operator or the colon
  243. character).
  244. The operator may be any combination of:
  245. .Dq Li \&> ,
  246. .Dq Li \&< ,
  247. .Dq Li \&@ ,
  248. and
  249. .Dq Li \&! ;
  250. .Dq Li \&>
  251. means greater than,
  252. .Dq Li \&<
  253. means less than,
  254. .Dq Li \&@
  255. means equal to
  256. and
  257. .Dq Li \&!
  258. inverts the sense of the test.
  259. The baud rate is specified as a number and is compared with the speed
  260. of the standard error output (which should be the control terminal).
  261. The terminal type is a string.
  262. .Pp
  263. If the terminal type is not specified on the command line, the
  264. .Fl m
  265. mappings are applied to the terminal type.
  266. If the port type and baud rate match the mapping, the terminal type specified
  267. in the mapping replaces the current type.
  268. If more than one mapping is specified, the first applicable mapping is used.
  269. .Pp
  270. For example, consider the following mapping:
  271. .Dq Li dialup>9600:vt100 .
  272. The port type is
  273. .Dq Li dialup ,
  274. the operator is
  275. .Dq Li > ,
  276. the baud rate specification is
  277. .Dq Li 9600 ,
  278. and the terminal type is
  279. .Dq Li vt100 .
  280. The result of this mapping is to specify that if the terminal type is
  281. .Dq Li dialup ,
  282. and the baud rate is greater than 9600 baud, a terminal type of
  283. .Dq Li vt100
  284. will be used.
  285. .Pp
  286. If no port type is specified, the terminal type will match any port type,
  287. for example,
  288. .Dq Li -m dialup:vt100 -m :?xterm
  289. will cause any dialup port, regardless of baud rate, to match the terminal
  290. type
  291. .Dq Li vt100 ,
  292. and any non-dialup port type to match the terminal type
  293. .Dq Li ?xterm .
  294. Note, because of the leading question mark, the user will be
  295. queried on a default port as to whether they are actually using an
  296. .Ar xterm
  297. terminal.
  298. .Pp
  299. No whitespace characters are permitted in the
  300. .Fl m
  301. option argument.
  302. Also, to avoid problems with metacharacters, it is suggested that the entire
  303. .Fl m
  304. option argument be placed within single quote characters, and that
  305. .Xr csh 1
  306. users insert a backslash character (``\e'') before any exclamation
  307. marks (``!'').
  308. .Sh ENVIRONMENT
  309. The
  310. .Nm
  311. command uses the
  312. .Ev SHELL
  313. and
  314. .Ev TERM
  315. environment variables.
  316. .Sh FILES
  317. .Bl -tag -width /usr/share/misc/terminfo -compact
  318. .It Pa /etc/ttys
  319. system port name to terminal type mapping database
  320. .It Pa /usr/share/misc/terminfo
  321. terminal capability database
  322. .El
  323. .Sh COMPATIBILITY
  324. The
  325. .Fl A ,
  326. .Fl E ,
  327. .Fl h ,
  328. .Fl u
  329. and
  330. .Fl v
  331. options have been deleted from the
  332. .Nm
  333. utility.
  334. None of them were documented in
  335. .Bx 4.3
  336. and all are of limited utility at
  337. best.
  338. The
  339. .Fl a ,
  340. .Fl d
  341. and
  342. .Fl p
  343. options are similarly not documented or useful, but were retained as they
  344. appear to be in widespread use.
  345. It is strongly recommended that any usage of these three options be
  346. changed to use the
  347. .Fl m
  348. option instead.
  349. The
  350. .Fl n
  351. option remains, but has no effect.
  352. It is still permissible to specify the
  353. .Fl e ,
  354. .Fl i
  355. and
  356. .Fl k
  357. options without arguments, although it is strongly recommended that such
  358. usage be fixed to explicitly specify the character.
  359. .Pp
  360. Executing
  361. .Nm
  362. as
  363. .Nm reset
  364. no longer implies the
  365. .Fl Q
  366. option.
  367. Also, the interaction between the
  368. .Fl
  369. option and the
  370. .Ar terminal
  371. argument in some historic implementations of
  372. .Nm
  373. has been removed.
  374. .Pp
  375. The
  376. .Fl E
  377. and
  378. .Fl S
  379. options have been removed as they only make sense for termcap and
  380. .Nm
  381. now uses terminfo.
  382. As such, the
  383. .Ev TERMCAP
  384. entry has been removed from
  385. .Fl s .
  386. .Pp
  387. Finally, the
  388. .Nm
  389. implementation has been completely redone (as part of the addition to the
  390. system of a
  391. .St -p1003.1-88
  392. compliant terminal interface) and will no longer compile on systems with
  393. older terminal interfaces.
  394. .Sh SEE ALSO
  395. .Xr csh 1 ,
  396. .Xr sh 1 ,
  397. .Xr stty 1 ,
  398. .Xr tty 4 ,
  399. .Xr terminfo 5 ,
  400. .Xr ttys 5 ,
  401. .Xr environ 7
  402. .Sh HISTORY
  403. The
  404. .Nm reset
  405. and
  406. .Nm tset
  407. commands appeared in
  408. .Bx 1 .