]> git.sur5r.net Git - ngadmin/blobdiff - cli/com_ports.c
Command functions return int instead of bool
[ngadmin] / cli / com_ports.c
index 866a84b49a5413ecabafd77e8bc723ac64dd730d..3337b435d3d2f9a8a22b0002bd095b98bcf6ef52 100644 (file)
@@ -2,24 +2,23 @@
 #include "commands.h"
 
 
-bool do_ports_state (int argc, const char **argv UNUSED, struct ngadmin *nga)
+int do_ports_state (int argc, const char **argv UNUSED, struct ngadmin *nga)
 {
-       int i;
+       int i, ret = 0;
        const struct swi_attr *sa;
        unsigned char *ports = NULL;
-       bool ret = true;
        
        
        if (argc > 0) {
                printf("this command takes no argument\n");
-               ret = false;
+               ret = 1;
                goto end;
        }
        
        sa = ngadmin_getCurrentSwitch(nga);
        if (sa == NULL) {
                printf("must be logged\n");
-               ret = false;
+               ret = 1;
                goto end;
        }
        
@@ -27,7 +26,7 @@ bool do_ports_state (int argc, const char **argv UNUSED, struct ngadmin *nga)
        i = ngadmin_getPortsStatus(nga, ports);
        if (i < 0) {
                printErrCode(i);
-               ret = false;
+               ret = 1;
                goto end;
        }
        
@@ -65,46 +64,45 @@ end:
 }
 
 
-bool do_ports_statistics_reset (int argc, const char **argv UNUSED, struct ngadmin *nga)
+int 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;
+               return 1;
        }
        
        if (ngadmin_getCurrentSwitch(nga) == NULL) {
                printf("must be logged\n");
-               return false;
+               return 1;
        }
        
        i = ngadmin_resetPortsStatistics(nga);
        printErrCode(i);
        
-       return true;
+       return 0;
 }
 
 
-bool do_ports_statistics_show (int argc, const char **argv UNUSED, struct ngadmin *nga)
+int do_ports_statistics_show (int argc, const char **argv UNUSED, struct ngadmin *nga)
 {
-       int i;
+       int i, ret = 0;
        const struct swi_attr *sa;
-       bool ret = true;
        struct port_stats *ps = NULL;
        
        
        if (argc > 0) {
                printf("this command takes no argument\n");
-               ret = false;
+               ret = 1;
                goto end;
        }
        
        sa = ngadmin_getCurrentSwitch(nga);
        if (sa == NULL) {
                printf("must be logged\n");
-               ret = false;
+               ret = 1;
                goto end;
        }
        
@@ -112,7 +110,7 @@ bool do_ports_statistics_show (int argc, const char **argv UNUSED, struct ngadmi
        i = ngadmin_getPortsStatistics(nga, ps);
        if (i < 0) {
                printErrCode(i);
-               ret = false;
+               ret = 1;
                goto end;
        }