Merge pull request #50 from czarkoff/no_ip

Use "color_degraded" when interface has no IP
This commit is contained in:
Michael Stapelberg 2015-08-06 18:18:19 +02:00
commit 6d634b1b67
2 changed files with 5 additions and 2 deletions

View File

@ -126,7 +126,10 @@ void print_eth_info(yajl_gen json_gen, char *buffer, const char *interface, cons
goto out;
}
START_COLOR("color_good");
if (BEGINS_WITH(ip_address, "no IP"))
START_COLOR("color_degraded");
else
START_COLOR("color_good");
for (walk = format_up; *walk != '\0'; walk++) {
if (*walk != '%') {

View File

@ -342,7 +342,7 @@ void print_wireless_info(yajl_gen json_gen, char *buffer, const char *interface,
if (info.flags & WIRELESS_INFO_FLAG_HAS_QUALITY)
START_COLOR((info.quality < info.quality_average ? "color_degraded" : "color_good"));
else
START_COLOR("color_good");
START_COLOR((BEGINS_WITH(ip_address, "no IP") ? "color_degraded" : "color_good"));
} else {
walk = format_down;
START_COLOR("color_bad");