]> git.sur5r.net Git - ngadmin/blobdiff - cli/com_cabletest.c
Remove Makefiles and use autotools
[ngadmin] / cli / com_cabletest.c
index f23763f9e9ce0a898d79724c5a415f6483e7e9d9..b5dfab30bbd7bb0bb5a34fed9c13c61798f20be7 100644 (file)
@@ -2,32 +2,30 @@
 #include "commands.h"
 
 
-bool do_cabletest (int nb, const char **com, struct ngadmin *nga)
+int do_cabletest (int argc, const char **argv, struct ngadmin *nga)
 {
-       bool ret = true;
        const struct swi_attr *sa;
        struct cabletest *ct = NULL;
-       int i, j=0, k=0;
+       int i, j = 0, k = 0, ret = 0;
        
        
-       if (nb < 1) {
-               printf("Usage: cabletest <port1> [<port2> ...]\n");
+       if (argc < 1) {
+               printf("usage: cabletest <port1> [<port2> ...]\n");
                goto end;
        }
        
-       
        sa = ngadmin_getCurrentSwitch(nga);
        if (sa == NULL) {
                printf("must be logged\n");
-               ret = false;
+               ret = 1;
                goto end;
        }
        
        ct = malloc(sa->ports * sizeof(struct cabletest));
        memset(ct, 0, sa->ports * sizeof(struct cabletest));
        
-       while (k < nb) {
-               ct[j].port = strtol(com[k++], NULL, 0);
+       while (k < argc) {
+               ct[j].port = strtol(argv[k++], NULL, 0);
                if (ct[j].port >= 1 && ct[j].port <= sa->ports)
                        j++;
        }
@@ -35,7 +33,7 @@ bool do_cabletest (int nb, const char **com, struct ngadmin *nga)
        i = ngadmin_cabletest(nga, ct, j);
        if (i < 0) {
                printErrCode(i);
-               ret = false;
+               ret = 1;
                goto end;
        }