Lines 61-71
print_ether(const struct ether_addr *addr, const char *prefix)
Link Here
|
61 |
{ |
61 |
{ |
62 |
char *ether_format = ether_ntoa(addr); |
62 |
char *ether_format = ether_ntoa(addr); |
63 |
|
63 |
|
64 |
if (f_ether != NULL && strcmp(f_ether, "dash") == 0) { |
64 |
if (f_ether != NULL) { |
65 |
char *format_char; |
65 |
if (strcmp(f_ether, "dash") == 0) { |
66 |
|
66 |
char *format_char; |
67 |
while ((format_char = strchr(ether_format, ':')) != NULL) { |
67 |
|
68 |
*format_char = '-'; |
68 |
while ((format_char = strchr(ether_format, ':')) != NULL) { |
|
|
69 |
*format_char = '-'; |
70 |
} |
71 |
} else if (strcmp(f_ether, "dotted") == 0) { |
72 |
/* Indices 0 and 1 is kept as is. */ |
73 |
ether_format[ 2] = ether_format[ 3]; |
74 |
ether_format[ 3] = ether_format[ 4]; |
75 |
ether_format[ 4] = '.'; |
76 |
ether_format[ 5] = ether_format[ 6]; |
77 |
ether_format[ 6] = ether_format[ 7]; |
78 |
ether_format[ 7] = ether_format[ 9]; |
79 |
ether_format[ 8] = ether_format[10]; |
80 |
ether_format[ 9] = '.'; |
81 |
ether_format[10] = ether_format[12]; |
82 |
ether_format[11] = ether_format[13]; |
83 |
ether_format[12] = ether_format[15]; |
84 |
ether_format[13] = ether_format[16]; |
85 |
ether_format[14] = '\0'; |
69 |
} |
86 |
} |
70 |
} |
87 |
} |
71 |
printf("\t%s %s\n", prefix, ether_format); |
88 |
printf("\t%s %s\n", prefix, ether_format); |