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

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

commit 898c1ce4d225b696af3dfb5cf3d9b13489b4eae1
Author: chao.an <[email protected]>
AuthorDate: Mon May 18 14:46:22 2020 +0800

    Revert "This critical behavior was broken by this commit:"
    
    This reverts commit 9b06b508f957ba1cc5b970d291bb5cc3277db237.
    
    Signed-off-by: chao.an <[email protected]>
---
 nshlib/nsh_parse.c | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/nshlib/nsh_parse.c b/nshlib/nsh_parse.c
index d5a6896..9b0bb2f 100644
--- a/nshlib/nsh_parse.c
+++ b/nshlib/nsh_parse.c
@@ -507,8 +507,8 @@ static int nsh_execute(FAR struct nsh_vtbl_s *vtbl,
    * 4. If not, report that the command was not found.
    */
 
-  /* Does this command correspond to an application filename?
-   * nsh_fileapp() returns:
+  /* Does this command correspond to a built-in command?
+   * nsh_builtin() returns:
    *
    *   -1 (ERROR)  if the application task corresponding to 'argv[0]' could
    *               not be started (possibly because it does not exist).
@@ -523,11 +523,15 @@ static int nsh_execute(FAR struct nsh_vtbl_s *vtbl,
    * Note the priority is not effected by nice-ness.
    */
 
-#ifdef CONFIG_NSH_FILE_APPS
-  ret = nsh_fileapp(vtbl, argv[0], argv, redirfile, oflags);
+#ifdef CONFIG_NSH_BUILTIN_APPS
+#if CONFIG_NFILE_STREAMS > 0
+  ret = nsh_builtin(vtbl, argv[0], argv, redirfile, oflags);
+#else
+  ret = nsh_builtin(vtbl, argv[0], argv, NULL, 0);
+#endif
   if (ret >= 0)
     {
-      /* nsh_fileapp() returned 0 or 1.  This means that the built-in
+      /* nsh_builtin() returned 0 or 1.  This means that the built-in
        * command was successfully started (although it may not have ran
        * successfully).  So certainly it is not an NSH command.
        */
@@ -537,15 +541,15 @@ static int nsh_execute(FAR struct nsh_vtbl_s *vtbl,
       return nsh_saveresult(vtbl, ret != OK);
     }
 
-  /* No, not a file name command (or, at least, we were unable to start a
-   * program of that name).  Maybe it is a built-in application or an NSH
-   * command.
+  /* No, not a built in command (or, at least, we were unable to start a
+   * built-in command of that name). Maybe it is a built-in application
+   * or an NSH command.
    */
 
 #endif
 
-  /* Does this command correspond to a built-in command?
-   * nsh_builtin() returns:
+  /* Does this command correspond to an application filename?
+   * nsh_fileapp() returns:
    *
    *   -1 (ERROR)  if the application task corresponding to 'argv[0]' could
    *               not be started (possibly because it doesn not exist).
@@ -560,15 +564,11 @@ static int nsh_execute(FAR struct nsh_vtbl_s *vtbl,
    * Note the priority is not effected by nice-ness.
    */
 
-#ifdef CONFIG_NSH_BUILTIN_APPS
-#if CONFIG_NFILE_STREAMS > 0
-  ret = nsh_builtin(vtbl, argv[0], argv, redirfile, oflags);
-#else
-  ret = nsh_builtin(vtbl, argv[0], argv, NULL, 0);
-#endif
+#ifdef CONFIG_NSH_FILE_APPS
+  ret = nsh_fileapp(vtbl, argv[0], argv, redirfile, oflags);
   if (ret >= 0)
     {
-      /* nsh_builtin() returned 0 or 1.  This means that the built-in
+      /* nsh_fileapp() returned 0 or 1.  This means that the built-in
        * command was successfully started (although it may not have ran
        * successfully).  So certainly it is not an NSH command.
        */
@@ -578,8 +578,8 @@ static int nsh_execute(FAR struct nsh_vtbl_s *vtbl,
       return nsh_saveresult(vtbl, ret != OK);
     }
 
-  /* No, not a built in command (or, at least, we were unable to start a
-   * built-in command of that name).  Treat it like an NSH command.
+  /* No, not a file name command (or, at least, we were unable to start a
+   * program of that name). Treat it like an NSH command.
    */
 
 #endif

Reply via email to