init.c revision 22208
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
3515645Sjoerg/*static char sccsid[] = "from: @(#)init.c	8.1 (Berkeley) 6/4/93";*/
3621673Sjkhstatic char rcsid[] = "$FreeBSD: head/libexec/getty/init.c 22208 1997-02-02 14:24:57Z davidn $";
371592Srgrimes#endif /* not lint */
381592Srgrimes
391592Srgrimes/*
401592Srgrimes * Getty table initializations.
411592Srgrimes *
421592Srgrimes * Melbourne getty.
431592Srgrimes */
4415645Sjoerg#include <termios.h>
4515645Sjoerg#include "extern.h"
461592Srgrimes#include "gettytab.h"
471592Srgrimes#include "pathnames.h"
481592Srgrimes
4915645Sjoergstatic char loginmsg[] = "login: ";
5015645Sjoergstatic char nullstr[] = "";
5115645Sjoergstatic char loginprg[] = _PATH_LOGIN;
521592Srgrimes
531592Srgrimesstruct	gettystrs gettystrs[] = {
541592Srgrimes	{ "nx" },			/* next table */
551592Srgrimes	{ "cl" },			/* screen clear characters */
561592Srgrimes	{ "im" },			/* initial message */
5715645Sjoerg	{ "lm", loginmsg },		/* login message */
5815645Sjoerg	{ "er", &tmode.c_cc[VERASE] },	/* erase character */
5915645Sjoerg	{ "kl", &tmode.c_cc[VKILL] },	/* kill character */
6015645Sjoerg	{ "et", &tmode.c_cc[VEOF] },	/* eof chatacter (eot) */
6115645Sjoerg	{ "pc", nullstr },		/* pad character */
621592Srgrimes	{ "tt" },			/* terminal type */
631592Srgrimes	{ "ev" },			/* enviroment */
6415645Sjoerg	{ "lo", loginprg },		/* login program */
651592Srgrimes	{ "hn", hostname },		/* host name */
661592Srgrimes	{ "he" },			/* host name edit */
6715645Sjoerg	{ "in", &tmode.c_cc[VINTR] },	/* interrupt char */
6815645Sjoerg	{ "qu", &tmode.c_cc[VQUIT] },	/* quit char */
6915645Sjoerg	{ "xn", &tmode.c_cc[VSTART] },	/* XON (start) char */
7015645Sjoerg	{ "xf", &tmode.c_cc[VSTOP] },	/* XOFF (stop) char */
7115645Sjoerg	{ "bk", &tmode.c_cc[VEOL] },	/* brk char (alt \n) */
7215645Sjoerg	{ "su", &tmode.c_cc[VSUSP] },	/* suspend char */
7315645Sjoerg	{ "ds", &tmode.c_cc[VDSUSP] },	/* delayed suspend */
7415645Sjoerg	{ "rp", &tmode.c_cc[VREPRINT] },/* reprint char */
7515645Sjoerg	{ "fl", &tmode.c_cc[VDISCARD] },/* flush output */
7615645Sjoerg	{ "we", &tmode.c_cc[VWERASE] },	/* word erase */
7715645Sjoerg	{ "ln", &tmode.c_cc[VLNEXT] },	/* literal next */
7815645Sjoerg	{ "Lo" },			/* locale for strftime() */
7919697Spst	{ "pp" },			/* ppp login program */
8022208Sdavidn	{ "if" },			/* sysv-like 'issue' filename */
8122208Sdavidn	{ "ic" },			/* modem init-chat */
8222208Sdavidn	{ "ac" },			/* modem answer-chat */
831592Srgrimes	{ 0 }
841592Srgrimes};
851592Srgrimes
861592Srgrimesstruct	gettynums gettynums[] = {
871592Srgrimes	{ "is" },			/* input speed */
881592Srgrimes	{ "os" },			/* output speed */
891592Srgrimes	{ "sp" },			/* both speeds */
901592Srgrimes	{ "nd" },			/* newline delay */
911592Srgrimes	{ "cd" },			/* carriage-return delay */
921592Srgrimes	{ "td" },			/* tab delay */
931592Srgrimes	{ "fd" },			/* form-feed delay */
941592Srgrimes	{ "bd" },			/* backspace delay */
951592Srgrimes	{ "to" },			/* timeout */
961592Srgrimes	{ "f0" },			/* output flags */
971592Srgrimes	{ "f1" },			/* input flags */
981592Srgrimes	{ "f2" },			/* user mode flags */
991592Srgrimes	{ "pf" },			/* delay before flush at 1st prompt */
10015645Sjoerg	{ "c0" },			/* output c_flags */
10115645Sjoerg	{ "c1" },			/* input c_flags */
10215645Sjoerg	{ "c2" },			/* user mode c_flags */
10315645Sjoerg	{ "i0" },			/* output i_flags */
10415645Sjoerg	{ "i1" },			/* input i_flags */
10515645Sjoerg	{ "i2" },			/* user mode i_flags */
10615645Sjoerg	{ "l0" },			/* output l_flags */
10715645Sjoerg	{ "l1" },			/* input l_flags */
10815645Sjoerg	{ "l2" },			/* user mode l_flags */
10915645Sjoerg	{ "o0" },			/* output o_flags */
11015645Sjoerg	{ "o1" },			/* input o_flags */
11115645Sjoerg	{ "o2" },			/* user mode o_flags */
11221120Smsmith 	{ "de" },   	    	    	/* delay before sending 1st prompt */
11322208Sdavidn	{ "rt" },			/* reset timeout */
11422208Sdavidn	{ "ct" },			/* chat script timeout */
11522208Sdavidn	{ "dc" },			/* debug chat script value */
11621120Smsmith  	{ 0 }
1171592Srgrimes};
11821120Smsmith
1191592Srgrimes
1201592Srgrimesstruct	gettyflags gettyflags[] = {
1211592Srgrimes	{ "ht",	0 },			/* has tabs */
1221592Srgrimes	{ "nl",	1 },			/* has newline char */
1231592Srgrimes	{ "ep",	0 },			/* even parity */
1241592Srgrimes	{ "op",	0 },			/* odd parity */
1251592Srgrimes	{ "ap",	0 },			/* any parity */
1261592Srgrimes	{ "ec",	1 },			/* no echo */
1271592Srgrimes	{ "co",	0 },			/* console special */
1281592Srgrimes	{ "cb",	0 },			/* crt backspace */
1291592Srgrimes	{ "ck",	0 },			/* crt kill */
1301592Srgrimes	{ "ce",	0 },			/* crt erase */
1311592Srgrimes	{ "pe",	0 },			/* printer erase */
1321592Srgrimes	{ "rw",	1 },			/* don't use raw */
1331592Srgrimes	{ "xc",	1 },			/* don't ^X ctl chars */
1341592Srgrimes	{ "lc",	0 },			/* terminal las lower case */
1351592Srgrimes	{ "uc",	0 },			/* terminal has no lower case */
1361592Srgrimes	{ "ig",	0 },			/* ignore garbage */
1371592Srgrimes	{ "ps",	0 },			/* do port selector speed select */
1381592Srgrimes	{ "hc",	1 },			/* don't set hangup on close */
1391592Srgrimes	{ "ub", 0 },			/* unbuffered output */
1401592Srgrimes	{ "ab", 0 },			/* auto-baud detect with '\r' */
1411592Srgrimes	{ "dx", 0 },			/* set decctlq */
1421592Srgrimes	{ "np", 0 },			/* no parity at all (8bit chars) */
14315645Sjoerg	{ "mb", 0 },			/* do MDMBUF flow control */
14422208Sdavidn	{ "hw", 0 },			/* do CTSRTS flow control */
1451592Srgrimes	{ 0 }
1461592Srgrimes};
147