From 3364782614d5e4c9670574c8470a962da5072af1 Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Fri, 11 Sep 2015 13:13:55 +0200 Subject: [PATCH 1/2] shell: fix output for ifconfig --- sys/shell/commands/sc_netif.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/sys/shell/commands/sc_netif.c b/sys/shell/commands/sc_netif.c index e3f019e6a4..579437f089 100644 --- a/sys/shell/commands/sc_netif.c +++ b/sys/shell/commands/sc_netif.c @@ -229,17 +229,6 @@ static void _netif_list(kernel_pid_t dev) _print_netopt_state(state); } - printf("\n "); - - res = gnrc_netapi_get(dev, NETOPT_ADDRESS_LONG, 0, hwaddr, sizeof(hwaddr)); - - if (res >= 0) { - char hwaddr_str[res * 3]; - printf("Long HWaddr: "); - printf("%s ", gnrc_netif_addr_to_str(hwaddr_str, sizeof(hwaddr_str), - hwaddr, res)); - } - res = gnrc_netapi_get(dev, NETOPT_CSMA_RETRIES, 0, &u8, sizeof(u8)); if (res >= 0) { @@ -251,6 +240,20 @@ static void _netif_list(kernel_pid_t dev) printf("\n "); + res = gnrc_netapi_get(dev, NETOPT_ADDRESS_LONG, 0, hwaddr, sizeof(hwaddr)); + + if (res >= 0) { + char hwaddr_str[res * 3]; + printf("Long HWaddr: "); + printf("%s ", gnrc_netif_addr_to_str(hwaddr_str, sizeof(hwaddr_str), + hwaddr, res)); + linebreak = true; + } + + if (linebreak) { + printf("\n "); + } + res = gnrc_netapi_get(dev, NETOPT_PROMISCUOUSMODE, 0, &enable, sizeof(enable)); if ((res >= 0) && (enable == NETOPT_ENABLE)) { From 14ae02d76883d603260d385be8cca4010a535595 Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Fri, 11 Sep 2015 13:14:21 +0200 Subject: [PATCH 2/2] sc_netif: piggy-back some style fixes --- sys/shell/commands/sc_netif.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/shell/commands/sc_netif.c b/sys/shell/commands/sc_netif.c index 579437f089..2196fa692f 100644 --- a/sys/shell/commands/sc_netif.c +++ b/sys/shell/commands/sc_netif.c @@ -234,7 +234,7 @@ static void _netif_list(kernel_pid_t dev) if (res >= 0) { res = gnrc_netapi_get(dev, NETOPT_CSMA, 0, &enable, sizeof(enable)); if ((res >= 0) && (enable == NETOPT_ENABLE)) { - printf(" CSMA Retries: %" PRIu8 " ", *((uint8_t*) &u8)); + printf(" CSMA Retries: %" PRIu8 " ", *((uint8_t *) &u8)); } } @@ -246,7 +246,7 @@ static void _netif_list(kernel_pid_t dev) char hwaddr_str[res * 3]; printf("Long HWaddr: "); printf("%s ", gnrc_netif_addr_to_str(hwaddr_str, sizeof(hwaddr_str), - hwaddr, res)); + hwaddr, res)); linebreak = true; } @@ -327,7 +327,7 @@ static void _netif_list(kernel_pid_t dev) #ifdef MODULE_GNRC_IPV6_NETIF printf("Link type: %s", (entry->flags & GNRC_IPV6_NETIF_FLAGS_IS_WIRED) ? - "wired" : "wireless"); + "wired" : "wireless"); printf("\n "); for (int i = 0; i < GNRC_IPV6_NETIF_ADDR_NUMOF; i++) {