commit a1c5ec76e0197538ff76d2eba9f6f22c2d7db566
parent f1f8a7eab6b4a5dcddb330de2c6e1601b66f9080
Author: dwzg <dennis@wtzg.de>
Date: Fri, 24 Apr 2020 10:30:48 +0200
Make get_terminal get the actual tty name
In tty, the variable $TERM simply contains the value "linux".
Make it that if "linux" is read from $TERM, it will get the actual name of the tty.
Tested in Arch and Debian tty
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/paleofetch.c b/paleofetch.c
@@ -326,6 +326,10 @@ static char *get_terminal() {
} else {
terminal_fallback:
strncpy(terminal, getenv("TERM"), BUF_SIZE); /* fallback to old method */
+ /* in tty, $TERM is simply returned as "linux"; in this case get actual tty name */
+ if (strcmp(terminal, "linux") == 0) {
+ strncpy(terminal, ttyname(STDIN_FILENO), BUF_SIZE);
+ }
}
return terminal;