]> git.sur5r.net Git - ngadmin/blobdiff - cli/com_tree.c
Fix crash when reading the wrong type of VLAN
[ngadmin] / cli / com_tree.c
index 200ac41eac9ac1eeb13297cfecacb3ca2684de7b..b1dadff42d840ca069e64cabda818f955df43d84 100644 (file)
@@ -2,41 +2,34 @@
 #include "commands.h"
 
 
-
-
-static void display_node (const struct TreeNode *tn, int depth) {
- int i;
- const struct TreeNode *s;
- for (i=0; i<depth; ++i) {
-  putchar('\t');
- }
- puts(tn->name);
- if ( tn->sub==NULL ) return;
- for (s=tn->sub; s->name!=NULL; ++s) {
-  display_node(s, depth+1);
- }
+static void display_node (const struct TreeNode *tn, int depth)
+{
+       int i;
+       const struct TreeNode *s;
+       
+       
+       for (i = 0; i < depth; i++)
+               putchar('\t');
+       puts(tn->name);
+       
+       if (tn->sub == NULL)
+               return;
+       
+       for (s = tn->sub; s->name != NULL; s++)
+               display_node(s, depth + 1);
 }
 
 
-
-bool do_tree (int nb UNUSED, const char **com UNUSED, struct ngadmin *nga UNUSED) {
- display_node(&coms, 0);
- return true;
+int do_tree (int argc, const char **argv UNUSED, struct ngadmin *nga UNUSED)
+{
+       if (argc > 0) {
+               printf("this command takes no argument\n");
+               return 1;
+       }
+       
+       display_node(&commands, 0);
+       
+       return 0;
 }
 
 
-
-