1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00

Use getlogin(3) in the shell instead of the USERNAME variable.

This commit is contained in:
Jonas 'Sortie' Termansen 2013-10-02 11:03:07 +02:00
parent ca2de62ea7
commit 97621d4661

View file

@ -296,7 +296,9 @@ int get_and_run_command(FILE* fp, const char* fpname, bool interactive,
| TERMMODE_LINEBUFFER
| TERMMODE_ECHO;
settermmode(fd, termmode);
const char* print_username = getenv_safe("USERNAME", "root");
const char* print_username = getlogin();
if ( !print_username )
print_username = getuid() == 0 ? "root" : "?";
const char* print_hostname = getenv_safe("HOSTNAME", "sortix");
const char* print_dir = getenv_safe("PWD", "?");
const char* home_dir = getenv_safe("HOME", "/root");