summaryrefslogtreecommitdiffstats
path: root/src/hostname/hostnamectl.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-05-07 20:56:05 +0200
committerLennart Poettering <lennart@poettering.net>2013-05-07 20:56:41 +0200
commitc0b21b9669a86a5e404b73865080494063ee8351 (patch)
treeb4c233f51b06068212d0b79208f956ae93711fa7 /src/hostname/hostnamectl.c
parenthostname: only suppress setting of pretty hostname if it is non-equal to the ... (diff)
downloadsystemd-c0b21b9669a86a5e404b73865080494063ee8351.tar.xz
systemd-c0b21b9669a86a5e404b73865080494063ee8351.zip
hostnamectl: suppress outputting of pretty hostname field in status if empty
Diffstat (limited to '')
-rw-r--r--src/hostname/hostnamectl.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/hostname/hostnamectl.c b/src/hostname/hostnamectl.c
index a1e1bd8443..064581a31c 100644
--- a/src/hostname/hostnamectl.c
+++ b/src/hostname/hostnamectl.c
@@ -79,14 +79,18 @@ static void print_status_info(StatusInfo *i) {
printf(" Static hostname: %s\n",
strna(i->static_hostname));
- if (!streq_ptr(i->hostname, i->static_hostname))
+ if (!isempty(i->pretty_hostname) &&
+ !streq_ptr(i->pretty_hostname, i->static_hostname))
+ printf(" Pretty hostname: %s\n",
+ strna(i->pretty_hostname));
+
+ if (!isempty(i->hostname) &&
+ !streq_ptr(i->hostname, i->static_hostname))
printf("Transient hostname: %s\n",
strna(i->hostname));
- printf(" Pretty hostname: %s\n"
- " Icon name: %s\n"
+ printf(" Icon name: %s\n"
" Chassis: %s\n",
- strna(i->pretty_hostname),
strna(i->icon_name),
strna(i->chassis));