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:
parent
8ae3dd51b8
commit
525ed724f5
@ -74,10 +74,10 @@ link_status(int s __unused, const struct ifaddrs *ifa)
|
|||||||
sdl->sdl_type == IFT_BRIDGE) && sdl->sdl_alen == ETHER_ADDR_LEN) {
|
sdl->sdl_type == IFT_BRIDGE) && sdl->sdl_alen == ETHER_ADDR_LEN) {
|
||||||
ether_format = ether_ntoa((struct ether_addr *)LLADDR(sdl));
|
ether_format = ether_ntoa((struct ether_addr *)LLADDR(sdl));
|
||||||
if (f_ether != NULL && strcmp(f_ether, "dash") == 0) {
|
if (f_ether != NULL && strcmp(f_ether, "dash") == 0) {
|
||||||
for (format_char = strchr(ether_format, ':');
|
while ((format_char = strchr(ether_format, ':')) !=
|
||||||
format_char != NULL;
|
NULL) {
|
||||||
format_char = strchr(ether_format, ':'))
|
|
||||||
*format_char = '-';
|
*format_char = '-';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
printf("\tether %s\n", ether_format);
|
printf("\tether %s\n", ether_format);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user