init.c revision 229780
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 229780 2012-01-07 16:09:54Z uqs $"; 401592Srgrimes#endif /* not lint */ 411592Srgrimes 421592Srgrimes/* 431592Srgrimes * Getty table initializations. 441592Srgrimes * 451592Srgrimes * Melbourne getty. 461592Srgrimes */ 4715645Sjoerg#include <termios.h> 48144716Sstefanf#include "gettytab.h" 4915645Sjoerg#include "extern.h" 501592Srgrimes#include "pathnames.h" 511592Srgrimes 5215645Sjoergstatic char loginmsg[] = "login: "; 5315645Sjoergstatic char nullstr[] = ""; 5415645Sjoergstatic char loginprg[] = _PATH_LOGIN; 5577874Syarstatic char datefmt[] = "%+"; 561592Srgrimes 571592Srgrimesstruct gettystrs gettystrs[] = { 581592Srgrimes { "nx" }, /* next table */ 591592Srgrimes { "cl" }, /* screen clear characters */ 601592Srgrimes { "im" }, /* initial message */ 6115645Sjoerg { "lm", loginmsg }, /* login message */ 62116533Syar { "er", &omode.c_cc[VERASE] }, /* erase character */ 63116533Syar { "kl", &omode.c_cc[VKILL] }, /* kill character */ 64116533Syar { "et", &omode.c_cc[VEOF] }, /* eof chatacter (eot) */ 6515645Sjoerg { "pc", nullstr }, /* pad character */ 661592Srgrimes { "tt" }, /* terminal type */ 67229780Suqs { "ev" }, /* environment */ 6815645Sjoerg { "lo", loginprg }, /* login program */ 691592Srgrimes { "hn", hostname }, /* host name */ 701592Srgrimes { "he" }, /* host name edit */ 71116533Syar { "in", &omode.c_cc[VINTR] }, /* interrupt char */ 72116533Syar { "qu", &omode.c_cc[VQUIT] }, /* quit char */ 73116533Syar { "xn", &omode.c_cc[VSTART] }, /* XON (start) char */ 74116533Syar { "xf", &omode.c_cc[VSTOP] }, /* XOFF (stop) char */ 75116533Syar { "bk", &omode.c_cc[VEOL] }, /* brk char (alt \n) */ 76116533Syar { "su", &omode.c_cc[VSUSP] }, /* suspend char */ 77116533Syar { "ds", &omode.c_cc[VDSUSP] }, /* delayed suspend */ 78116533Syar { "rp", &omode.c_cc[VREPRINT] },/* reprint char */ 79116533Syar { "fl", &omode.c_cc[VDISCARD] },/* flush output */ 80116533Syar { "we", &omode.c_cc[VWERASE] }, /* word erase */ 81116533Syar { "ln", &omode.c_cc[VLNEXT] }, /* literal next */ 8215645Sjoerg { "Lo" }, /* locale for strftime() */ 8319697Spst { "pp" }, /* ppp login program */ 8422208Sdavidn { "if" }, /* sysv-like 'issue' filename */ 8522208Sdavidn { "ic" }, /* modem init-chat */ 8622208Sdavidn { "ac" }, /* modem answer-chat */ 8745291Speter { "al" }, /* user to auto-login */ 8877874Syar { "df", datefmt}, /* format for strftime() */ 891592Srgrimes { 0 } 901592Srgrimes}; 911592Srgrimes 921592Srgrimesstruct gettynums gettynums[] = { 931592Srgrimes { "is" }, /* input speed */ 941592Srgrimes { "os" }, /* output speed */ 951592Srgrimes { "sp" }, /* both speeds */ 961592Srgrimes { "nd" }, /* newline delay */ 971592Srgrimes { "cd" }, /* carriage-return delay */ 981592Srgrimes { "td" }, /* tab delay */ 991592Srgrimes { "fd" }, /* form-feed delay */ 1001592Srgrimes { "bd" }, /* backspace delay */ 1011592Srgrimes { "to" }, /* timeout */ 1021592Srgrimes { "f0" }, /* output flags */ 1031592Srgrimes { "f1" }, /* input flags */ 1041592Srgrimes { "f2" }, /* user mode flags */ 1051592Srgrimes { "pf" }, /* delay before flush at 1st prompt */ 10615645Sjoerg { "c0" }, /* output c_flags */ 10715645Sjoerg { "c1" }, /* input c_flags */ 10815645Sjoerg { "c2" }, /* user mode c_flags */ 10915645Sjoerg { "i0" }, /* output i_flags */ 11015645Sjoerg { "i1" }, /* input i_flags */ 11115645Sjoerg { "i2" }, /* user mode i_flags */ 11215645Sjoerg { "l0" }, /* output l_flags */ 11315645Sjoerg { "l1" }, /* input l_flags */ 11415645Sjoerg { "l2" }, /* user mode l_flags */ 11515645Sjoerg { "o0" }, /* output o_flags */ 11615645Sjoerg { "o1" }, /* input o_flags */ 11715645Sjoerg { "o2" }, /* user mode o_flags */ 11821120Smsmith { "de" }, /* delay before sending 1st prompt */ 11922208Sdavidn { "rt" }, /* reset timeout */ 12022208Sdavidn { "ct" }, /* chat script timeout */ 12122208Sdavidn { "dc" }, /* debug chat script value */ 12221120Smsmith { 0 } 1231592Srgrimes}; 12421120Smsmith 1251592Srgrimes 1261592Srgrimesstruct gettyflags gettyflags[] = { 1271592Srgrimes { "ht", 0 }, /* has tabs */ 1281592Srgrimes { "nl", 1 }, /* has newline char */ 1291592Srgrimes { "ep", 0 }, /* even parity */ 1301592Srgrimes { "op", 0 }, /* odd parity */ 1311592Srgrimes { "ap", 0 }, /* any parity */ 1321592Srgrimes { "ec", 1 }, /* no echo */ 1331592Srgrimes { "co", 0 }, /* console special */ 1341592Srgrimes { "cb", 0 }, /* crt backspace */ 1351592Srgrimes { "ck", 0 }, /* crt kill */ 1361592Srgrimes { "ce", 0 }, /* crt erase */ 1371592Srgrimes { "pe", 0 }, /* printer erase */ 1381592Srgrimes { "rw", 1 }, /* don't use raw */ 1391592Srgrimes { "xc", 1 }, /* don't ^X ctl chars */ 1401592Srgrimes { "lc", 0 }, /* terminal las lower case */ 1411592Srgrimes { "uc", 0 }, /* terminal has no lower case */ 1421592Srgrimes { "ig", 0 }, /* ignore garbage */ 1431592Srgrimes { "ps", 0 }, /* do port selector speed select */ 1441592Srgrimes { "hc", 1 }, /* don't set hangup on close */ 1451592Srgrimes { "ub", 0 }, /* unbuffered output */ 1461592Srgrimes { "ab", 0 }, /* auto-baud detect with '\r' */ 1471592Srgrimes { "dx", 0 }, /* set decctlq */ 1481592Srgrimes { "np", 0 }, /* no parity at all (8bit chars) */ 14915645Sjoerg { "mb", 0 }, /* do MDMBUF flow control */ 15022208Sdavidn { "hw", 0 }, /* do CTSRTS flow control */ 15164076Snsayer { "nc", 0 }, /* set clocal (no carrier) */ 152109540Ssobomax { "pl", 0 }, /* use PPP instead of login(1) */ 1531592Srgrimes { 0 } 1541592Srgrimes}; 155