From a9c5dc21d3096a1791f28d022708cc1853e7c1af Mon Sep 17 00:00:00 2001 From: _ov4 Date: Wed, 2 Sep 2026 07:17:19 +0000 Subject: fix --- include/util/prompt.h | 1 - src/util/prompt.cc | 10 ++++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/util/prompt.h b/include/util/prompt.h index a9eae46..a99e933 100644 --- a/include/util/prompt.h +++ b/include/util/prompt.h @@ -9,7 +9,6 @@ namespace ov4 inline constexpr std::string_view prompt_normal = "$"; inline constexpr std::string_view prompt_root = "#"; -inline constexpr size_t hostname_size = 128; extern bool emit_prompt; void print_prompt(); diff --git a/src/util/prompt.cc b/src/util/prompt.cc index 6ba1ea9..08ff7e4 100644 --- a/src/util/prompt.cc +++ b/src/util/prompt.cc @@ -11,14 +11,16 @@ namespace ov4 { if (emit_prompt) { - char buffer[hostname_size]; - gethostname(buffer, hostname_size); + char hostname[MAXLINE]; + gethostname(hostname, MAXLINE); + char *user = getlogin(); + cout << make_color((string)name, ov4::color::bright_green) << " " - << make_color(getlogin(), ov4::color::bright_blue) + << make_color((user != nullptr ? user : "ov4"), ov4::color::bright_blue) << make_color("@", ov4::color::bright_blue) - << make_color(buffer, ov4::color::bright_blue) + << make_color(hostname, ov4::color::bright_blue) << ":" << make_color(get_current_dir(), ov4::color::bright_purple) << " " -- cgit v1.3.1-4-g156e