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:
parent
ca2de62ea7
commit
97621d4661
1 changed files with 3 additions and 1 deletions
|
@ -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");
|
||||
|
|
Loading…
Add table
Reference in a new issue