[BACK]Return to init.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / libexec / getty

File: [cvs.NetBSD.org] / src / libexec / getty / init.c (download)

Revision 1.18, Sun Aug 11 05:42:41 2013 UTC (10 years, 8 months ago) by dholland
Branch: MAIN
CVS Tags: yamt-pagecache-base9, tls-maxphys-base, tls-earlyentropy-base, tls-earlyentropy, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3, prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, phil-wifi-base, phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, phil-wifi-20191119, phil-wifi-20190609, phil-wifi, pgoyette-localcount-base, pgoyette-localcount-20170426, pgoyette-localcount-20170320, pgoyette-localcount-20170107, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, pgoyette-localcount, pgoyette-compat-merge-20190127, pgoyette-compat-base, pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226, pgoyette-compat-1126, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906, pgoyette-compat-0728, pgoyette-compat-0625, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315, pgoyette-compat, perseant-stdc-iso10646-base, perseant-stdc-iso10646, netbsd-9-base, netbsd-9-3-RELEASE, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1, netbsd-9, netbsd-8-base, netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1, netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1, netbsd-8, netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-base, netbsd-7-2-RELEASE, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-1, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0, netbsd-7, netbsd-10-base, netbsd-10-0-RELEASE, netbsd-10-0-RC6, netbsd-10-0-RC5, netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1, netbsd-10, matt-nb8-mediatek-base, matt-nb8-mediatek, localcount-20160914, is-mlppp-base, is-mlppp, cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x, bouyer-socketcan-base1, bouyer-socketcan-base, bouyer-socketcan, HEAD
Changes since 1.17: +85 -84 lines

Pass WARNS=5.

/*	$NetBSD: init.c,v 1.18 2013/08/11 05:42:41 dholland Exp $	*/

/*
 * Copyright (c) 1983, 1993
 *	The Regents of the University of California.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. Neither the name of the University nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "from: @(#)init.c	8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: init.c,v 1.18 2013/08/11 05:42:41 dholland Exp $");
#endif
#endif /* not lint */

/*
 * Getty table initializations.
 *
 * Melbourne getty.
 */

#include <stddef.h>
#include <termios.h>

#include "gettytab.h"
#include "pathnames.h"

extern	struct termios tmode;
extern	char hostname[];

#define M(a) ((char *)&tmode.c_cc[a])

struct	gettystrs gettystrs[] = {
	{ "nx", NULL,        NULL },	/* next table */
	{ "cl", NULL,        NULL },	/* screen clear characters */
	{ "im", NULL,        NULL },	/* initial message */
	{ "lm", "login: ",   NULL },	/* login message */
	{ "er", M(VERASE),   NULL },	/* erase character */
	{ "kl", M(VKILL),    NULL },	/* kill character */
	{ "et", M(VEOF),     NULL },	/* eof chatacter (eot) */
	{ "pc", "",          NULL },	/* pad character */
	{ "tt", NULL,        NULL },	/* terminal type */
	{ "ev", NULL,        NULL },	/* environment */
	{ "lo", _PATH_LOGIN, NULL },	/* login program */
	{ "hn", hostname,    NULL },	/* host name */
	{ "he", NULL,        NULL },	/* host name edit */
	{ "in", M(VINTR),    NULL },	/* interrupt char */
	{ "qu", M(VQUIT),    NULL },	/* quit char */
	{ "xn", M(VSTART),   NULL },	/* XON (start) char */
	{ "xf", M(VSTOP),    NULL },	/* XOFF (stop) char */
	{ "bk", M(VEOL),     NULL },	/* brk char (alt \n) */
	{ "su", M(VSUSP),    NULL },	/* suspend char */
	{ "ds", M(VDSUSP),   NULL },	/* delayed suspend */
	{ "rp", M(VREPRINT), NULL },	/* reprint char */
	{ "fl", M(VDISCARD), NULL },	/* flush output */
	{ "we", M(VWERASE),  NULL },	/* word erase */
	{ "ln", M(VLNEXT),   NULL },	/* literal next */
	{ "st", M(VSTATUS),  NULL },	/* status */
	{ "b2", M(VEOL2),    NULL },	/* alt brk char */
	{ "pp", NULL,        NULL },	/* ppp login program */
	{ "if", NULL,        NULL },	/* sysv-like 'issue' filename */
	{ "al", NULL,        NULL },	/* user to auto-login */
	{ NULL, NULL, NULL }
};

