Fix incorrect argument count error message

The `too many arguments` and `missing required argument(s)` messages
should be switched in order for the correct message to be shown to the
user.
This commit is contained in:
Norman Rasmussen 2021-12-31 01:58:04 -08:00 committed by Xiang Xiao
parent d1bcd2977c
commit 41ce7d40f6
3 changed files with 4 additions and 4 deletions

View File

@ -308,7 +308,7 @@ static int cmd_codecs_proc(FAR struct nsh_vtbl_s *vtbl, int argc,
{ {
sdata = argv[optind]; sdata = argv[optind];
} }
else if (optind >= argc) else if (optind < argc)
{ {
fmt = g_fmttoomanyargs; fmt = g_fmttoomanyargs;
goto errout; goto errout;

View File

@ -1307,7 +1307,7 @@ int cmd_mkfatfs(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
return ERROR; return ERROR;
} }
} }
else if (optind >= argc) else if (optind < argc)
{ {
nsh_error(vtbl, g_fmttoomanyargs, argv[0]); nsh_error(vtbl, g_fmttoomanyargs, argv[0]);
return ERROR; return ERROR;
@ -1426,7 +1426,7 @@ int cmd_mkrd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{ {
nsectors = (uint32_t)atoi(argv[optind]); nsectors = (uint32_t)atoi(argv[optind]);
} }
else if (optind >= argc) else if (optind < argc)
{ {
fmt = g_fmttoomanyargs; fmt = g_fmttoomanyargs;
goto errout_with_fmt; goto errout_with_fmt;

View File

@ -1306,7 +1306,7 @@ int cmd_wget(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{ {
url = argv[optind]; url = argv[optind];
} }
else if (optind >= argc) else if (optind < argc)
{ {
fmt = g_fmttoomanyargs; fmt = g_fmttoomanyargs;
goto errout; goto errout;