Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Oct 1995 17:32:48 +0100 (MET)
From:      Ollivier Robert <roberto@keltia.freenix.fr>
To:        freebsd-current@FreeBSD.ORG (FreeBSD Current Users' list)
Subject:   /etc/issue-like file for getty(8)
Message-ID:  <199510081632.RAA22600@keltia.freenix.fr>

next in thread | raw e-mail | index | archive | help
Here is a old patch from  a friend of mine  to put /etc/issue-like into our
getty.  This enables  one to put different  message for different  gettytab
capabilities (e.g.

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 2.2 unix, dialup access\r\n:lm=\r\n%h login\72 :

Index: gettytab.5
===================================================================
RCS file: /spare/FreeBSD-current/src/libexec/getty/gettytab.5,v
retrieving revision 1.5
diff -u -2 -r1.5 gettytab.5
--- 1.5	1995/08/03 05:44:45
+++ gettytab.5	1995/10/08 16:27:48
@@ -116,4 +116,6 @@
 .It "hn	str	hostname	hostname"
 .It "ht	bool	false	terminal has real tabs"
+.It "if	str" Ta Dv NULL Ta
+.No "file to be displayed before login banner"
 .It "ig	bool	false	ignore garbage characters in login name"
 .It "im	str" Ta Dv NULL Ta
Index: gettytab.h
===================================================================
RCS file: /spare/FreeBSD-current/src/libexec/getty/gettytab.h,v
retrieving revision 1.2
diff -u -2 -r1.2 gettytab.h
--- 1.2	1994/08/26 05:19:12
+++ gettytab.h	1995/10/08 16:12:39
@@ -85,4 +85,7 @@
 #define WE	gettystrs[22].value
 #define LN	gettystrs[23].value
+/* Addition fcb 6/3/93 Support d'une "Issue 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 -u -2 -r1.2 init.c
--- 1.2	1994/08/26 05:19:13
+++ init.c	1995/10/08 16:14:29
@@ -75,4 +75,6 @@
 	{ "we", &ltc.t_werasc },	/* word erase */
 	{ "ln", &ltc.t_lnextc },	/* literal next */
+/* Addition fcb 6/3/93 */
+	{ "if", ""}, /* Issue File name */
 	{ 0 }
 };
Index: main.c
===================================================================
RCS file: /spare/FreeBSD-current/src/libexec/getty/main.c,v
retrieving revision 1.8
diff -u -2 -r1.8 main.c
--- 1.8	1995/08/03 05:44:46
+++ main.c	1995/10/08 16:23:15
@@ -235,4 +235,10 @@
 			alarm(TO);
 		}
+/* fcb 6/3/93
+ * check for issue file (banner a la SysV)
+ */
+        if (*(IF)!='\0')
+            cat_issue_file();
+
 		if (getname()) {
 			register int i;
@@ -501,2 +507,29 @@
 	ioctl(0, TIOCLSET, &allflags);
 }
+
+/*
+ * Cat the specified file before the login banner. Allows a
+ * /etc/issue-like file per terminal
+ *
+ * fcb - 6/3/93
+ */
+void
+cat_issue_file()
+{
+	register int fd, nchars;
+	char tbuf[1];
+
+	if (access(IF,R_OK)<0)
+    	return;
+	if ((fd = open(IF, 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");
+}
+
+

-- 
Ollivier ROBERT    -=- The daemon is FREE! -=-    roberto@keltia.frmug.fr.net
   FreeBSD keltia.freenix.fr 2.2-CURRENT #2: Sat Oct  7 23:37:44 MET 1995



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199510081632.RAA22600>