diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-05-07 20:56:05 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-05-07 20:56:41 +0200 |
commit | c0b21b9669a86a5e404b73865080494063ee8351 (patch) | |
tree | b4c233f51b06068212d0b79208f956ae93711fa7 /src/hostname/hostnamectl.c | |
parent | hostname: only suppress setting of pretty hostname if it is non-equal to the ... (diff) | |
download | systemd-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.c | 12 |
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)); |