summaryrefslogtreecommitdiffstats
path: root/crypto/telnet
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1998-12-16 06:01:33 +0000
committerpeter <peter@FreeBSD.org>1998-12-16 06:01:33 +0000
commitf3847d7306c4d9634b4205fb2f31c81f3b30df90 (patch)
treee98b6413d303d4ff77231394e3b452ff0073bdd6 /crypto/telnet
parentb21a9231aa152b6377e32b9b5adec91c3d4f07e1 (diff)
downloadFreeBSD-src-f3847d7306c4d9634b4205fb2f31c81f3b30df90.zip
FreeBSD-src-f3847d7306c4d9634b4205fb2f31c81f3b30df90.tar.gz
Old stuff from a source tree: copy (verbatum) the code to expand the
%s/%m in the default /etc/gettytab.
Diffstat (limited to 'crypto/telnet')
-rw-r--r--crypto/telnet/telnetd/utility.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/crypto/telnet/telnetd/utility.c b/crypto/telnet/telnetd/utility.c
index 4c9dec1..08ad0bb 100644
--- a/crypto/telnet/telnetd/utility.c
+++ b/crypto/telnet/telnetd/utility.c
@@ -36,11 +36,12 @@
static const char sccsid[] = "@(#)utility.c 8.4 (Berkeley) 5/30/95";
#endif
static const char rcsid[] =
- "$Id$";
+ "$Id: utility.c,v 1.3 1998/02/16 12:09:28 markm Exp $";
#endif /* not lint */
#ifdef __FreeBSD__
#include <locale.h>
+#include <sys/utsname.h>
#endif
#define PRINTOPTIONS
#include "telnetd.h"
@@ -471,11 +472,21 @@ putf(cp, where)
#else
extern char *strrchr();
#endif
+#ifdef __FreeBSD__
+ static struct utsname kerninfo;
+
+ if (!*kerninfo.sysname)
+ uname(&kerninfo);
+#endif
putlocation = where;
while (*cp) {
- if (*cp != '%') {
+ if (*cp =='\n') {
+ putstr("\r\n");
+ cp++;
+ continue;
+ } else if (*cp != '%') {
putchr(*cp++);
continue;
}
@@ -507,6 +518,24 @@ putf(cp, where)
putstr(db);
break;
+#ifdef __FreeBSD__
+ case 's':
+ putstr(kerninfo.sysname);
+ break;
+
+ case 'm':
+ putstr(kerninfo.machine);
+ break;
+
+ case 'r':
+ putstr(kerninfo.release);
+ break;
+
+ case 'v':
+ putstr(kerninfo.version);
+ break;
+#endif
+
case '%':
putchr('%');
break;
OpenPOWER on IntegriCloud