diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-11-15 23:49:02 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-11-15 23:49:02 +0100 |
commit | e3aa71c38cbecb24e6333411ee19814796a5b1d0 (patch) | |
tree | 5ae80b4fcbf3bc4f93e3905cecab2fc40f1cb1da /src/util.c | |
parent | 96a8cbfae1b37cf0a9c0591bfef93f9de1561bc4 (diff) |
exec: automatically determine right TERM= setting based on tty name
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c index 7f9f2b36a2..fb2eea341c 100644 --- a/src/util.c +++ b/src/util.c @@ -3470,6 +3470,21 @@ void filter_environ(const char *prefix) { environ[j] = NULL; } +const char *default_term_for_tty(const char *tty) { + assert(tty); + + if (startswith(tty, "/dev/")) + tty += 5; + + if (startswith(tty, "tty") && + tty[3] >= '0' && tty[3] <= '9') + return "TERM=linux"; + + /* FIXME: Proper handling of /dev/console would be cool */ + + return "TERM=vt100-nav"; +} + static const char *const ioprio_class_table[] = { [IOPRIO_CLASS_NONE] = "none", [IOPRIO_CLASS_RT] = "realtime", |