]> git.sur5r.net Git - ngadmin/blobdiff - cli/com_igmp.c
Remove Makefiles and use autotools
[ngadmin] / cli / com_igmp.c
index 3d57a03407ce21f6a27aef19d1d0e1963b9facb4..55e12da2c3b94068a0c7b90cb5853f8cd718e73c 100644 (file)
@@ -2,54 +2,59 @@
 #include "commands.h"
 
 
-bool do_igmp_set (int nb, const char **com, struct ngadmin *nga)
+int do_igmp_set (int argc, const char **argv, struct ngadmin *nga)
 {
        int i;
        struct igmp_conf ic;
        
        
-       if (nb != 4) {
-               printf("Usage: igmp set <enable> <vlan> <validate> <block>\n");
-               return false;
+       if (argc != 4) {
+               printf("usage: igmp set <enable> <vlan> <validate> <block>\n");
+               return 1;
        }
        
        if (ngadmin_getCurrentSwitch(nga) == NULL) {
                printf("must be logged\n");
-               return false;
+               return 1;
        }
        
-       ic.enable = strtol(com[0], NULL, 0);
-       ic.vlan = strtol(com[1], NULL, 0);
-       ic.validate = strtol(com[2], NULL, 0);
-       ic.block = strtol(com[3], NULL, 0);
+       ic.enable = strtol(argv[0], NULL, 0);
+       ic.vlan = strtol(argv[1], NULL, 0);
+       ic.validate = strtol(argv[2], NULL, 0);
+       ic.block = strtol(argv[3], NULL, 0);
        
        i = ngadmin_setIGMPConf(nga, &ic);
        printErrCode(i);
        
        
-       return true;
+       return 0;
 }
 
 
-bool do_igmp_show (int nb UNUSED, const char **com UNUSED, struct ngadmin *nga)
+int do_igmp_show (int argc, const char **argv UNUSED, struct ngadmin *nga)
 {
-       int i;
+       int i, ret = 0;
        const struct swi_attr *sa;
        struct igmp_conf ic;
-       bool ret = true;
        
        
-       sa=ngadmin_getCurrentSwitch(nga);
+       if (argc > 0) {
+               printf("this command takes no argument\n");
+               ret = 1;
+               goto end;
+       }
+       
+       sa = ngadmin_getCurrentSwitch(nga);
        if (sa == NULL) {
                printf("must be logged\n");
-               ret = false;
+               ret = 1;
                goto end;
        }
        
        i = ngadmin_getIGMPConf(nga, &ic);
        if (i != ERR_OK) {
                printErrCode(i);
-               ret = false;
+               ret = 1;
                goto end;
        }