From 6da9b2b160f14e6e2fe0ddd5e6f66e319cbd981b Mon Sep 17 00:00:00 2001 From: "Joseph C. Lehner" Date: Sun, 7 Feb 2016 21:06:09 +0100 Subject: [PATCH] Prettify -L output --- ethsock.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ethsock.c b/ethsock.c index e2a6c95..caadf4c 100644 --- a/ethsock.c +++ b/ethsock.c @@ -446,8 +446,8 @@ int ethsock_list_all(void) memset(hwaddr, 0, 6); for (dev = devs; dev; dev = dev->next) { - if (!is_ethernet(dev->name)) { - if (verbosity > 1) { + if (!is_ethernet(dev->name) || dev->flags & PCAP_IF_LOOPBACK) { + if (verbosity) { printf("%s (not an ethernet device)\n", dev->name); } @@ -455,7 +455,7 @@ int ethsock_list_all(void) } if (!get_hwaddr(hwaddr, dev->name)) { - if (verbosity > 1) { + if (verbosity) { printf("%s (failed to get hardware address)\n", dev->name); } @@ -463,7 +463,7 @@ int ethsock_list_all(void) } #ifndef NMRPFLASH_WINDOWS - printf("%s", dev->name); + printf("%-15s", dev->name); #else /* Call this here so *_perror() calls don't happen within a line */ pretty = intf_get_pretty_name(dev->name); @@ -477,14 +477,14 @@ int ethsock_list_all(void) for (addr = dev->addresses; addr; addr = addr->next) { if (addr->addr->sa_family == AF_INET) { - printf(" %15s", + printf(" %-15s", inet_ntoa(((struct sockaddr_in*)addr->addr)->sin_addr)); break; } } if (!addr) { - printf(" "); + printf(" %-15s", "0.0.0.0"); } printf(" %02x:%02x:%02x:%02x:%02x:%02x", hwaddr[0], hwaddr[1], -- 2.25.1