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