]> git.sur5r.net Git - ngadmin/blobdiff - cli/com_defaults.c
Command functions return int instead of bool
[ngadmin] / cli / com_defaults.c
index 5855332398b237a091b8924b94d0b8d6413fffe7..74ecfa5ff2d5eed05aaaf2451888b0bc93a726c1 100644 (file)
@@ -2,34 +2,37 @@
 #include "commands.h"
 
 
-
-bool do_defaults (int nb UNUSED, const char **com UNUSED, struct ngadmin *nga) {
- int i, ret=true;
- const struct swi_attr *sa;
- char line[16];
- if ( (sa=ngadmin_getCurrentSwitch(nga))==NULL ) {
-  printf("must be logged\n");
-  ret=false;
-  goto end;
- }
- printf("The switch settings will be CLEARED. Continue ? [y/N]: ");
- fflush(stdout);
- if ( fgets(line, sizeof(line), stdin)!=NULL && strcasecmp(line, "y\n")==0 ) {
-  i=ngadmin_defaults(nga);
-  printErrCode(i);
- }
- end:
- return ret;
+int do_defaults (int argc, const char **argv UNUSED, struct ngadmin *nga)
+{
+       int i, ret = 0;
+       const struct swi_attr *sa;
+       char line[16];
+       
+       
+       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 = 1;
+               goto end;
+       }
+       
+       printf("The switch settings will be CLEARED. Continue ? [y/N]: ");
+       fflush(stdout);
+       
+       if (fgets(line, sizeof(line), stdin) != NULL && strcasecmp(line, "y\n") == 0) {
+               i = ngadmin_defaults(nga);
+               printErrCode(i);
+       }
+       
+end:
+       
+       return ret;
 }