gettytab.5 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516
  1. .\" Copyright (c) 1983, 1991, 1993
  2. .\" The Regents of the University of California. All rights reserved.
  3. .\"
  4. .\" Redistribution and use in source and binary forms, with or without
  5. .\" modification, are permitted provided that the following conditions
  6. .\" are met:
  7. .\" 1. Redistributions of source code must retain the above copyright
  8. .\" notice, this list of conditions and the following disclaimer.
  9. .\" 2. Redistributions in binary form must reproduce the above copyright
  10. .\" notice, this list of conditions and the following disclaimer in the
  11. .\" documentation and/or other materials provided with the distribution.
  12. .\" 3. Neither the name of the University nor the names of its contributors
  13. .\" may be used to endorse or promote products derived from this software
  14. .\" without specific prior written permission.
  15. .\"
  16. .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  17. .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  18. .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  19. .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  20. .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  21. .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  22. .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  23. .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  24. .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  25. .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  26. .\" SUCH DAMAGE.
  27. .\" "
  28. .Dd September 29, 2022
  29. .Dt GETTYTAB 5
  30. .Os
  31. .Sh NAME
  32. .Nm gettytab
  33. .Nd terminal configuration data base
  34. .Sh SYNOPSIS
  35. .Nm
  36. .Sh DESCRIPTION
  37. The
  38. .Nm
  39. file
  40. is a simplified version of the
  41. .Xr termcap 5
  42. data base
  43. used to describe terminal lines.
  44. The initial terminal login process
  45. .Xr getty 8
  46. accesses the
  47. .Nm
  48. file each time it starts, allowing simpler
  49. reconfiguration of terminal characteristics.
  50. Each entry in the data base
  51. is used to describe one class of terminals.
  52. .Pp
  53. There is a default terminal class,
  54. .Va default ,
  55. that is used to set global defaults for all other classes.
  56. (That is, the
  57. .Va default
  58. entry is read, then the entry for the class required
  59. is used to override particular settings.)
  60. .Sh CAPABILITIES
  61. Refer to
  62. .Xr termcap 5
  63. for a description of the file layout.
  64. The
  65. .Va default
  66. column below lists defaults obtained if there is
  67. no entry in the table obtained, nor one in the special
  68. .Va default
  69. table.
  70. .Bl -column Name Type /usr/bin/login
  71. .It Sy "Name Type Default Description"
  72. .It "ac str unused expect-send chat script for modem answer"
  73. .It "al str unused user to auto-login instead of prompting"
  74. .It "ap bool false terminal uses any parity"
  75. .It "bk str 0377 alternate end of line character (input break)"
  76. .It "c0 num unused tty control flags to write messages"
  77. .It "c1 num unused tty control flags to read login name"
  78. .It "c2 num unused tty control flags to leave terminal as"
  79. .It "ce bool false use crt erase algorithm"
  80. .It "ck bool false use crt kill algorithm"
  81. .It "cl str" Ta Dv NULL
  82. .Ta No "screen clear sequence"
  83. .It "co bool false console - add"
  84. .Ql \en
  85. after login prompt
  86. .It "ct num 10 chat timeout for"
  87. .Va \&ac
  88. and
  89. .Va \&ic
  90. scripts
  91. .It "dc num 0 chat debug bitmask"
  92. .It "de num 0 delay secs and flush input before writing first prompt"
  93. .It "df str %+ the" Xr strftime 3 "format used for \&%d in the banner message"
  94. .It "ds str" Ta So Li ^Y
  95. .Sc Ta No "delayed suspend character"
  96. .It "dx bool false set"
  97. .Dv DECCTLQ
  98. .It "ec bool false leave echo"
  99. .Em OFF
  100. .It "ep bool false terminal uses even parity"
  101. .It "er str" Ta So Li ^?
  102. .Sc Ta No "erase character"
  103. .It "et str" Ta So Li ^D
  104. .Sc Ta No "end of text"
  105. .Pq Dv EOF
  106. character
  107. .It "ev str" Ta Dv NULL
  108. .Ta No "initial environment"
  109. .It "fl str" Ta So Li ^O
  110. .Sc Ta No "output flush character"
  111. .It "hc bool false do"
  112. .Em NOT
  113. hangup line on last close
  114. .It "he str" Ta Dv NULL
  115. .Ta No "hostname editing regular expression"
  116. .It "hn str hostname hostname"
  117. .It "ht bool false terminal has real tabs"
  118. .It "hw bool false do cts/rts hardware flow control"
  119. .It "i0 num unused tty input flags to write messages"
  120. .It "i1 num unused tty input flags to read login name"
  121. .It "i2 num unused tty input flags to leave terminal as"
  122. .It "ic str unused expect-send chat script for modem initialization"
  123. .It "if str unused display named file before prompt, like /etc/issue"
  124. .It "ig bool false ignore garbage characters in login name"
  125. .It "im str" Ta Dv NULL
  126. .Ta No "initial (banner) message"
  127. .It "iM str" Ta Dv NULL
  128. .Ta No "execute named file to generate initial (banner) message"
  129. .It "in str" Ta So Li ^C
  130. .Sc Ta No "interrupt character"
  131. .It "is num unused input speed"
  132. .It "kl str" Ta So Li ^U
  133. .Sc Ta No "kill character"
  134. .It "l0 num unused tty local flags to write messages"
  135. .It "l1 num unused tty local flags to read login name"
  136. .It "l2 num unused tty local flags to leave terminal as"
  137. .It "lm str login: login prompt"
  138. .It "ln str" Ta So Li ^V
  139. .Sc Ta No "``literal next'' character"
  140. .It "lo str" Ta Pa /usr/bin/login
  141. .Ta No "program to exec when name obtained"
  142. .It "mb bool false do flow control based on carrier"
  143. .It "nc bool false terminal does not supply carrier (set clocal)"
  144. .It "nl bool false terminal has (or might have) a newline character"
  145. .It "np bool false terminal uses no parity (i.e., 8-bit characters)"
  146. .It "nx str default next table (for auto speed selection)"
  147. .It "o0 num unused tty output flags to write messages"
  148. .It "o1 num unused tty output flags to read login name"
  149. .It "o2 num unused tty output flags to leave terminal as"
  150. .It "op bool false terminal uses odd parity"
  151. .It "os num unused output speed"
  152. .It "pc str" Ta So Li \e0
  153. .Sc Ta No "pad character"
  154. .It "pe bool false use printer (hard copy) erase algorithm"
  155. .It "pf num 0 delay"
  156. between first prompt and following flush (seconds)
  157. .It "pl bool false start PPP login program unconditionally if"
  158. .Va \&pp
  159. is specified
  160. .It "pp str unused PPP login program"
  161. .It "ps bool false line connected to a"
  162. .Tn MICOM
  163. port selector
  164. .It "qu str" Ta So Li \&^\e
  165. .Sc Ta No "quit character"
  166. .It "rp str" Ta So Li ^R
  167. .Sc Ta No "line retype character"
  168. .It "rt num unused ring timeout when using"
  169. .Va \&ac
  170. .It "rw bool false do"
  171. .Em NOT
  172. use raw for input, use cbreak
  173. .It "sp num unused line speed (input and output)"
  174. .It "su str" Ta So Li ^Z
  175. .Sc Ta No "suspend character"
  176. .It "tc str none table continuation"
  177. .It "to num 0 timeout (seconds)"
  178. .It "tt str" Ta Dv NULL
  179. .Ta No "terminal type (for environment)"
  180. .It "ub bool false do unbuffered output (of prompts etc)"
  181. .It "we str" Ta So Li ^W
  182. .Sc Ta No "word erase character"
  183. .It "xc bool false do"
  184. .Em NOT
  185. echo control chars as
  186. .Ql ^X
  187. .It "xf str" Ta So Li ^S Sc Ta Dv XOFF
  188. (stop output) character
  189. .It "xn str" Ta So Li ^Q Sc Ta Dv XON
  190. (start output) character
  191. .It "Lo str C the locale name used for \&%d in the banner message"
  192. .El
  193. .Pp
  194. The following capabilities are no longer supported by
  195. .Xr getty 8 :
  196. .Bl -column Name Type /usr/bin/login
  197. .It "bd num 0 backspace delay"
  198. .It "cb bool false use crt backspace mode"
  199. .It "cd num 0 carriage-return delay"
  200. .It "f0 num unused tty mode flags to write messages"
  201. .It "f1 num unused tty mode flags to read login name"
  202. .It "f2 num unused tty mode flags to leave terminal as"
  203. .It "fd num 0 form-feed (vertical motion) delay"
  204. .It "lc bool false terminal has lower case"
  205. .It "nd num 0 newline (line-feed) delay"
  206. .It "uc bool false terminal is known upper case only"
  207. .El
  208. .Pp
  209. If no line speed is specified, speed will not be altered
  210. from that which prevails when getty is entered.
  211. Specifying an input or output speed will override
  212. line speed for stated direction only.
  213. .Pp
  214. Terminal modes to be used for the output of the message,
  215. for input of the login name,
  216. and to leave the terminal set as upon completion,
  217. are derived from the boolean flags specified.
  218. If the derivation should prove inadequate,
  219. any (or all) of these three may be overridden
  220. with one of the
  221. .Va \&c0 ,
  222. .Va \&c1 ,
  223. .Va \&c2 ,
  224. .Va \&i0 ,
  225. .Va \&i1 ,
  226. .Va \&i2 ,
  227. .Va \&l0 ,
  228. .Va \&l1 ,
  229. .Va \&l2 ,
  230. .Va \&o0 ,
  231. .Va \&o1 ,
  232. or
  233. .Va \&o2
  234. numeric specifications, which can be used to specify
  235. (usually in octal, with a leading '0')
  236. the exact values of the flags.
  237. These flags correspond to the termios
  238. .Va c_cflag ,
  239. .Va c_iflag ,
  240. .Va c_lflag ,
  241. and
  242. .Va c_oflag
  243. fields, respectively.
  244. Each these sets must be completely specified to be effective.
  245. .Pp
  246. Should
  247. .Xr getty 8
  248. receive a null character
  249. (presumed to indicate a line break)
  250. it will restart using the table indicated by the
  251. .Va \&nx
  252. entry.
  253. If there is none, it will re-use its original table.
  254. .Pp
  255. Delays are specified in milliseconds, the nearest possible
  256. delay available in the tty driver will be used.
  257. Should greater certainty be desired, delays
  258. with values 0, 1, 2, and 3 are interpreted as
  259. choosing that particular delay algorithm from the driver.
  260. .Pp
  261. The
  262. .Va \&cl
  263. screen clear string may be preceded by a (decimal) number
  264. of milliseconds of delay required (a la termcap).
  265. This delay is simulated by repeated use of the pad character
  266. .Va \&pc .
  267. .Pp
  268. The initial message, login message, and initial file;
  269. .Va \&im ,
  270. .Va \&lm
  271. and
  272. .Va \&if
  273. may include any of the following character sequences, which expand to
  274. information about the environment in which
  275. .Xr getty 8
  276. is running.
  277. .Bl -tag -offset indent -width \&%xxxxxxxxxxxxxx
  278. .It \&%d
  279. The current date and time formatted according to the
  280. .Va \&Lo
  281. and
  282. .Va \&df
  283. strings.
  284. .It \&%h
  285. The hostname of the machine, which is normally obtained from the
  286. system using
  287. .Xr gethostname 3 ,
  288. but may also be overridden by the
  289. .Va \&hn
  290. table entry.
  291. In either case it may be edited with the
  292. .Va \&he
  293. POSIX
  294. .Dq extended
  295. regular expression, which is matched against the hostname.
  296. If there are no parenthesized subexpressions in the pattern,
  297. the entire matched string is used as the final hostname;
  298. otherwise, the first matched subexpression is used instead.
  299. If the pattern does not match, the original hostname is not modified.
  300. .It \&%t
  301. The tty name.
  302. .It "\&%m, \&%r, \&%s, \&%v"
  303. The type of machine, release of the operating system, name of the
  304. operating system, and version of the kernel, respectively, as
  305. returned by
  306. .Xr uname 3 .
  307. .It \&%%
  308. A
  309. .Dq %
  310. character.
  311. .El
  312. .Pp
  313. When getty execs the login process, given
  314. in the
  315. .Va \&lo
  316. string (usually
  317. .Dq Pa /usr/bin/login ) ,
  318. it will have set
  319. the environment to include the terminal type, as indicated
  320. by the
  321. .Va \&tt
  322. string (if it exists).
  323. The
  324. .Va \&ev
  325. string, can be used to enter additional data into
  326. the environment.
  327. It is a list of comma separated strings, each of which
  328. will presumably be of the form
  329. .Li name=value .
  330. .Pp
  331. If a non-zero timeout is specified, with
  332. .Va \&to ,
  333. then getty will exit within the indicated
  334. number of seconds, either having
  335. received a login name and passed control
  336. to
  337. .Xr login 1 ,
  338. or having received an alarm signal, and exited.
  339. This may be useful to hangup dial in lines.
  340. .Pp
  341. Output from
  342. .Xr getty 8
  343. is even parity unless
  344. .Va \&op
  345. or
  346. .Va \&np
  347. is specified.
  348. The
  349. .Va \&op
  350. string
  351. may be specified with
  352. .Va \&ap
  353. to allow any parity on input, but generate odd parity output.
  354. Note: this only applies while getty is being run,
  355. terminal driver limitations prevent a more complete
  356. implementation.
  357. The
  358. .Xr getty 8
  359. utility does not check parity of input characters in
  360. .Dv RAW
  361. mode.
  362. .Pp
  363. If a
  364. .Va \&pp
  365. string is specified and a PPP link bring-up sequence is recognized,
  366. getty will invoke the program referenced by the
  367. .Va \&pp
  368. option.
  369. This can be used to handle incoming PPP calls.
  370. If the
  371. .Va \&pl
  372. option is true as well,
  373. .Xr getty 8
  374. will skip the user name prompt and the PPP detection phase, and will
  375. invoke the program specified by
  376. .Va \&pp
  377. instantly.
  378. .Pp
  379. .Nm Getty
  380. provides some basic intelligent modem handling by providing a chat
  381. script feature available via two capabilities:
  382. .Pp
  383. .Bl -tag -offset indent -width \&xxxxxxxx -compact
  384. .It ic
  385. Chat script to initialize modem.
  386. .It ac
  387. Chat script to answer a call.
  388. .El
  389. .Pp
  390. A chat script is a set of expect/send string pairs.
  391. When a chat string starts,
  392. .Nm getty
  393. will wait for the first string, and if it finds it, will send the
  394. second, and so on.
  395. Strings specified are separated by one or more tabs or spaces.
  396. Strings may contain standard ASCII characters and special 'escapes',
  397. which consist of a backslash character followed by one or more
  398. characters which are interpreted as follows:
  399. .Pp
  400. .Bl -tag -offset indent -width \&xxxxxxxx -compact
  401. .It \ea
  402. bell character.
  403. .It \eb
  404. backspace.
  405. .It \en
  406. newline.
  407. .It \ee
  408. escape.
  409. .It \ef
  410. formfeed.
  411. .It \ep
  412. half-second pause.
  413. .It \er
  414. carriage return.
  415. .It \eS , \es
  416. space character.
  417. .It \et
  418. tab.
  419. .It \exNN
  420. hexadecimal byte value.
  421. .It \e0NNN
  422. octal byte value.
  423. .El
  424. .Pp
  425. Note that the
  426. .Ql \ep
  427. sequence is only valid for send strings and causes a half-second
  428. pause between sending the previous and next characters.
  429. Hexadecimal values are, at most, 2 hex digits long, and octal
  430. values are a maximum of 3 octal digits.
  431. .Pp
  432. The
  433. .Va \&ic
  434. chat sequence is used to initialize a modem or similar device.
  435. A typical example of an init chat script for a modem with a
  436. hayes compatible command set might look like this:
  437. .Pp
  438. .Dl :ic="" ATE0Q0V1\er OK\er ATS0=0\er OK\er:
  439. .Pp
  440. This script waits for nothing (which always succeeds), sends
  441. a sequence to ensure that the modem is in the correct mode
  442. (suppress command echo, send responses in verbose mode),
  443. and then disables auto-answer.
  444. It waits for an "OK" response before it terminates.
  445. The init sequence is used to check modem responses to ensure that
  446. the modem is functioning correctly.
  447. If the init script fails to complete,
  448. .Nm getty
  449. considers this to be fatal, and results in an error logged via
  450. .Xr syslogd 8 ,
  451. and exiting.
  452. .Pp
  453. Similarly, an answer chat script is used to manually answer the
  454. phone in response to (usually) a "RING".
  455. When run with an answer script,
  456. .Nm getty
  457. opens the port in non-blocking mode, clears any extraneous input
  458. and waits for data on the port.
  459. As soon as any data is available, the answer chat script is
  460. started and scanned for a string, and responds according to
  461. the answer chat script.
  462. With a hayes compatible modem, this would normally look something
  463. like:
  464. .Pp
  465. .Dl :ac=RING\er ATA\er CONNECT:
  466. .Pp
  467. This causes the modem to answer the call via the "ATA" command,
  468. then scans input for a "CONNECT" string.
  469. If this is received before a
  470. .Va \&ct
  471. timeout, then a normal login sequence commences.
  472. .Pp
  473. The
  474. .Va \&ct
  475. capability specifies a timeout for all send and expect strings.
  476. This timeout is set individually for each expect wait and send
  477. string and must be at least as long as the time it takes for
  478. a connection to be established between a remote and local
  479. modem (usually around 10 seconds).
  480. .Pp
  481. In most situations, you will want to flush any additional
  482. input after the connection has been detected, and the
  483. .Va \&de
  484. capability may be used to do that, as well as delay for a
  485. short time after the connection has been established during
  486. which all of the connection data has been sent by the modem.
  487. .Sh SEE ALSO
  488. .Xr login 1 ,
  489. .Xr gethostname 3 ,
  490. .Xr uname 3 ,
  491. .Xr termcap 5 ,
  492. .Xr getty 8
  493. .Sh HISTORY
  494. The
  495. .Nm
  496. file format appeared in
  497. .Bx 4.2 .
  498. .Sh BUGS
  499. The special characters (erase, kill, etc.) are reset to system defaults
  500. by
  501. .Xr login 1 .
  502. In
  503. .Em all
  504. cases, '#' or '^H' typed in a login name will be treated as
  505. an erase character, and '@' will be treated as a kill character.
  506. .Pp
  507. The delay stuff is a real crock.
  508. Apart form its general lack of flexibility, some
  509. of the delay algorithms are not implemented.
  510. The terminal driver should support sane delay settings.
  511. .Pp
  512. The
  513. .Xr termcap 5
  514. format is horrid, something more rational should
  515. have been chosen.