]> git.sur5r.net Git - i3/i3status/blobdiff - src/print_eth_info.c
Fix FTBFS on kFreeBSD and Hurd: libiw is Linux-only
[i3/i3status] / src / print_eth_info.c
index 7624383b5f9e98c1e116168a7827b861e6f02e3d..1da05029cd4a3a4603eaec91c34a3f9810bd3de5 100644 (file)
@@ -74,11 +74,16 @@ static void print_eth_speed(const char *interface) {
  * Combines ethernet IP addresses and speed (if requested) for displaying
  *
  */
-void print_eth_info(const char *interface, const char *format) {
+void print_eth_info(const char *interface, const char *format_up, const char *format_down) {
         const char *walk;
         const char *ip_address = get_ip_addr(interface);
 
-        for (walk = format; *walk != '\0'; walk++) {
+        if (ip_address == NULL) {
+                printf("%s", format_down);
+                return;
+        }
+
+        for (walk = format_up; *walk != '\0'; walk++) {
                 if (*walk != '%') {
                         putchar(*walk);
                         continue;