init.c revision 50476
1262261Sdim/*
2262261Sdim * Copyright (c) 1983, 1993
3262261Sdim *	The Regents of the University of California.  All rights reserved.
4262261Sdim *
5262261Sdim * Redistribution and use in source and binary forms, with or without
6262261Sdim * modification, are permitted provided that the following conditions
7262261Sdim * are met:
8262261Sdim * 1. Redistributions of source code must retain the above copyright
9262261Sdim *    notice, this list of conditions and the following disclaimer.
10262261Sdim * 2. Redistributions in binary form must reproduce the above copyright
11262261Sdim *    notice, this list of conditions and the following disclaimer in the
12262261Sdim *    documentation and/or other materials provided with the distribution.
13262261Sdim * 3. All advertising materials mentioning features or use of this software
14262261Sdim *    must display the following acknowledgement:
15262261Sdim *	This product includes software developed by the University of
16262261Sdim *	California, Berkeley and its contributors.
17262261Sdim * 4. Neither the name of the University nor the names of its contributors
18262261Sdim *    may be used to endorse or promote products derived from this software
19262261Sdim *    without specific prior written permission.
20262261Sdim *
21262261Sdim * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22262261Sdim * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23262261Sdim * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24262261Sdim * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25262261Sdim * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26262261Sdim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27262261Sdim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28262261Sdim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29262261Sdim * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30262261Sdim * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31262261Sdim * SUCH DAMAGE.
32262261Sdim */
33262261Sdim
34262261Sdim#ifndef lint
35262261Sdim#if 0
36262261Sdimstatic char sccsid[] = "@(#)from: init.c	8.1 (Berkeley) 6/4/93";
37262261Sdim#endif
38262261Sdimstatic const char rcsid[] =
39262261Sdim  "$FreeBSD: head/libexec/getty/init.c 50476 1999-08-28 00:22:10Z peter $";
40262261Sdim#endif /* not lint */
41262261Sdim
42262261Sdim/*
43262261Sdim * Getty table initializations.
44262261Sdim *
45262261Sdim * Melbourne getty.
46262261Sdim */
47262261Sdim#include <termios.h>
48262261Sdim#include "extern.h"
49262261Sdim#include "gettytab.h"
50262261Sdim#include "pathnames.h"
51262261Sdim
52262261Sdimstatic char loginmsg[] = "login: ";
53262261Sdimstatic char nullstr[] = "";
54262261Sdimstatic char loginprg[] = _PATH_LOGIN;
55262261Sdim
56262261Sdimstruct	gettystrs gettystrs[] = {
57262261Sdim	{ "nx" },			/* next table */
58262261Sdim	{ "cl" },			/* screen clear characters */
59262261Sdim	{ "im" },			/* initial message */
60262261Sdim	{ "lm", loginmsg },		/* login message */
61262261Sdim	{ "er", &tmode.c_cc[VERASE] },	/* erase character */
62262261Sdim	{ "kl", &tmode.c_cc[VKILL] },	/* kill character */
63262261Sdim	{ "et", &tmode.c_cc[VEOF] },	/* eof chatacter (eot) */
64262261Sdim	{ "pc", nullstr },		/* pad character */
65262261Sdim	{ "tt" },			/* terminal type */
66262261Sdim	{ "ev" },			/* enviroment */
67262261Sdim	{ "lo", loginprg },		/* login program */
68262261Sdim	{ "hn", hostname },		/* host name */
69262261Sdim	{ "he" },			/* host name edit */
70262261Sdim	{ "in", &tmode.c_cc[VINTR] },	/* interrupt char */
71262261Sdim	{ "qu", &tmode.c_cc[VQUIT] },	/* quit char */
72262261Sdim	{ "xn", &tmode.c_cc[VSTART] },	/* XON (start) char */
73262261Sdim	{ "xf", &tmode.c_cc[VSTOP] },	/* XOFF (stop) char */
74262261Sdim	{ "bk", &tmode.c_cc[VEOL] },	/* brk char (alt \n) */
75262261Sdim	{ "su", &tmode.c_cc[VSUSP] },	/* suspend char */
76262261Sdim	{ "ds", &tmode.c_cc[VDSUSP] },	/* delayed suspend */
77262261Sdim	{ "rp", &tmode.c_cc[VREPRINT] },/* reprint char */
78262261Sdim	{ "fl", &tmode.c_cc[VDISCARD] },/* flush output */
79262261Sdim	{ "we", &tmode.c_cc[VWERASE] },	/* word erase */
80262261Sdim	{ "ln", &tmode.c_cc[VLNEXT] },	/* literal next */
81262261Sdim	{ "Lo" },			/* locale for strftime() */
82262261Sdim	{ "pp" },			/* ppp login program */
83262261Sdim	{ "if" },			/* sysv-like 'issue' filename */
84262261Sdim	{ "ic" },			/* modem init-chat */
85262261Sdim	{ "ac" },			/* modem answer-chat */
86262261Sdim	{ "al" },			/* user to auto-login */
87262261Sdim	{ 0 }
88262261Sdim};
89262261Sdim
90262261Sdimstruct	gettynums gettynums[] = {
91262261Sdim	{ "is" },			/* input speed */
92262261Sdim	{ "os" },			/* output speed */
93262261Sdim	{ "sp" },			/* both speeds */
94262261Sdim	{ "nd" },			/* newline delay */
95262261Sdim	{ "cd" },			/* carriage-return delay */
96262261Sdim	{ "td" },			/* tab delay */
97262261Sdim	{ "fd" },			/* form-feed delay */
98262261Sdim	{ "bd" },			/* backspace delay */
99262261Sdim	{ "to" },			/* timeout */
100262261Sdim	{ "f0" },			/* output flags */
101262261Sdim	{ "f1" },			/* input flags */
102262261Sdim	{ "f2" },			/* user mode flags */
103262261Sdim	{ "pf" },			/* delay before flush at 1st prompt */
104262261Sdim	{ "c0" },			/* output c_flags */
105262261Sdim	{ "c1" },			/* input c_flags */
106262261Sdim	{ "c2" },			/* user mode c_flags */
107262261Sdim	{ "i0" },			/* output i_flags */
108262261Sdim	{ "i1" },			/* input i_flags */
109262261Sdim	{ "i2" },			/* user mode i_flags */
110262261Sdim	{ "l0" },			/* output l_flags */
111262261Sdim	{ "l1" },			/* input l_flags */
112262261Sdim	{ "l2" },			/* user mode l_flags */
113262261Sdim	{ "o0" },			/* output o_flags */
114262261Sdim	{ "o1" },			/* input o_flags */
115262261Sdim	{ "o2" },			/* user mode o_flags */
116262261Sdim 	{ "de" },   	    	    	/* delay before sending 1st prompt */
117262261Sdim	{ "rt" },			/* reset timeout */
118262261Sdim	{ "ct" },			/* chat script timeout */
119262261Sdim	{ "dc" },			/* debug chat script value */
120262261Sdim  	{ 0 }
121262261Sdim};
122262261Sdim
123262261Sdim
124262261Sdimstruct	gettyflags gettyflags[] = {
125262261Sdim	{ "ht",	0 },			/* has tabs */
126262261Sdim	{ "nl",	1 },			/* has newline char */
127262261Sdim	{ "ep",	0 },			/* even parity */
128262261Sdim	{ "op",	0 },			/* odd parity */
129262261Sdim	{ "ap",	0 },			/* any parity */
130262261Sdim	{ "ec",	1 },			/* no echo */
131262261Sdim	{ "co",	0 },			/* console special */
132262261Sdim	{ "cb",	0 },			/* crt backspace */
133262261Sdim	{ "ck",	0 },			/* crt kill */
134262261Sdim	{ "ce",	0 },			/* crt erase */
135262261Sdim	{ "pe",	0 },			/* printer erase */
136262261Sdim	{ "rw",	1 },			/* don't use raw */
137262261Sdim	{ "xc",	1 },			/* don't ^X ctl chars */
138262261Sdim	{ "lc",	0 },			/* terminal las lower case */
139262261Sdim	{ "uc",	0 },			/* terminal has no lower case */
140262261Sdim	{ "ig",	0 },			/* ignore garbage */
141262261Sdim	{ "ps",	0 },			/* do port selector speed select */
142262261Sdim	{ "hc",	1 },			/* don't set hangup on close */
143262261Sdim	{ "ub", 0 },			/* unbuffered output */
144262261Sdim	{ "ab", 0 },			/* auto-baud detect with '\r' */
145262261Sdim	{ "dx", 0 },			/* set decctlq */
146262261Sdim	{ "np", 0 },			/* no parity at all (8bit chars) */
147262261Sdim	{ "mb", 0 },			/* do MDMBUF flow control */
148262261Sdim	{ "hw", 0 },			/* do CTSRTS flow control */
149262261Sdim	{ 0 }
150262261Sdim};
151262261Sdim