]> git.sur5r.net Git - ngadmin/blobdiff - cli/com_restart.c
Cli: refactor, change coding style
[ngadmin] / cli / com_restart.c
index 8ad5845d04670c18cb5635c94755f1504379bb02..9c001d1aebc249c4ec6f9389aab498e665f139ec 100644 (file)
@@ -2,34 +2,31 @@
 #include "commands.h"
 
 
-
-bool do_restart (int nb UNUSED, const char **com UNUSED, struct ngadmin *nga UNUSED) {
- 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 will be restarted. Continue ? [y/N]: ");
- fflush(stdout);
- if ( fgets(line, sizeof(line), stdin)!=NULL && strcasecmp(line, "y\n")==0 ) {
-  i=ngadmin_restart(nga);
-  printErrCode(i);
- }
- end:
- return ret;
+bool do_restart (int nb UNUSED, const char **com UNUSED, struct ngadmin *nga UNUSED)
+{
+       int i, ret = true;
+       const struct swi_attr *sa;
+       char line[16];
+       
+       
+       sa = ngadmin_getCurrentSwitch(nga);
+       if (sa == NULL) {
+               printf("must be logged\n");
+               ret = false;
+               goto end;
+       }
+       
+       printf("The switch will be restarted. Continue ? [y/N]: ");
+       fflush(stdout);
+       
+       if (fgets(line, sizeof(line), stdin) != NULL && strcasecmp(line, "y\n") == 0) {
+               i = ngadmin_restart(nga);
+               printErrCode(i);
+       }
+       
+end:
+       
+       return ret;
 }