]> git.saurik.com Git - apple/system_cmds.git/blame - getty.tproj/init.c
system_cmds-431.tar.gz
[apple/system_cmds.git] / getty.tproj / init.c
CommitLineData
1815bff5
A
1/*
2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#ifndef lint
34d340d7
A
35#if 0
36static char sccsid[] = "@(#)from: init.c 8.1 (Berkeley) 6/4/93";
37#endif
38static const char rcsid[] =
39 "$FreeBSD: src/libexec/getty/init.c,v 1.16 2005/04/06 17:42:24 stefanf Exp $";
1815bff5
A
40#endif /* not lint */
41
42/*
43 * Getty table initializations.
44 *
45 * Melbourne getty.
46 */
47#include <termios.h>
48#include "gettytab.h"
34d340d7 49#include "extern.h"
1815bff5
A
50#include "pathnames.h"
51
34d340d7
A
52static char loginmsg[] = "login: ";
53static char nullstr[] = "";
54static char loginprg[] = _PATH_LOGIN;
55static char datefmt[] = "%+";
1815bff5
A
56
57struct gettystrs gettystrs[] = {
58 { "nx" }, /* next table */
59 { "cl" }, /* screen clear characters */
60 { "im" }, /* initial message */
34d340d7
A
61 { "lm", loginmsg }, /* login message */
62 { "er", (char*)&omode.c_cc[VERASE] }, /* erase character */
63 { "kl", (char*)&omode.c_cc[VKILL] }, /* kill character */
64 { "et", (char*)&omode.c_cc[VEOF] }, /* eof chatacter (eot) */
65 { "pc", nullstr }, /* pad character */
1815bff5
A
66 { "tt" }, /* terminal type */
67 { "ev" }, /* enviroment */
34d340d7 68 { "lo", loginprg }, /* login program */
1815bff5
A
69 { "hn", hostname }, /* host name */
70 { "he" }, /* host name edit */
34d340d7
A
71 { "in", (char*)&omode.c_cc[VINTR] }, /* interrupt char */
72 { "qu", (char*)&omode.c_cc[VQUIT] }, /* quit char */
73 { "xn", (char*)&omode.c_cc[VSTART] }, /* XON (start) char */
74 { "xf", (char*)&omode.c_cc[VSTOP] }, /* XOFF (stop) char */
75 { "bk", (char*)&omode.c_cc[VEOL] }, /* brk char (alt \n) */
76 { "su", (char*)&omode.c_cc[VSUSP] }, /* suspend char */
77 { "ds", (char*)&omode.c_cc[VDSUSP] }, /* delayed suspend */
78 { "rp", (char*)&omode.c_cc[VREPRINT] },/* reprint char */
79 { "fl", (char*)&omode.c_cc[VDISCARD] },/* flush output */
80 { "we", (char*)&omode.c_cc[VWERASE] }, /* word erase */
81 { "ln", (char*)&omode.c_cc[VLNEXT] }, /* literal next */
82 { "Lo" }, /* locale for strftime() */
83 { "pp" }, /* ppp login program */
84 { "if" }, /* sysv-like 'issue' filename */
85 { "ic" }, /* modem init-chat */
86 { "ac" }, /* modem answer-chat */
87 { "al" }, /* user to auto-login */
88 { "df", datefmt}, /* format for strftime() */
1815bff5
A
89 { 0 }
90};
91
92struct gettynums gettynums[] = {
93 { "is" }, /* input speed */
94 { "os" }, /* output speed */
95 { "sp" }, /* both speeds */
96 { "nd" }, /* newline delay */
97 { "cd" }, /* carriage-return delay */
98 { "td" }, /* tab delay */
99 { "fd" }, /* form-feed delay */
100 { "bd" }, /* backspace delay */
101 { "to" }, /* timeout */
102 { "f0" }, /* output flags */
103 { "f1" }, /* input flags */
104 { "f2" }, /* user mode flags */
105 { "pf" }, /* delay before flush at 1st prompt */
106 { "c0" }, /* output c_flags */
107 { "c1" }, /* input c_flags */
108 { "c2" }, /* user mode c_flags */
109 { "i0" }, /* output i_flags */
110 { "i1" }, /* input i_flags */
111 { "i2" }, /* user mode i_flags */
112 { "l0" }, /* output l_flags */
113 { "l1" }, /* input l_flags */
114 { "l2" }, /* user mode l_flags */
115 { "o0" }, /* output o_flags */
116 { "o1" }, /* input o_flags */
117 { "o2" }, /* user mode o_flags */
34d340d7
A
118 { "de" }, /* delay before sending 1st prompt */
119 { "rt" }, /* reset timeout */
120 { "ct" }, /* chat script timeout */
121 { "dc" }, /* debug chat script value */
122 { 0 }
1815bff5 123};
34d340d7 124
1815bff5
A
125
126struct gettyflags gettyflags[] = {
127 { "ht", 0 }, /* has tabs */
128 { "nl", 1 }, /* has newline char */
129 { "ep", 0 }, /* even parity */
130 { "op", 0 }, /* odd parity */
131 { "ap", 0 }, /* any parity */
132 { "ec", 1 }, /* no echo */
133 { "co", 0 }, /* console special */
134 { "cb", 0 }, /* crt backspace */
135 { "ck", 0 }, /* crt kill */
136 { "ce", 0 }, /* crt erase */
137 { "pe", 0 }, /* printer erase */
138 { "rw", 1 }, /* don't use raw */
139 { "xc", 1 }, /* don't ^X ctl chars */
140 { "lc", 0 }, /* terminal las lower case */
141 { "uc", 0 }, /* terminal has no lower case */
142 { "ig", 0 }, /* ignore garbage */
143 { "ps", 0 }, /* do port selector speed select */
144 { "hc", 1 }, /* don't set hangup on close */
145 { "ub", 0 }, /* unbuffered output */
146 { "ab", 0 }, /* auto-baud detect with '\r' */
147 { "dx", 0 }, /* set decctlq */
148 { "np", 0 }, /* no parity at all (8bit chars) */
149 { "mb", 0 }, /* do MDMBUF flow control */
34d340d7
A
150 { "hw", 0 }, /* do CTSRTS flow control */
151 { "nc", 0 }, /* set clocal (no carrier) */
152 { "pl", 0 }, /* use PPP instead of login(1) */
1815bff5
A
153 { 0 }
154};