init.c 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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. * Getty table initializations.
  33. *
  34. * Melbourne getty.
  35. */
  36. #include <stdio.h>
  37. #include <termios.h>
  38. #include "gettytab.h"
  39. #include "extern.h"
  40. #include "pathnames.h"
  41. static char loginmsg[] = "login: ";
  42. static char nullstr[] = "";
  43. static char loginprg[] = _PATH_LOGIN;
  44. static char datefmt[] = "%+";
  45. #define M(a) (char *)(&omode.c_cc[a])
  46. struct gettystrs gettystrs[] = {
  47. { "nx", NULL, NULL }, /* next table */
  48. { "cl", NULL, NULL }, /* screen clear characters */
  49. { "im", NULL, NULL }, /* initial message */
  50. { "lm", loginmsg, NULL }, /* login message */
  51. { "er", M(VERASE), NULL }, /* erase character */
  52. { "kl", M(VKILL), NULL }, /* kill character */
  53. { "et", M(VEOF), NULL }, /* eof chatacter (eot) */
  54. { "pc", nullstr, NULL }, /* pad character */
  55. { "tt", NULL, NULL }, /* terminal type */
  56. { "ev", NULL, NULL }, /* environment */
  57. { "lo", loginprg, NULL }, /* login program */
  58. { "hn", hostname, NULL }, /* host name */
  59. { "he", NULL, NULL }, /* host name edit */
  60. { "in", M(VINTR), NULL }, /* interrupt char */
  61. { "qu", M(VQUIT), NULL }, /* quit char */
  62. { "xn", M(VSTART), NULL }, /* XON (start) char */
  63. { "xf", M(VSTOP), NULL }, /* XOFF (stop) char */
  64. { "bk", M(VEOL), NULL }, /* brk char (alt \n) */
  65. { "su", M(VSUSP), NULL }, /* suspend char */
  66. { "ds", M(VDSUSP), NULL }, /* delayed suspend */
  67. { "rp", M(VREPRINT), NULL }, /* reprint char */
  68. { "fl", M(VDISCARD), NULL }, /* flush output */
  69. { "we", M(VWERASE), NULL }, /* word erase */
  70. { "ln", M(VLNEXT), NULL }, /* literal next */
  71. { "Lo", NULL, NULL }, /* locale for strftime() */
  72. { "pp", NULL, NULL }, /* ppp login program */
  73. { "if", NULL, NULL }, /* sysv-like 'issue' filename */
  74. { "ic", NULL, NULL }, /* modem init-chat */
  75. { "ac", NULL, NULL }, /* modem answer-chat */
  76. { "al", NULL, NULL }, /* user to auto-login */
  77. { "df", datefmt, NULL }, /* format for strftime() */
  78. { "iM" , NULL, NULL }, /* initial message program */
  79. { NULL, NULL, NULL }
  80. };
  81. struct gettynums gettynums[] = {
  82. { "is", 0, 0, 0 }, /* input speed */
  83. { "os", 0, 0, 0 }, /* output speed */
  84. { "sp", 0, 0, 0 }, /* both speeds */
  85. { "nd", 0, 0, 0 }, /* newline delay */
  86. { "cd", 0, 0, 0 }, /* carriage-return delay */
  87. { "td", 0, 0, 0 }, /* tab delay */
  88. { "fd", 0, 0, 0 }, /* form-feed delay */
  89. { "bd", 0, 0, 0 }, /* backspace delay */
  90. { "to", 0, 0, 0 }, /* timeout */
  91. { "f0", 0, 0, 0 }, /* output flags */
  92. { "f1", 0, 0, 0 }, /* input flags */
  93. { "f2", 0, 0, 0 }, /* user mode flags */
  94. { "pf", 0, 0, 0 }, /* delay before flush at 1st prompt */
  95. { "c0", 0, 0, 0 }, /* output c_flags */
  96. { "c1", 0, 0, 0 }, /* input c_flags */
  97. { "c2", 0, 0, 0 }, /* user mode c_flags */
  98. { "i0", 0, 0, 0 }, /* output i_flags */
  99. { "i1", 0, 0, 0 }, /* input i_flags */
  100. { "i2", 0, 0, 0 }, /* user mode i_flags */
  101. { "l0", 0, 0, 0 }, /* output l_flags */
  102. { "l1", 0, 0, 0 }, /* input l_flags */
  103. { "l2", 0, 0, 0 }, /* user mode l_flags */
  104. { "o0", 0, 0, 0 }, /* output o_flags */
  105. { "o1", 0, 0, 0 }, /* input o_flags */
  106. { "o2", 0, 0, 0 }, /* user mode o_flags */
  107. { "de", 0, 0, 0 }, /* delay before sending 1st prompt */
  108. { "rt", 0, 0, 0 }, /* reset timeout */
  109. { "ct", 0, 0, 0 }, /* chat script timeout */
  110. { "dc", 0, 0, 0 }, /* debug chat script value */
  111. { NULL, 0, 0, 0 }
  112. };
  113. struct gettyflags gettyflags[] = {
  114. { "ht", 0, 0, 0, 0 }, /* has tabs */
  115. { "nl", 1, 0, 0, 0 }, /* has newline char */
  116. { "ep", 0, 0, 0, 0 }, /* even parity */
  117. { "op", 0, 0, 0, 0 }, /* odd parity */
  118. { "ap", 0, 0, 0, 0 }, /* any parity */
  119. { "ec", 1, 0, 0, 0 }, /* no echo */
  120. { "co", 0, 0, 0, 0 }, /* console special */
  121. { "cb", 0, 0, 0, 0 }, /* crt backspace */
  122. { "ck", 0, 0, 0, 0 }, /* crt kill */
  123. { "ce", 0, 0, 0, 0 }, /* crt erase */
  124. { "pe", 0, 0, 0, 0 }, /* printer erase */
  125. { "rw", 1, 0, 0, 0 }, /* don't use raw */
  126. { "xc", 1, 0, 0, 0 }, /* don't ^X ctl chars */
  127. { "lc", 0, 0, 0, 0 }, /* terminal las lower case */
  128. { "uc", 0, 0, 0, 0 }, /* terminal has no lower case */
  129. { "ig", 0, 0, 0, 0 }, /* ignore garbage */
  130. { "ps", 0, 0, 0, 0 }, /* do port selector speed select */
  131. { "hc", 1, 0, 0, 0 }, /* don't set hangup on close */
  132. { "ub", 0, 0, 0, 0 }, /* unbuffered output */
  133. { "ab", 0, 0, 0, 0 }, /* auto-baud detect with '\r' */
  134. { "dx", 0, 0, 0, 0 }, /* set decctlq */
  135. { "np", 0, 0, 0, 0 }, /* no parity at all (8bit chars) */
  136. { "mb", 0, 0, 0, 0 }, /* do MDMBUF flow control */
  137. { "hw", 0, 0, 0, 0 }, /* do CTSRTS flow control */
  138. { "nc", 0, 0, 0, 0 }, /* set clocal (no carrier) */
  139. { "pl", 0, 0, 0, 0 }, /* use PPP instead of login(1) */
  140. { NULL, 0, 0, 0, 0 }
  141. };