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