]> git.sur5r.net Git - ngadmin/blobdiff - cli/com_list.c
Let commands handle themselves absence of arguments
[ngadmin] / cli / com_list.c
index 3c8eb8c976a9cba2bb403b7e38fa71179bd0d1ad..064690cde700eebe8010b8f47592c5c6d6ebc883 100644 (file)
@@ -1,26 +1,22 @@
 
-#include "common.h"
-
-
-
-
-static bool do_list (const struct TreeNode *tn UNUSED, int nb UNUSED, const char **com UNUSED, struct ngadmin *nga) {
- int n;
- const struct swi_attr *sa;
- sa=ngadmin_getSwitchTab(nga, &n);
- displaySwitchTab(sa, n);
- return true;
+#include "commands.h"
+
+
+bool do_list (int argc, const char **argv UNUSED, struct ngadmin *nga)
+{
+       int n;
+       const struct swi_attr *sa;
+       
+       
+       if (argc > 0) {
+               printf("this command takes no argument\n");
+               return false;
+       }
+       
+       sa = ngadmin_getSwitchTab(nga, &n);
+       displaySwitchTab(sa, n);
+       
+       return true;
 }
 
 
-
-const struct TreeNode com_list=COM("list", do_list, false, NULL);
-
-
-