summaryrefslogtreecommitdiffstats
path: root/sbin/ifconfig/ifmedia.c
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2010-11-13 21:03:19 +0000
committermarius <marius@FreeBSD.org>2010-11-13 21:03:19 +0000
commit9bce6388337c5c2105a62f7e0608d1855dcac9ef (patch)
treed0ca159e383ab54db3226515239681e1eee3c073 /sbin/ifconfig/ifmedia.c
parentea07b9ff9f077d67a7a3bacc1f3e0a3beca8db81 (diff)
downloadFreeBSD-src-9bce6388337c5c2105a62f7e0608d1855dcac9ef.zip
FreeBSD-src-9bce6388337c5c2105a62f7e0608d1855dcac9ef.tar.gz
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
Diffstat (limited to 'sbin/ifconfig/ifmedia.c')
-rw-r--r--sbin/ifconfig/ifmedia.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sbin/ifconfig/ifmedia.c b/sbin/ifconfig/ifmedia.c
index bb95043..b805756 100644
--- a/sbin/ifconfig/ifmedia.c
+++ b/sbin/ifconfig/ifmedia.c
@@ -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);
}
}
}
OpenPOWER on IntegriCloud