summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2015-07-16 04:31:26 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2015-07-16 04:31:26 +0000
commit53489dec8c9153ebdcf2b454084c02c0299969ea (patch)
treee782a5d6e3d93a385d7bf7dd8775692fdb4dcadd
parente61d9fe38c1605011d615a88f2f2fc78cdd8c88d (diff)
remove ancient support for edited hostnames. ok deraadt (long ago)
-rw-r--r--libexec/getty/extern.h3
-rw-r--r--libexec/getty/main.c8
-rw-r--r--libexec/getty/subr.c42
3 files changed, 6 insertions, 47 deletions
diff --git a/libexec/getty/extern.h b/libexec/getty/extern.h
index f4601462eb0..e83d0c5120e 100644
--- a/libexec/getty/extern.h
+++ b/libexec/getty/extern.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: extern.h,v 1.5 2003/06/02 19:38:24 millert Exp $*/
+/* $OpenBSD: extern.h,v 1.6 2015/07/16 04:31:25 tedu Exp $*/
/*
* Copyright (c) 1993
@@ -36,7 +36,6 @@ struct delayval;
int adelay(int, struct delayval *);
char *autobaud(void);
int delaybits(void);
-void edithost(char *);
void gendefaults(void);
int getent(char *, char *);
int getflag(char *);
diff --git a/libexec/getty/main.c b/libexec/getty/main.c
index 24189db141c..bcbb73a5356 100644
--- a/libexec/getty/main.c
+++ b/libexec/getty/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.36 2015/04/14 02:24:17 millert Exp $ */
+/* $OpenBSD: main.c,v 1.37 2015/07/16 04:31:25 tedu Exp $ */
/*-
* Copyright (c) 1980, 1993
@@ -72,6 +72,7 @@ struct termios tmode, omode;
int crmod, digit, lower, upper;
char hostname[HOST_NAME_MAX+1];
+char globalhostname[HOST_NAME_MAX+1];
struct utsname kerninfo;
char name[LOGIN_NAME_MAX];
char dev[] = _PATH_DEV;
@@ -268,7 +269,7 @@ main(int argc, char *argv[])
}
if (CL && *CL)
putpad(CL);
- edithost(HE);
+ strlcpy(globalhostname, HN, sizeof(globalhostname));
if (IM && *IM)
putf(IM);
if (TO) {
@@ -532,7 +533,6 @@ prompt(void)
static void
putf(char *cp)
{
- extern char editedhost[];
char *slash, db[100];
time_t t;
@@ -552,7 +552,7 @@ putf(char *cp)
break;
case 'h':
- xputs(editedhost);
+ xputs(globalhostname);
break;
case 'd': {
diff --git a/libexec/getty/subr.c b/libexec/getty/subr.c
index 2e8633ddda3..cab1375e174 100644
--- a/libexec/getty/subr.c
+++ b/libexec/getty/subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr.c,v 1.22 2014/04/12 17:01:23 jsg Exp $ */
+/* $OpenBSD: subr.c,v 1.23 2015/07/16 04:31:25 tedu Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -391,46 +391,6 @@ adelay(int ms, struct delayval *dp)
}
#endif
-char editedhost[48];
-
-void
-edithost(char *pat)
-{
- char *host = HN;
- char *res = editedhost;
-
- if (!pat)
- pat = "";
- while (*pat) {
- switch (*pat) {
-
- case '#':
- if (*host)
- host++;
- break;
-
- case '@':
- if (*host)
- *res++ = *host++;
- break;
-
- default:
- *res++ = *pat;
- break;
-
- }
- if (res == &editedhost[sizeof editedhost - 1]) {
- *res = '\0';
- return;
- }
- pat++;
- }
- if (*host)
- strlcpy(res, host, sizeof editedhost - (res - editedhost));
- else
- *res = '\0';
-}
-
void
makeenv(char *env[])
{