summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan K. Hubbard <jkh@FreeBSD.org>1995-08-01 13:12:24 +0000
committerJordan K. Hubbard <jkh@FreeBSD.org>1995-08-01 13:12:24 +0000
commit4d7ccc95b4bf48a643803845bf91e7ff6661f6ec (patch)
treecd2927fc137883a6d7553f4b065bedadba4b4827
parent156547674ac6a8ceef14d699802eefc82b262f3f (diff)
downloadsrc-test2-4d7ccc95b4bf48a643803845bf91e7ff6661f6ec.tar.gz
src-test2-4d7ccc95b4bf48a643803845bf91e7ff6661f6ec.zip
Notes
-rw-r--r--libexec/getty/gettytab.511
-rw-r--r--libexec/getty/main.c28
2 files changed, 35 insertions, 4 deletions
diff --git a/libexec/getty/gettytab.5 b/libexec/getty/gettytab.5
index db6b1cc641c4..834e979f1b51 100644
--- a/libexec/getty/gettytab.5
+++ b/libexec/getty/gettytab.5
@@ -220,10 +220,15 @@ and
.Em \&lm
may include the character sequence
.Em \&%h
-or
+to include the hostname,
.Em \&%t
-to obtain
-the hostname or tty name respectively.
+to obtain the tty name,
+.Em \&%s
+to obtain the OS type (FreeBSD),
+.Em \&%r
+to obtain the OS release string or
+.Em \&%m
+to obtain the machine architecture type.
.Pf ( Em %%
obtains a single '%' character.)
The hostname is normally obtained from the system,
diff --git a/libexec/getty/main.c b/libexec/getty/main.c
index a161ed54eb21..d0cf1b9dd162 100644
--- a/libexec/getty/main.c
+++ b/libexec/getty/main.c
@@ -56,6 +56,7 @@ static char sccsid[] = "@(#)main.c 5.16 (Berkeley) 3/27/91";
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/utsname.h>
#include "gettytab.h"
#include "pathnames.h"
@@ -454,6 +455,7 @@ putf(cp)
break;
case 'h':
+ case 'n':
puts(editedhost);
break;
@@ -464,8 +466,32 @@ putf(cp)
(void)time(&t);
(void)strftime(db, sizeof(db), fmt, localtime(&t));
puts(db);
- break;
}
+ break;
+
+ case 's': {
+ struct utsname name;
+
+ if (uname(&name) != -1)
+ puts(name.sysname);
+ }
+ break;
+
+ case 'r': {
+ struct utsname name;
+
+ if (uname(&name) != -1)
+ puts(name.release);
+ }
+ break;
+
+ case 'm': {
+ struct utsname name;
+
+ if (uname(&name) != -1)
+ puts(name.machine);
+ }
+ break;
case '%':
putchr('%');