summaryrefslogtreecommitdiffstats
path: root/usr.bin/login/login.c
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2002-06-28 04:59:39 +0000
committerache <ache@FreeBSD.org>2002-06-28 04:59:39 +0000
commitc59db05ae8ee8f954e58de461a063cdbe4a07d6b (patch)
tree25e4e033bd383a1f4812449d3b6dd15542e1c446 /usr.bin/login/login.c
parent77f855033353eca30df6d81de52ed74ce53a0175 (diff)
downloadFreeBSD-src-c59db05ae8ee8f954e58de461a063cdbe4a07d6b.zip
FreeBSD-src-c59db05ae8ee8f954e58de461a063cdbe4a07d6b.tar.gz
Overwrite "term" from login.conf(5) for any known TERM
Diffstat (limited to 'usr.bin/login/login.c')
-rw-r--r--usr.bin/login/login.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/usr.bin/login/login.c b/usr.bin/login/login.c
index 5c5664b..ab6f6d8 100644
--- a/usr.bin/login/login.c
+++ b/usr.bin/login/login.c
@@ -168,6 +168,7 @@ main(int argc, char *argv[])
char *p, *ttyn;
char tname[sizeof(_PATH_TTY) + 10];
char *arg0;
+ const char *tp;
const char *shell = NULL;
login_cap_t *lc = NULL;
pid_t pid;
@@ -529,7 +530,13 @@ main(int argc, char *argv[])
(void)setenv("SHELL", pwd->pw_shell, 1);
(void)setenv("HOME", pwd->pw_dir, 1);
- (void)setenv("TERM", stypeof(tty), 0);
+ /* Overwrite "term" from login.conf(5) for any known TERM */
+ if (term != NULL)
+ (void)setenv("TERM", term, 1);
+ else if ((tp = stypeof(tty)) != NULL)
+ (void)setenv("TERM", tp, 1);
+ else
+ (void)setenv("TERM", TERM_UNKNOWN, 0);
(void)setenv("LOGNAME", username, 1);
(void)setenv("USER", username, 1);
(void)setenv("PATH", rootlogin ? _PATH_STDPATH : _PATH_DEFPATH, 0);
@@ -849,7 +856,7 @@ stypeof(char *ttyid)
if (t != NULL && t->ty_type != NULL)
return (t->ty_type);
}
- return (TERM_UNKNOWN);
+ return (NULL);
}
void
OpenPOWER on IntegriCloud