]> git.sur5r.net Git - ngadmin/blobdiff - cli/com_ports.c
Let commands handle themselves absence of arguments
[ngadmin] / cli / com_ports.c
index 7c3fbb22b6ca6ec57764f311ef935bfb4bad760b..866a84b49a5413ecabafd77e8bc723ac64dd730d 100644 (file)
@@ -2,7 +2,7 @@
 #include "commands.h"
 
 
-bool do_ports_state (int nb UNUSED, const char **com UNUSED, struct ngadmin *nga)
+bool do_ports_state (int argc, const char **argv UNUSED, struct ngadmin *nga)
 {
        int i;
        const struct swi_attr *sa;
@@ -10,6 +10,12 @@ bool do_ports_state (int nb UNUSED, const char **com UNUSED, struct ngadmin *nga
        bool ret = true;
        
        
+       if (argc > 0) {
+               printf("this command takes no argument\n");
+               ret = false;
+               goto end;
+       }
+       
        sa = ngadmin_getCurrentSwitch(nga);
        if (sa == NULL) {
                printf("must be logged\n");
@@ -59,10 +65,16 @@ end:
 }
 
 
-bool do_ports_statistics_reset (int nb UNUSED, const char **com UNUSED, struct ngadmin *nga)
+bool do_ports_statistics_reset (int argc, const char **argv UNUSED, struct ngadmin *nga)
 {
        int i;
        
+       
+       if (argc > 0) {
+               printf("this command takes no argument\n");
+               return false;
+       }
+       
        if (ngadmin_getCurrentSwitch(nga) == NULL) {
                printf("must be logged\n");
                return false;
@@ -75,7 +87,7 @@ bool do_ports_statistics_reset (int nb UNUSED, const char **com UNUSED, struct n
 }
 
 
-bool do_ports_statistics_show (int nb UNUSED, const char **com UNUSED, struct ngadmin *nga)
+bool do_ports_statistics_show (int argc, const char **argv UNUSED, struct ngadmin *nga)
 {
        int i;
        const struct swi_attr *sa;
@@ -83,6 +95,12 @@ bool do_ports_statistics_show (int nb UNUSED, const char **com UNUSED, struct ng
        struct port_stats *ps = NULL;
        
        
+       if (argc > 0) {
+               printf("this command takes no argument\n");
+               ret = false;
+               goto end;
+       }
+       
        sa = ngadmin_getCurrentSwitch(nga);
        if (sa == NULL) {
                printf("must be logged\n");