You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/12/31 12:54:10 UTC

[incubator-nuttx-apps] branch master updated: Fix incorrect argument count error message

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new 41ce7d4  Fix incorrect argument count error message
41ce7d4 is described below

commit 41ce7d40f663849414c34197504fe05b9ce012a3
Author: Norman Rasmussen <no...@rasmussen.co.za>
AuthorDate: Fri Dec 31 01:58:04 2021 -0800

    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.
---
 nshlib/nsh_codeccmd.c | 2 +-
 nshlib/nsh_fscmds.c   | 4 ++--
 nshlib/nsh_netcmds.c  | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/nshlib/nsh_codeccmd.c b/nshlib/nsh_codeccmd.c
index 17e8781..7f21acc 100644
--- a/nshlib/nsh_codeccmd.c
+++ b/nshlib/nsh_codeccmd.c
@@ -308,7 +308,7 @@ static int cmd_codecs_proc(FAR struct nsh_vtbl_s *vtbl, int argc,
     {
       sdata = argv[optind];
     }
-  else if (optind >= argc)
+  else if (optind < argc)
     {
       fmt = g_fmttoomanyargs;
       goto errout;
diff --git a/nshlib/nsh_fscmds.c b/nshlib/nsh_fscmds.c
index 42815d2..c92af53 100644
--- a/nshlib/nsh_fscmds.c
+++ b/nshlib/nsh_fscmds.c
@@ -1307,7 +1307,7 @@ int cmd_mkfatfs(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
           return ERROR;
         }
     }
-  else if (optind >= argc)
+  else if (optind < argc)
     {
       nsh_error(vtbl, g_fmttoomanyargs, argv[0]);
       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]);
     }
-  else if (optind >= argc)
+  else if (optind < argc)
     {
       fmt = g_fmttoomanyargs;
       goto errout_with_fmt;
diff --git a/nshlib/nsh_netcmds.c b/nshlib/nsh_netcmds.c
index 87465bc..8628008 100644
--- a/nshlib/nsh_netcmds.c
+++ b/nshlib/nsh_netcmds.c
@@ -1306,7 +1306,7 @@ int cmd_wget(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
     {
       url = argv[optind];
     }
-  else if (optind >= argc)
+  else if (optind < argc)
     {
       fmt = g_fmttoomanyargs;
       goto errout;