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