diff options
author | Michael Stapelberg <michael@stapelberg.de> | 2009-10-16 20:14:40 +0200 |
---|---|---|
committer | Michael Stapelberg <michael@stapelberg.de> | 2009-10-16 20:14:40 +0200 |
commit | b88a55ffa6df3d6e48c5814171f6e8e42449b3e9 (patch) | |
tree | cbd5215aedc43a0bea7a92e87b0b3c8fe419f1b0 /src/print_eth_info.c | |
parent | cb9bab4255a19b201d5bb13220421e687866484d (diff) |
Implement format_up/format_down for ethernet
Diffstat (limited to 'src/print_eth_info.c')
-rw-r--r-- | src/print_eth_info.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/print_eth_info.c b/src/print_eth_info.c index 7624383..1da0502 100644 --- a/src/print_eth_info.c +++ b/src/print_eth_info.c @@ -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; |