Date: Fri, 6 Jan 1995 21:18:48 +0100 (MET) From: Ollivier Robert <roberto@blaise.ibp.fr> To: freebsd-hackers@FreeBSD.ORG (FreeBSD Hackers' list) Subject: Allowing the display of a /etc/issue-like file by getty. Message-ID: <199501062018.VAA00587@keltia.frmug.fr.net>
next in thread | raw e-mail | index | archive | help
[it was eaten by majordomo, so here it is again] I missed a feature a friend of mine put in getty back to the old 386BSD days in getty so I have put in into our getty back. It enables one to get a /etc/issue (for example) displayed by getty. One may use a issue file per gettytab entry. The new keyword is "if". ------------------------------------------------------------ T|supra.19200|supra-19200:\ :cb:ce:ck:sp#19200:ap:cs#8:xa:np:\ :if=/etc/issue.terminal:\ :im=\r\n\r\n*** Keltia\r\n Welcomes Thee!\r\n\r\n:\ :lm=\r\n%h login\72 : S|supra.38400|supra-38400:\ :cb:ce:ck:sp#38400:ap:cs#8:xa:np:hw:\ :if=/etc/issue.modem:\ :im=\r\n\r\n*** Keltia\r\n Welcomes Thee!\r\n\ \r\nFreeBSD unix, dialup access\r\n:lm=\r\n%h login\72 : ------------------------------------------------------------ The default is /etc/issue. Please someone have a look at this and hopefully commit it ? Thanks. Index: gettytab.5 =================================================================== RCS file: /spare/FreeBSD-current/src/libexec/getty/gettytab.5,v retrieving revision 1.2 diff -c -2 -r1.2 gettytab.5 *** 1.2 1994/08/26 05:19:11 --- gettytab.5 1995/01/05 19:36:20 *************** *** 116,119 **** --- 116,121 ---- .It "hn str hostname hostname" .It "ht bool false terminal has real tabs" + .It "if str" Ta Pa /etc/issue Ta + .No "file to display before login prompt" .It "ig bool false ignore garbage characters in login name" .It "im str" Ta Dv NULL Ta *************** *** 213,216 **** --- 215,224 ---- This delay is simulated by repeated use of the pad character .Em \&pc . + .Pp + The file specified by the + .Em \&if + string is displayed before the login prompt. By default, it tries to open + .Dq Pa /etc/issue . + With that feature, you can have a different banner per gettytab entry. .Pp The initial message, and login message, Index: gettytab.h =================================================================== RCS file: /spare/FreeBSD-current/src/libexec/getty/gettytab.h,v retrieving revision 1.2 diff -c -2 -r1.2 gettytab.h *** 1.2 1994/08/26 05:19:12 --- gettytab.h 1995/01/05 19:37:05 *************** *** 85,88 **** --- 85,92 ---- #define WE gettystrs[22].value #define LN gettystrs[23].value + /* + * capability for if=/etc/issue -type file + */ + #define IF gettystrs[24].value /* Index: init.c =================================================================== RCS file: /spare/FreeBSD-current/src/libexec/getty/init.c,v retrieving revision 1.2 diff -c -2 -r1.2 init.c *** 1.2 1994/08/26 05:19:13 --- init.c 1995/01/05 19:37:54 *************** *** 75,78 **** --- 75,79 ---- { "we", <c.t_werasc }, /* word erase */ { "ln", <c.t_lnextc }, /* literal next */ + { "if", _PATH_ISSUE }, /* issue file */ { 0 } }; Index: main.c =================================================================== RCS file: /spare/FreeBSD-current/src/libexec/getty/main.c,v retrieving revision 1.5 diff -c -2 -r1.5 main.c *** 1.5 1994/09/18 04:14:54 --- main.c 1995/01/05 19:41:32 *************** *** 72,75 **** --- 72,77 ---- }; + static void cat_issue_file (); + int crmod, digit, lower, upper; *************** *** 235,238 **** --- 237,246 ---- alarm(TO); } + /* display the file specified by capability if, default to /etc/issue */ + if (*(IF) != '\0') + cat_issue_file(IF); + else + cat_issue_file(_PATH_ISSUE); + if (getname()) { register int i; *************** *** 501,502 **** --- 509,533 ---- ioctl(0, TIOCLSET, &allflags); } + + /* displays the file specified */ + + static void + cat_issue_file(filen) + char * filen; + { + register int fd, nchars; + char tbuf[1]; + + if (access(filen, R_OK) < 0) /* file specified doesn't exists */ + return; + if ((fd = open(filen, O_RDONLY, 0)) < 0) + return; + while ((nchars = read(fd, tbuf, sizeof(tbuf))) > 0) { + if (*tbuf == '\n' ) + putchr('\r'); + putchr(*tbuf); + } + (void)close(fd); + puts("\r\n"); + } + Index: pathnames.h =================================================================== RCS file: /spare/FreeBSD-current/src/libexec/getty/pathnames.h,v retrieving revision 1.3 diff -c -2 -r1.3 pathnames.h *** 1.3 1994/08/26 05:19:15 --- pathnames.h 1995/01/05 19:41:48 *************** *** 38,39 **** --- 38,41 ---- #define _PATH_GETTYTAB "/etc/gettytab" #define _PATH_LOGIN "/usr/bin/login" + /* default banner file, override it with if=<filename> */ + #define _PATH_ISSUE "/etc/issue" -- Ollivier ROBERT -=- The daemon is FREE! -=- roberto@keltia.frmug.fr.net FreeBSD keltia 2.1.0-Development #1: Fri Jan 6 20:33:32 MET 1995
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199501062018.VAA00587>