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