]> git.sur5r.net Git - i3/i3status/commitdiff
Colorize ethernet output (patch by Peter Johnson)
authorMichael Stapelberg <michael@stapelberg.de>
Sun, 14 Feb 2010 11:49:03 +0000 (12:49 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Sun, 14 Feb 2010 11:49:03 +0000 (12:49 +0100)
src/print_eth_info.c

index 1da05029cd4a3a4603eaec91c34a3f9810bd3de5..9ad9b922e135e1c82144d9369c065c109ea76595 100644 (file)
@@ -79,8 +79,12 @@ void print_eth_info(const char *interface, const char *format_up, const char *fo
         const char *ip_address = get_ip_addr(interface);
 
         if (ip_address == NULL) {
+                printf("%s", color("#FF0000"));
                 printf("%s", format_down);
+                (void)printf("%s", endcolor());
                 return;
+        } else {
+                printf("%s", color("#00FF00"));
         }
 
         for (walk = format_up; *walk != '\0'; walk++) {
@@ -97,4 +101,6 @@ void print_eth_info(const char *interface, const char *format_up, const char *fo
                         walk += strlen("speed");
                 }
         }
+
+        (void)printf("%s", endcolor());
 }