X-Git-Url: https://git.sur5r.net/?p=ngadmin;a=blobdiff_plain;f=cli%2Fcom_name.c;h=8e47878c0f27c4065cb692f1d01efc064dfda61f;hp=0e2524ab0b22b68bff22cb82d2dcb71cded89761;hb=ba1e16863bdedc5f52b077932aa7301ed14a0f06;hpb=8d96dbb186138459117b82268407c0fb45339e8f diff --git a/cli/com_name.c b/cli/com_name.c index 0e2524a..8e47878 100644 --- a/cli/com_name.c +++ b/cli/com_name.c @@ -2,11 +2,16 @@ #include "commands.h" -bool do_name_show (int nb UNUSED, const char **com UNUSED, struct ngadmin *nga) +bool do_name_show (int argc, const char **argv UNUSED, struct ngadmin *nga) { const struct swi_attr *sa; + if (argc > 0) { + printf("this command takes no argument\n"); + return false; + } + sa = ngadmin_getCurrentSwitch(nga); if (sa == NULL) { printf("must be logged\n"); @@ -20,14 +25,14 @@ bool do_name_show (int nb UNUSED, const char **com UNUSED, struct ngadmin *nga) } -bool do_name_set (int nb, const char **com, struct ngadmin *nga) +bool do_name_set (int argc, const char **argv, struct ngadmin *nga) { int i; const struct swi_attr *sa; - if (nb != 1) { - printf("Usage: name set \n"); + if (argc != 1) { + printf("usage: name set \n"); return false; } @@ -37,7 +42,7 @@ bool do_name_set (int nb, const char **com, struct ngadmin *nga) return false; } - i = ngadmin_setName(nga, com[0]); + i = ngadmin_setName(nga, argv[0]); printErrCode(i); @@ -45,12 +50,17 @@ bool do_name_set (int nb, const char **com, struct ngadmin *nga) } -bool do_name_clear (int nb UNUSED, const char **com UNUSED, struct ngadmin *nga) +bool do_name_clear (int argc, const char **argv UNUSED, struct ngadmin *nga) { int i; const struct swi_attr *sa; + if (argc > 0) { + printf("this command takes no argument\n"); + return false; + } + sa = ngadmin_getCurrentSwitch(nga); if (sa == NULL) { printf("must be logged\n");