1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-17 10:26:15 +00:00

When printing media with more than one media option set aggregate these

in a comma delimited list instead of repeating "mediaopt" for each one.
This matches how the options of the active media are printed with
print_media_word() and brings us in line what NetBSD does.

MFC after:	2 weeks
This commit is contained in:
Marius Strobl 2010-11-13 21:03:19 +00:00
parent c175c7deff
commit a84e1b3b24
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=215259

View File

@ -757,7 +757,7 @@ print_media_word_ifconfig(int ifmw)
{
struct ifmedia_description *desc;
struct ifmedia_type_to_subtype *ttos;
int i;
int seen_option = 0, i;
/* Find the top-level interface type. */
desc = get_toptype_desc(ifmw);
@ -792,7 +792,10 @@ print_media_word_ifconfig(int ifmw)
for (desc = ttos->options[i].desc;
desc->ifmt_string != NULL; desc++) {
if (ifmw & desc->ifmt_word) {
printf(" mediaopt %s", desc->ifmt_string);
if (seen_option == 0)
printf(" mediaopt ");
printf("%s%s", seen_option++ ? "," : "",
desc->ifmt_string);
}
}
}