summaryrefslogtreecommitdiffstats
path: root/sbin/ifconfig/ifmedia.c
diff options
context:
space:
mode:
authorthomas <thomas@FreeBSD.org>2006-08-22 23:49:36 +0000
committerthomas <thomas@FreeBSD.org>2006-08-22 23:49:36 +0000
commit88bc308178f32730908aafd9ca30a259f7b5d420 (patch)
treef2b670cd318e729865502dc107e3252207cbb81b /sbin/ifconfig/ifmedia.c
parentdc5b14d7bc2a00293ad7e1e83a62790ac66a7f0b (diff)
downloadFreeBSD-src-88bc308178f32730908aafd9ca30a259f7b5d420.zip
FreeBSD-src-88bc308178f32730908aafd9ca30a259f7b5d420.tar.gz
(media_status): Factor common code between IFM_ETHER and IFM_ATM cases.
(print_media_word, print_media_word_ifconfig): Remove unnecessary goto following test for null desc. PR: bin/102354 Submitted by: Ricardo Nabinger Sanchez <rnsanchez@gmail.com> MFC after: 1 week
Diffstat (limited to 'sbin/ifconfig/ifmedia.c')
-rw-r--r--sbin/ifconfig/ifmedia.c30
1 files changed, 9 insertions, 21 deletions
diff --git a/sbin/ifconfig/ifmedia.c b/sbin/ifconfig/ifmedia.c
index 4f49bde..398f1b7 100644
--- a/sbin/ifconfig/ifmedia.c
+++ b/sbin/ifconfig/ifmedia.c
@@ -146,6 +146,7 @@ media_status(int s)
printf("\tstatus: ");
switch (IFM_TYPE(ifmr.ifm_active)) {
case IFM_ETHER:
+ case IFM_ATM:
if (ifmr.ifm_status & IFM_ACTIVE)
printf("active");
else
@@ -160,13 +161,6 @@ media_status(int s)
printf("no ring");
break;
- case IFM_ATM:
- if (ifmr.ifm_status & IFM_ACTIVE)
- printf("active");
- else
- printf("no carrier");
- break;
-
case IFM_IEEE80211:
/* XXX: Different value for adhoc? */
if (ifmr.ifm_status & IFM_ACTIVE)
@@ -692,14 +686,11 @@ print_media_word(int ifmw, int print_toptype)
/* Find subtype. */
desc = get_subtype_desc(ifmw, ttos);
- if (desc != NULL)
- goto got_subtype;
-
- /* Falling to here means unknown subtype. */
- printf("<unknown subtype>");
- return;
+ if (desc == NULL) {
+ printf("<unknown subtype>");
+ return;
+ }
- got_subtype:
if (print_toptype)
putchar(' ');
@@ -750,14 +741,11 @@ print_media_word_ifconfig(int ifmw)
/* Find subtype. */
desc = get_subtype_desc(ifmw, ttos);
- if (desc != NULL)
- goto got_subtype;
-
- /* Falling to here means unknown subtype. */
- printf("<unknown subtype>");
- return;
+ if (desc == NULL) {
+ printf("<unknown subtype>");
+ return;
+ }
- got_subtype:
printf("media %s", desc->ifmt_string);
desc = get_mode_desc(ifmw, ttos);
OpenPOWER on IntegriCloud