]> git.saurik.com Git - apple/system_cmds.git/blob - getty.tproj/init.c
system_cmds-735.20.1.tar.gz
[apple/system_cmds.git] / getty.tproj / init.c
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 #include <sys/cdefs.h>
35
36 #ifndef lint
37 #if 0
38 static char sccsid[] = "@(#)from: init.c 8.1 (Berkeley) 6/4/93";
39 #endif
40 __unused static const char rcsid[] =
41 "$FreeBSD: src/libexec/getty/init.c,v 1.16 2005/04/06 17:42:24 stefanf Exp $";
42 #endif /* not lint */
43
44 /*
45 * Getty table initializations.
46 *
47 * Melbourne getty.
48 */
49 #include <termios.h>
50 #include "gettytab.h"
51 #include "extern.h"
52 #include "pathnames.h"
53
54 static char loginmsg[] = "login: ";
55 static char nullstr[] = "";
56 static char loginprg[] = _PATH_LOGIN;
57 static char datefmt[] = "%+";
58
59 struct gettystrs gettystrs[] = {
60 { "nx" }, /* next table */
61 { "cl" }, /* screen clear characters */
62 { "im" }, /* initial message */
63 { "lm", loginmsg }, /* login message */
64 { "er", (char*)&omode.c_cc[VERASE] }, /* erase character */
65 { "kl", (char*)&omode.c_cc[VKILL] }, /* kill character */
66 { "et", (char*)&omode.c_cc[VEOF] }, /* eof chatacter (eot) */
67 { "pc", nullstr }, /* pad character */
68 { "tt" }, /* terminal type */
69 { "ev" }, /* enviroment */
70 { "lo", loginprg }, /* login program */
71 { "hn", hostname }, /* host name */
72 { "he" }, /* host name edit */
73 { "in", (char*)&omode.c_cc[VINTR] }, /* interrupt char */
74 { "qu", (char*)&omode.c_cc[VQUIT] }, /* quit char */
75 { "xn", (char*)&omode.c_cc[VSTART] }, /* XON (start) char */
76 { "xf", (char*)&omode.c_cc[VSTOP] }, /* XOFF (stop) char */
77 { "bk", (char*)&omode.c_cc[VEOL] }, /* brk char (alt \n) */
78 { "su", (char*)&omode.c_cc[VSUSP] }, /* suspend char */
79 { "ds", (char*)&omode.c_cc[VDSUSP] }, /* delayed suspend */
80 { "rp", (char*)&omode.c_cc[VREPRINT] },/* reprint char */
81 { "fl", (char*)&omode.c_cc[VDISCARD] },/* flush output */
82 { "we", (char*)&omode.c_cc[VWERASE] }, /* word erase */
83 { "ln", (char*)&omode.c_cc[VLNEXT] }, /* literal next */
84 { "Lo" }, /* locale for strftime() */
85 { "pp" }, /* ppp login program */
86 { "if" }, /* sysv-like 'issue' filename */
87 { "ic" }, /* modem init-chat */
88 { "ac" }, /* modem answer-chat */
89 { "al" }, /* user to auto-login */
90 { "df", datefmt}, /* format for strftime() */
91 { 0 }
92 };
93
94 struct gettynums gettynums[] = {
95 { "is" }, /* input speed */
96 { "os" }, /* output speed */
97 { "sp" }, /* both speeds */
98 { "nd" }, /* newline delay */
99 { "cd" }, /* carriage-return delay */
100 { "td" }, /* tab delay */
101 { "fd" }, /* form-feed delay */
102 { "bd" }, /* backspace delay */
103 { "to" }, /* timeout */
104 { "f0" }, /* output flags */
105 { "f1" }, /* input flags */
106 { "f2" }, /* user mode flags */
107 { "pf" }, /* delay before flush at 1st prompt */
108 { "c0" }, /* output c_flags */
109 { "c1" }, /* input c_flags */
110 { "c2" }, /* user mode c_flags */
111 { "i0" }, /* output i_flags */
112 { "i1" }, /* input i_flags */
113 { "i2" }, /* user mode i_flags */
114 { "l0" }, /* output l_flags */
115 { "l1" }, /* input l_flags */
116 { "l2" }, /* user mode l_flags */
117 { "o0" }, /* output o_flags */
118 { "o1" }, /* input o_flags */
119 { "o2" }, /* user mode o_flags */
120 { "de" }, /* delay before sending 1st prompt */
121 { "rt" }, /* reset timeout */
122 { "ct" }, /* chat script timeout */
123 { "dc" }, /* debug chat script value */
124 { 0 }
125 };
126
127
128 struct gettyflags gettyflags[] = {
129 { "ht", 0 }, /* has tabs */
130 { "nl", 1 }, /* has newline char */
131 { "ep", 0 }, /* even parity */
132 { "op", 0 }, /* odd parity */
133 { "ap", 0 }, /* any parity */
134 { "ec", 1 }, /* no echo */
135 { "co", 0 }, /* console special */
136 { "cb", 0 }, /* crt backspace */
137 { "ck", 0 }, /* crt kill */
138 { "ce", 0 }, /* crt erase */
139 { "pe", 0 }, /* printer erase */
140 { "rw", 1 }, /* don't use raw */
141 { "xc", 1 }, /* don't ^X ctl chars */
142 { "lc", 0 }, /* terminal las lower case */
143 { "uc", 0 }, /* terminal has no lower case */
144 { "ig", 0 }, /* ignore garbage */
145 { "ps", 0 }, /* do port selector speed select */
146 { "hc", 1 }, /* don't set hangup on close */
147 { "ub", 0 }, /* unbuffered output */
148 { "ab", 0 }, /* auto-baud detect with '\r' */
149 { "dx", 0 }, /* set decctlq */
150 { "np", 0 }, /* no parity at all (8bit chars) */
151 { "mb", 0 }, /* do MDMBUF flow control */
152 { "hw", 0 }, /* do CTSRTS flow control */
153 { "nc", 0 }, /* set clocal (no carrier) */
154 { "pl", 0 }, /* use PPP instead of login(1) */
155 { 0 }
156 };