diff options
author | ache <ache@FreeBSD.org> | 2002-06-28 04:59:39 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 2002-06-28 04:59:39 +0000 |
commit | c59db05ae8ee8f954e58de461a063cdbe4a07d6b (patch) | |
tree | 25e4e033bd383a1f4812449d3b6dd15542e1c446 | |
parent | 77f855033353eca30df6d81de52ed74ce53a0175 (diff) | |
download | FreeBSD-src-c59db05ae8ee8f954e58de461a063cdbe4a07d6b.zip FreeBSD-src-c59db05ae8ee8f954e58de461a063cdbe4a07d6b.tar.gz |
Overwrite "term" from login.conf(5) for any known TERM
-rw-r--r-- | usr.bin/login/login.c | 11 |
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 |