diff options
| author | _ov4 <ov4@ov4.org> | 2026-09-01 08:13:05 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-09-01 08:13:05 +0000 |
| commit | 3827fc4543f55ff33ed657625b68ca628917188c (patch) | |
| tree | c90a85a93b9457c3683b42a9bac390882e670455 /src/util | |
| parent | 9a09c0bfc5956ed57fa4c26f84babb6778fa8a34 (diff) | |
hostname support
Diffstat (limited to 'src/util')
| -rw-r--r-- | src/util/prompt.cc | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/util/prompt.cc b/src/util/prompt.cc index 8f4e5e1..977cb0b 100644 --- a/src/util/prompt.cc +++ b/src/util/prompt.cc @@ -10,7 +10,25 @@ namespace ov4 { if (emit_prompt) { - cout << name << " : " << get_current_dir() << " " << prompt << " " << flush; + char buffer[hostname_size]; + gethostname(buffer, hostname_size); + cout + << name + << " " + << getlogin() + << "@" + << buffer + << ":" + << get_current_dir() + << " " + << get_prompt() + << " " + << flush; } } + + string get_prompt() + { + return (string)((string)(getlogin()) == "root" ? prompt_root : prompt_normal); + } } |
