Home | History | Annotate | Line # | Download | only in getty
      1  1.18  dholland /*	$NetBSD: init.c,v 1.18 2013/08/11 05:42:41 dholland Exp $	*/
      2   1.7   thorpej 
      3   1.1       cgd /*
      4   1.6        pk  * Copyright (c) 1983, 1993
      5   1.6        pk  *	The Regents of the University of California.  All rights reserved.
      6   1.1       cgd  *
      7   1.1       cgd  * Redistribution and use in source and binary forms, with or without
      8   1.1       cgd  * modification, are permitted provided that the following conditions
      9   1.1       cgd  * are met:
     10   1.1       cgd  * 1. Redistributions of source code must retain the above copyright
     11   1.1       cgd  *    notice, this list of conditions and the following disclaimer.
     12   1.1       cgd  * 2. Redistributions in binary form must reproduce the above copyright
     13   1.1       cgd  *    notice, this list of conditions and the following disclaimer in the
     14   1.1       cgd  *    documentation and/or other materials provided with the distribution.
     15  1.14       agc  * 3. Neither the name of the University nor the names of its contributors
     16   1.1       cgd  *    may be used to endorse or promote products derived from this software
     17   1.1       cgd  *    without specific prior written permission.
     18   1.1       cgd  *
     19   1.1       cgd  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     20   1.1       cgd  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     21   1.1       cgd  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     22   1.1       cgd  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     23   1.1       cgd  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     24   1.1       cgd  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     25   1.1       cgd  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     26   1.1       cgd  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     27   1.1       cgd  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     28   1.1       cgd  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     29   1.1       cgd  * SUCH DAMAGE.
     30   1.1       cgd  */
     31   1.1       cgd 
     32   1.8     mikel #include <sys/cdefs.h>
     33   1.1       cgd #ifndef lint
     34   1.7   thorpej #if 0
     35   1.7   thorpej static char sccsid[] = "from: @(#)init.c	8.1 (Berkeley) 6/4/93";
     36   1.7   thorpej #else
     37  1.18  dholland __RCSID("$NetBSD: init.c,v 1.18 2013/08/11 05:42:41 dholland Exp $");
     38   1.7   thorpej #endif
     39   1.1       cgd #endif /* not lint */
     40   1.1       cgd 
     41   1.1       cgd /*
     42   1.1       cgd  * Getty table initializations.
     43   1.1       cgd  *
     44   1.1       cgd  * Melbourne getty.
     45   1.1       cgd  */
     46   1.8     mikel 
     47  1.18  dholland #include <stddef.h>
     48   1.5        pk #include <termios.h>
     49   1.8     mikel 
     50   1.1       cgd #include "gettytab.h"
     51   1.1       cgd #include "pathnames.h"
     52   1.1       cgd 
     53   1.5        pk extern	struct termios tmode;
     54   1.1       cgd extern	char hostname[];
     55   1.1       cgd 
     56  1.16  christos #define M(a) ((char *)&tmode.c_cc[a])
     57  1.16  christos 
     58   1.1       cgd struct	gettystrs gettystrs[] = {
     59  1.18  dholland 	{ "nx", NULL,        NULL },	/* next table */
     60  1.18  dholland 	{ "cl", NULL,        NULL },	/* screen clear characters */
     61  1.18  dholland 	{ "im", NULL,        NULL },	/* initial message */
     62  1.18  dholland 	{ "lm", "login: ",   NULL },	/* login message */
     63  1.18  dholland 	{ "er", M(VERASE),   NULL },	/* erase character */
     64  1.18  dholland 	{ "kl", M(VKILL),    NULL },	/* kill character */
     65  1.18  dholland 	{ "et", M(VEOF),     NULL },	/* eof chatacter (eot) */
     66  1.18  dholland 	{ "pc", "",          NULL },	/* pad character */
     67  1.18  dholland 	{ "tt", NULL,        NULL },	/* terminal type */
     68  1.18  dholland 	{ "ev", NULL,        NULL },	/* environment */
     69  1.18  dholland 	{ "lo", _PATH_LOGIN, NULL },	/* login program */
     70  1.18  dholland 	{ "hn", hostname,    NULL },	/* host name */
     71  1.18  dholland 	{ "he", NULL,        NULL },	/* host name edit */
     72  1.18  dholland 	{ "in", M(VINTR),    NULL },	/* interrupt char */
     73  1.18  dholland 	{ "qu", M(VQUIT),    NULL },	/* quit char */
     74  1.18  dholland 	{ "xn", M(VSTART),   NULL },	/* XON (start) char */
     75  1.18  dholland 	{ "xf", M(VSTOP),    NULL },	/* XOFF (stop) char */
     76  1.18  dholland 	{ "bk", M(VEOL),     NULL },	/* brk char (alt \n) */
     77  1.18  dholland 	{ "su", M(VSUSP),    NULL },	/* suspend char */
     78  1.18  dholland 	{ "ds", M(VDSUSP),   NULL },	/* delayed suspend */
     79  1.18  dholland 	{ "rp", M(VREPRINT), NULL },	/* reprint char */
     80  1.18  dholland 	{ "fl", M(VDISCARD), NULL },	/* flush output */
     81  1.18  dholland 	{ "we", M(VWERASE),  NULL },	/* word erase */
     82  1.18  dholland 	{ "ln", M(VLNEXT),   NULL },	/* literal next */
     83  1.18  dholland 	{ "st", M(VSTATUS),  NULL },	/* status */
     84  1.18  dholland 	{ "b2", M(VEOL2),    NULL },	/* alt brk char */
     85  1.18  dholland 	{ "pp", NULL,        NULL },	/* ppp login program */
     86  1.18  dholland 	{ "if", NULL,        NULL },	/* sysv-like 'issue' filename */
     87  1.18  dholland 	{ "al", NULL,        NULL },	/* user to auto-login */
     88  1.18  dholland 	{ NULL, NULL, NULL }
     89   1.1       cgd };
     90   1.1       cgd 
     91   1.1       cgd struct	gettynums gettynums[] = {
     92  1.18  dholland 	{ "is", 0,0,0 },		/* input speed */
     93  1.18  dholland 	{ "os", 0,0,0 },		/* output speed */
     94  1.18  dholland 	{ "sp", 0,0,0 },		/* both speeds */
     95  1.18  dholland 	{ "nd", 0,0,0 },		/* newline delay */
     96  1.18  dholland 	{ "cd", 0,0,0 },		/* carriage-return delay */
     97  1.18  dholland 	{ "td", 0,0,0 },		/* tab delay */
     98  1.18  dholland 	{ "fd", 0,0,0 },		/* form-feed delay */
     99  1.18  dholland 	{ "bd", 0,0,0 },		/* backspace delay */
    100  1.18  dholland 	{ "to", 0,0,0 },		/* timeout */
    101  1.18  dholland 	{ "f0", 0,0,0 },		/* output flags */
    102  1.18  dholland 	{ "f1", 0,0,0 },		/* input flags */
    103  1.18  dholland 	{ "f2", 0,0,0 },		/* user mode flags */
    104  1.18  dholland 	{ "pf", 0,0,0 },		/* delay before flush at 1st prompt */
    105  1.18  dholland 	{ "c0", 0,0,0 },		/* output c_flags */
    106  1.18  dholland 	{ "c1", 0,0,0 },		/* input c_flags */
    107  1.18  dholland 	{ "c2", 0,0,0 },		/* user mode c_flags */
    108  1.18  dholland 	{ "i0", 0,0,0 },		/* output i_flags */
    109  1.18  dholland 	{ "i1", 0,0,0 },		/* input i_flags */
    110  1.18  dholland 	{ "i2", 0,0,0 },		/* user mode i_flags */
    111  1.18  dholland 	{ "l0", 0,0,0 },		/* output l_flags */
    112  1.18  dholland 	{ "l1", 0,0,0 },		/* input l_flags */
    113  1.18  dholland 	{ "l2", 0,0,0 },		/* user mode l_flags */
    114  1.18  dholland 	{ "o0", 0,0,0 },		/* output o_flags */
    115  1.18  dholland 	{ "o1", 0,0,0 },		/* input o_flags */
    116  1.18  dholland 	{ "o2", 0,0,0 },		/* user mode o_flags */
    117  1.18  dholland 	{ 0,0,0,0 }
    118   1.1       cgd };
    119   1.1       cgd 
    120   1.1       cgd struct	gettyflags gettyflags[] = {
    121  1.18  dholland 	{ "ht",	0, 0,0,0 },		/* has tabs */
    122  1.18  dholland 	{ "nl",	1, 0,0,0 },		/* has newline char */
    123  1.18  dholland 	{ "ep",	0, 0,0,0 },		/* even parity */
    124  1.18  dholland 	{ "op",	0, 0,0,0 },		/* odd parity */
    125  1.18  dholland 	{ "ap",	0, 0,0,0 },		/* any parity */
    126  1.18  dholland 	{ "ec",	1, 0,0,0 },		/* no echo */
    127  1.18  dholland 	{ "co",	0, 0,0,0 },		/* console special */
    128  1.18  dholland 	{ "cb",	0, 0,0,0 },		/* crt backspace */
    129  1.18  dholland 	{ "ck",	0, 0,0,0 },		/* crt kill */
    130  1.18  dholland 	{ "ce",	0, 0,0,0 },		/* crt erase */
    131  1.18  dholland 	{ "pe",	0, 0,0,0 },		/* printer erase */
    132  1.18  dholland 	{ "rw",	1, 0,0,0 },		/* don't use raw */
    133  1.18  dholland 	{ "xc",	1, 0,0,0 },		/* don't ^X ctl chars */
    134  1.18  dholland 	{ "lc",	0, 0,0,0 },		/* terminal las lower case */
    135  1.18  dholland 	{ "uc",	0, 0,0,0 },		/* terminal has no lower case */
    136  1.18  dholland 	{ "ig",	0, 0,0,0 },		/* ignore garbage */
    137  1.18  dholland 	{ "ps",	0, 0,0,0 },		/* do port selector speed select */
    138  1.18  dholland 	{ "hc",	1, 0,0,0 },		/* don't set hangup on close */
    139  1.18  dholland 	{ "ub", 0, 0,0,0 },		/* unbuffered output */
    140  1.18  dholland 	{ "ab", 0, 0,0,0 },		/* auto-baud detect with '\r' */
    141  1.18  dholland 	{ "dx", 0, 0,0,0 },		/* set decctlq */
    142  1.18  dholland 	{ "np", 0, 0,0,0 },		/* no parity at all (8bit chars) */
    143  1.18  dholland 	{ "mb", 0, 0,0,0 },		/* do MDMBUF flow control */
    144  1.18  dholland 	{ "cs", 0, 0,0,0 },		/* clear screen based on term type */
    145  1.18  dholland 	{ "nn", 0, 0,0,0 },		/* don't prompt for login name */
    146  1.18  dholland 	{ NULL,0,0,0,0 }
    147   1.1       cgd };
    148