struct	gettynums gettynums[] = {
	{ "is", 0,0,0 },		/* input speed */
	{ "os", 0,0,0 },		/* output speed */
	{ "sp", 0,0,0 },		/* both speeds */
	{ "nd", 0,0,0 },		/* newline delay */
	{ "cd", 0,0,0 },		/* carriage-return delay */
	{ "td", 0,0,0 },		/* tab delay */
	{ "fd", 0,0,0 },		/* form-feed delay */
	{ "bd", 0,0,0 },		/* backspace delay */
	{ "to", 0,0,0 },		/* timeout */
	{ "f0", 0,0,0 },		/* output flags */
	{ "f1", 0,0,0 },		/* input flags */
	{ "f2", 0,0,0 },		/* user mode flags */
	{ "pf", 0,0,0 },		/* delay before flush at 1st prompt */
	{ "c0", 0,0,0 },		/* output c_flags */
	{ "c1", 0,0,0 },		/* input c_flags */
	{ "c2", 0,0,0 },		/* user mode c_flags */
	{ "i0", 0,0,0 },		/* output i_flags */
	{ "i1", 0,0,0 },		/* input i_flags */
	{ "i2", 0,0,0 },		/* user mode i_flags */
	{ "l0", 0,0,0 },		/* output l_flags */
	{ "l1", 0,0,0 },		/* input l_flags */
	{ "l2", 0,0,0 },		/* user mode l_flags */
	{ "o0", 0,0,0 },		/* output o_flags */
	{ "o1", 0,0,0 },		/* input o_flags */
	{ "o2", 0,0,0 },		/* user mode o_flags */
	{ 0,0,0,0 }
};

struct	gettyflags gettyflags[] = {
	{ "ht",	0, 0,0,0 },		/* has tabs */
	{ "nl",	1, 0,0,0 },		/* has newline char */
	{ "ep",	0, 0,0,0 },		/* even parity */
	{ "op",	0, 0,0,0 },		/* odd parity */
	{ "ap",	0, 0,0,0 },		/* any parity */
	{ "ec",	1, 0,0,0 },		/* no echo */
	{ "co",	0, 0,0,0 },		/* console special */
	{ "cb",	0, 0,0,0 },		/* crt backspace */
	{ "ck",	0, 0,0,0 },		/* crt kill */
	{ "ce",	0, 0,0,0 },		/* crt erase */
	{ "pe",	0, 0,0,0 },		/* printer erase */
	{ "rw",	1, 0,0,0 },		/* don't use raw */
	{ "xc",	1, 0,0,0 },		/* don't ^X ctl chars */
	{ "lc",	0, 0,0,0 },		/* terminal las lower case */
	{ "uc",	0, 0,0,0 },		/* terminal has no lower case */
	{ "ig",	0, 0,0,0 },		/* ignore garbage */
	{ "ps",	0, 0,0,0 },		/* do port selector speed select */
	{ "hc",	1, 0,0,0 },		/* don't set hangup on close */
	{ "ub", 0, 0,0,0 },		/* unbuffered output */
	{ "ab", 0, 0,0,0 },		/* auto-baud detect with '\r' */
	{ "dx", 0, 0,0,0 },		/* set decctlq */
	{ "np", 0, 0,0,0 },		/* no parity at all (8bit chars) */
	{ "mb", 0, 0,0,0 },		/* do MDMBUF flow control */
	{ "cs", 0, 0,0,0 },		/* clear screen based on term type */
	{ "nn", 0, 0,0,0 },		/* don't prompt for login name */
	{ NULL,0,0,0,0 }
};