init.c revision 64076
11592Srgrimes/*
215645Sjoerg * Copyright (c) 1983, 1993
315645Sjoerg *	The Regents of the University of California.  All rights reserved.
41592Srgrimes *
51592Srgrimes * Redistribution and use in source and binary forms, with or without
61592Srgrimes * modification, are permitted provided that the following conditions
71592Srgrimes * are met:
81592Srgrimes * 1. Redistributions of source code must retain the above copyright
91592Srgrimes *    notice, this list of conditions and the following disclaimer.
101592Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
111592Srgrimes *    notice, this list of conditions and the following disclaimer in the
121592Srgrimes *    documentation and/or other materials provided with the distribution.
131592Srgrimes * 3. All advertising materials mentioning features or use of this software
141592Srgrimes *    must display the following acknowledgement:
151592Srgrimes *	This product includes software developed by the University of
161592Srgrimes *	California, Berkeley and its contributors.
171592Srgrimes * 4. Neither the name of the University nor the names of its contributors
181592Srgrimes *    may be used to endorse or promote products derived from this software
191592Srgrimes *    without specific prior written permission.
201592Srgrimes *
211592Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
221592Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
231592Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
241592Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
251592Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
261592Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
271592Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
281592Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
291592Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
301592Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
311592Srgrimes * SUCH DAMAGE.
321592Srgrimes */
331592Srgrimes
341592Srgrimes#ifndef lint
3531331Scharnier#if 0
3631331Scharnierstatic char sccsid[] = "@(#)from: init.c	8.1 (Berkeley) 6/4/93";
3731331Scharnier#endif
3831331Scharnierstatic const char rcsid[] =
3950476Speter  "$FreeBSD: head/libexec/getty/init.c 64076 2000-07-31 23:47:57Z nsayer $";
401592Srgrimes#endif /* not lint */
411592Srgrimes
421592Srgrimes/*
431592Srgrimes * Getty table initializations.
441592Srgrimes *
451592Srgrimes * Melbourne getty.
461592Srgrimes */
4715645Sjoerg#include <termios.h>
4815645Sjoerg#include "extern.h"
491592Srgrimes#include "gettytab.h"
501592Srgrimes#include "pathnames.h"
511592Srgrimes
5215645Sjoergstatic char loginmsg[] = "login: ";
5315645Sjoergstatic char nullstr[] = "";
5415645Sjoergstatic char loginprg[] = _PATH_LOGIN;
551592Srgrimes
561592Srgrimesstruct	gettystrs gettystrs[] = {
571592Srgrimes	{ "nx" },			/* next table */
581592Srgrimes	{ "cl" },			/* screen clear characters */
591592Srgrimes	{ "im" },			/* initial message */
6015645Sjoerg	{ "lm", loginmsg },		/* login message */
6115645Sjoerg	{ "er", &tmode.c_cc[VERASE] },	/* erase character */
6215645Sjoerg	{ "kl", &tmode.c_cc[VKILL] },	/* kill character */
6315645Sjoerg	{ "et", &tmode.c_cc[VEOF] },	/* eof chatacter (eot) */
6415645Sjoerg	{ "pc", nullstr },		/* pad character */
651592Srgrimes	{ "tt" },			/* terminal type */
661592Srgrimes	{ "ev" },			/* enviroment */
6715645Sjoerg	{ "lo", loginprg },		/* login program */
681592Srgrimes	{ "hn", hostname },		/* host name */
691592Srgrimes	{ "he" },			/* host name edit */
7015645Sjoerg	{ "in", &tmode.c_cc[VINTR] },	/* interrupt char */
7115645Sjoerg	{ "qu", &tmode.c_cc[VQUIT] },	/* quit char */
7215645Sjoerg	{ "xn", &tmode.c_cc[VSTART] },	/* XON (start) char */
7315645Sjoerg	{ "xf", &tmode.c_cc[VSTOP] },	/* XOFF (stop) char */
7415645Sjoerg	{ "bk", &tmode.c_cc[VEOL] },	/* brk char (alt \n) */
7515645Sjoerg	{ "su", &tmode.c_cc[VSUSP] },	/* suspend char */
7615645Sjoerg	{ "ds", &tmode.c_cc[VDSUSP] },	/* delayed suspend */
7715645Sjoerg	{ "rp", &tmode.c_cc[VREPRINT] },/* reprint char */
7815645Sjoerg	{ "fl", &tmode.c_cc[VDISCARD] },/* flush output */
7915645Sjoerg	{ "we", &tmode.c_cc[VWERASE] },	/* word erase */
8015645Sjoerg	{ "ln", &tmode.c_cc[VLNEXT] },	/* literal next */
8115645Sjoerg	{ "Lo" },			/* locale for strftime() */
8219697Spst	{ "pp" },			/* ppp login program */
8322208Sdavidn	{ "if" },			/* sysv-like 'issue' filename */
8422208Sdavidn	{ "ic" },			/* modem init-chat */
8522208Sdavidn	{ "ac" },			/* modem answer-chat */
8645291Speter	{ "al" },			/* user to auto-login */
871592Srgrimes	{ 0 }
881592Srgrimes};
891592Srgrimes
901592Srgrimesstruct	gettynums gettynums[] = {
911592Srgrimes	{ "is" },			/* input speed */
921592Srgrimes	{ "os" },			/* output speed */
931592Srgrimes	{ "sp" },			/* both speeds */
941592Srgrimes	{ "nd" },			/* newline delay */
951592Srgrimes	{ "cd" },			/* carriage-return delay */
961592Srgrimes	{ "td" },			/* tab delay */
971592Srgrimes	{ "fd" },			/* form-feed delay */
981592Srgrimes	{ "bd" },			/* backspace delay */
991592Srgrimes	{ "to" },			/* timeout */
1001592Srgrimes	{ "f0" },			/* output flags */
1011592Srgrimes	{ "f1" },			/* input flags */
1021592Srgrimes	{ "f2" },			/* user mode flags */
1031592Srgrimes	{ "pf" },			/* delay before flush at 1st prompt */
10415645Sjoerg	{ "c0" },			/* output c_flags */
10515645Sjoerg	{ "c1" },			/* input c_flags */
10615645Sjoerg	{ "c2" },			/* user mode c_flags */
10715645Sjoerg	{ "i0" },			/* output i_flags */
10815645Sjoerg	{ "i1" },			/* input i_flags */
10915645Sjoerg	{ "i2" },			/* user mode i_flags */
11015645Sjoerg	{ "l0" },			/* output l_flags */
11115645Sjoerg	{ "l1" },			/* input l_flags */
11215645Sjoerg	{ "l2" },			/* user mode l_flags */
11315645Sjoerg	{ "o0" },			/* output o_flags */
11415645Sjoerg	{ "o1" },			/* input o_flags */
11515645Sjoerg	{ "o2" },			/* user mode o_flags */
11621120Smsmith 	{ "de" },   	    	    	/* delay before sending 1st prompt */
11722208Sdavidn	{ "rt" },			/* reset timeout */
11822208Sdavidn	{ "ct" },			/* chat script timeout */
11922208Sdavidn	{ "dc" },			/* debug chat script value */
12021120Smsmith  	{ 0 }
1211592Srgrimes};
12221120Smsmith
1231592Srgrimes
1241592Srgrimesstruct	gettyflags gettyflags[] = {
1251592Srgrimes	{ "ht",	0 },			/* has tabs */
1261592Srgrimes	{ "nl",	1 },			/* has newline char */
1271592Srgrimes	{ "ep",	0 },			/* even parity */
1281592Srgrimes	{ "op",	0 },			/* odd parity */
1291592Srgrimes	{ "ap",	0 },			/* any parity */
1301592Srgrimes	{ "ec",	1 },			/* no echo */
1311592Srgrimes	{ "co",	0 },			/* console special */
1321592Srgrimes	{ "cb",	0 },			/* crt backspace */
1331592Srgrimes	{ "ck",	0 },			/* crt kill */
1341592Srgrimes	{ "ce",	0 },			/* crt erase */
1351592Srgrimes	{ "pe",	0 },			/* printer erase */
1361592Srgrimes	{ "rw",	1 },			/* don't use raw */
1371592Srgrimes	{ "xc",	1 },			/* don't ^X ctl chars */
1381592Srgrimes	{ "lc",	0 },			/* terminal las lower case */
1391592Srgrimes	{ "uc",	0 },			/* terminal has no lower case */
1401592Srgrimes	{ "ig",	0 },			/* ignore garbage */
1411592Srgrimes	{ "ps",	0 },			/* do port selector speed select */
1421592Srgrimes	{ "hc",	1 },			/* don't set hangup on close */
1431592Srgrimes	{ "ub", 0 },			/* unbuffered output */
1441592Srgrimes	{ "ab", 0 },			/* auto-baud detect with '\r' */
1451592Srgrimes	{ "dx", 0 },			/* set decctlq */
1461592Srgrimes	{ "np", 0 },			/* no parity at all (8bit chars) */
14715645Sjoerg	{ "mb", 0 },			/* do MDMBUF flow control */
14822208Sdavidn	{ "hw", 0 },			/* do CTSRTS flow control */
14964076Snsayer	{ "nc", 0 },			/* set clocal (no carrier) */
1501592Srgrimes	{ 0 }
1511592Srgrimes};
152