summaryrefslogtreecommitdiff
path: root/src/print_eth_info.c
diff options
context:
space:
mode:
authorDmitrij D. Czarkoff <czarkoff@gmail.com>2015-08-06 17:14:38 +0200
committerDmitrij D. Czarkoff <czarkoff@gmail.com>2015-08-06 17:20:29 +0200
commit9b238a8d65c5fd444422a3f32ce98b6631c88377 (patch)
tree4da576ce5f15d9405bdfb73aebab4686208d0f2f /src/print_eth_info.c
parent15f2279592032af1507de09ef31eba81aee53191 (diff)
Use "color_degraded" when interface has no IP
On laptops one may want to have all interfaces up in order to let network prioritization manage switching between wired and wireless connection. In such cases lack of IP address is a useful hint about currently used interface, and color-coding makes it stand out more.
Diffstat (limited to 'src/print_eth_info.c')
-rw-r--r--src/print_eth_info.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/print_eth_info.c b/src/print_eth_info.c
index 06a1613..e2326b5 100644
--- a/src/print_eth_info.c
+++ b/src/print_eth_info.c
@@ -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 != '%') {