From: Lennart Poettering Date: Tue, 7 May 2013 18:56:05 +0000 (+0200) Subject: hostnamectl: suppress outputting of pretty hostname field in status if empty X-Git-Tag: v204~8 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=c0b21b9669a86a5e404b73865080494063ee8351 hostnamectl: suppress outputting of pretty hostname field in status if empty --- diff --git a/src/hostname/hostnamectl.c b/src/hostname/hostnamectl.c index a1e1bd844..064581a31 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));