]> git.sur5r.net Git - ngadmin/blobdiff - cli/com_name.c
Cli: refactor, change coding style
[ngadmin] / cli / com_name.c
index e561724db85454c62b968e7391c0a5a7d751ed0b..0e2524ab0b22b68bff22cb82d2dcb71cded89761 100644 (file)
@@ -2,69 +2,66 @@
 #include "commands.h"
 
 
-
-bool do_name_show (int nb UNUSED, const char **com UNUSED, struct ngadmin *nga) {
- const struct swi_attr *sa;
- if ( (sa=ngadmin_getCurrentSwitch(nga))==NULL ) {
-  printf("must be logged\n");
-  return false;
- }
- puts(sa->name);
- return true;
+bool do_name_show (int nb UNUSED, const char **com UNUSED, struct ngadmin *nga)
+{
+       const struct swi_attr *sa;
+       
+       
+       sa = ngadmin_getCurrentSwitch(nga);
+       if (sa == NULL) {
+               printf("must be logged\n");
+               return false;
+       }
+       
+       puts(sa->name);
+       
+       
+       return true;
 }
 
 
-
-bool do_name_set (int nb, const char **com, struct ngadmin *nga) {
- int i;
- const struct swi_attr *sa;
- if ( nb!=1 ) {
-  printf("Usage: name set <value>\n");
-  return false;
- }
- if ( (sa=ngadmin_getCurrentSwitch(nga))==NULL ) {
-  printf("must be logged\n");
-  return false;
- }
- i=ngadmin_setName(nga, com[0]);
- printErrCode(i);
- return true;
+bool do_name_set (int nb, const char **com, struct ngadmin *nga)
+{
+       int i;
+       const struct swi_attr *sa;
+       
+       
+       if (nb != 1) {
+               printf("Usage: name set <value>\n");
+               return false;
+       }
+       
+       sa = ngadmin_getCurrentSwitch(nga);
+       if (sa == NULL) {
+               printf("must be logged\n");
+               return false;
+       }
+       
+       i = ngadmin_setName(nga, com[0]);
+       printErrCode(i);
+       
+       
+       return true;
 }
 
 
-
-bool do_name_clear (int nb UNUSED, const char **com UNUSED, struct ngadmin *nga) {
- int i;
- const struct swi_attr *sa;
- if ( (sa=ngadmin_getCurrentSwitch(nga))==NULL ) {
-  printf("must be logged\n");
-  return false;
- }
- i=ngadmin_setName(nga, NULL);
- printErrCode(i);
- return true;
+bool do_name_clear (int nb UNUSED, const char **com UNUSED, struct ngadmin *nga)
+{
+       int i;
+       const struct swi_attr *sa;
+       
+       
+       sa = ngadmin_getCurrentSwitch(nga);
+       if (sa == NULL) {
+               printf("must be logged\n");
+               return false;
+       }
+       
+       i = ngadmin_setName(nga, NULL);
+       printErrCode(i);
+       
+       
+       return true;
 }