From 3b02e08dead9ef594043a98cc485ef125f38d6a4 Mon Sep 17 00:00:00 2001 From: smlng Date: Fri, 21 Oct 2016 21:32:11 +0200 Subject: [PATCH 1/2] shell: exclude hl and stats from usage if module not present --- sys/shell/commands/sc_netif.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/shell/commands/sc_netif.c b/sys/shell/commands/sc_netif.c index 42a724586a..ed1f7d296b 100644 --- a/sys/shell/commands/sc_netif.c +++ b/sys/shell/commands/sc_netif.c @@ -1220,10 +1220,14 @@ int _netif_config(int argc, char **argv) printf("usage: %s []\n", argv[0]); _set_usage(argv[0]); _mtu_usage(argv[0]); +#ifdef MODULE_GNRC_IPV6_NETIF _hl_usage(argv[0]); +#endif _flag_usage(argv[0]); _add_usage(argv[0]); _del_usage(argv[0]); +#ifdef MODULE_NETSTATS _stats_usage(argv[0]); +#endif return 1; } From 4c44a931b7d81b05fe46ecc0b1665c314c71512b Mon Sep 17 00:00:00 2001 From: smlng Date: Mon, 24 Oct 2016 19:52:15 +0200 Subject: [PATCH 2/2] shell, netstats: fix unused function error --- sys/shell/commands/sc_netif.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/shell/commands/sc_netif.c b/sys/shell/commands/sc_netif.c index ed1f7d296b..e3a254698b 100644 --- a/sys/shell/commands/sc_netif.c +++ b/sys/shell/commands/sc_netif.c @@ -73,7 +73,7 @@ static bool _is_iface(kernel_pid_t dev) return false; } -#if defined(MODULE_NETSTATS) +#ifdef MODULE_NETSTATS const char *_netstats_module_to_str(uint8_t module) { switch (module) { @@ -129,7 +129,7 @@ static int _netif_stats(kernel_pid_t dev, unsigned module, bool reset) } return res; } -#endif +#endif // MODULE_NETSTATS static void _set_usage(char *cmd_name) { @@ -160,10 +160,12 @@ static void _mtu_usage(char *cmd_name) printf("usage: %s mtu \n", cmd_name); } +#ifdef MODULE_GNRC_IPV6_NETIF static void _hl_usage(char *cmd_name) { printf("usage: %s hl \n", cmd_name); } +#endif static void _flag_usage(char *cmd_name) { @@ -182,11 +184,13 @@ static void _del_usage(char *cmd_name) cmd_name); } +#ifdef MODULE_NETSTATS static void _stats_usage(char *cmd_name) { printf("usage: %s stats [l2|ipv6] [reset]\n", cmd_name); puts(" reset can be only used if the module is specified."); } +#endif static void _print_netopt(netopt_t opt) {