ifconfig(8): optimize -f ether:dash mode

Switch to the simplified while loop suggest by Aaron LI

Post commit review via: https://reviews.freebsd.org/rS301185#inline-232

Submitted by:	Aaron LI <aly@aaronly.me>
Sponsored by:	Klara Inc.
This commit is contained in:
Allan Jude 2020-06-26 16:20:34 +00:00
parent d9d09a7c99
commit d4be5ce558

View File

@ -74,10 +74,10 @@ link_status(int s __unused, const struct ifaddrs *ifa)
sdl->sdl_type == IFT_BRIDGE) && sdl->sdl_alen == ETHER_ADDR_LEN) {
ether_format = ether_ntoa((struct ether_addr *)LLADDR(sdl));
if (f_ether != NULL && strcmp(f_ether, "dash") == 0) {
for (format_char = strchr(ether_format, ':');
format_char != NULL;
format_char = strchr(ether_format, ':'))
while ((format_char = strchr(ether_format, ':')) !=
NULL) {
*format_char = '-';
}
}
printf("\tether %s\n", ether_format);
} else {