You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/02/21 13:39:18 UTC
[incubator-nuttx-apps] branch pr82 updated: nsh/parse: try the
builtin configuration first
This is an automated email from the ASF dual-hosted git repository.
gnutt pushed a commit to branch pr82
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
The following commit(s) were added to refs/heads/pr82 by this push:
new 22a86ef nsh/parse: try the builtin configuration first
22a86ef is described below
commit 22a86ef79660901218fdd09c1a006f8241f0dc17
Author: chao.an <an...@xiaomi.com>
AuthorDate: Fri Feb 21 09:54:47 2020 +0800
nsh/parse: try the builtin configuration first
In the case of enable the BUILTIN_APPS/FILE_APPS at the same
time, try the builtin list first to ensure that the relevant
configuration(stacksize, priority) can be set normally.
Change-Id: Ib99b39f884dfc651f4e47481d366a27ff984717f
Signed-off-by: chao.an <an...@xiaomi.com>
---
nshlib/nsh_parse.c | 58 +++++++++++++++++++++++++++---------------------------
1 file changed, 29 insertions(+), 29 deletions(-)
diff --git a/nshlib/nsh_parse.c b/nshlib/nsh_parse.c
index f86c15d..ba6a795 100644
--- a/nshlib/nsh_parse.c
+++ b/nshlib/nsh_parse.c
@@ -503,27 +503,31 @@ static int nsh_execute(FAR struct nsh_vtbl_s *vtbl,
#endif
int ret;
- /* 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).
+ * -1 (ERROR) if the application task corresponding to 'argv[0]' could
+ * not be started (possibly because it doesn not exist).
* 0 (OK) if the application task corresponding to 'argv[0]' was
* and successfully started. If CONFIG_SCHED_WAITPID is
* defined, this return value also indicates that the
* application returned successful status (EXIT_SUCCESS)
* 1 If CONFIG_SCHED_WAITPID is defined, then this return value
- * indicates that the application task was spawned successfully
- * but returned failure exit status.
+ * indicates that the application task was spawned
+ * successfully but returned failure exit status.
*
- * Note the priority is not effected by nice-ness.
+ * Note the priority if 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.
*/
@@ -533,38 +537,34 @@ 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).
+ * -1 (ERROR) if the application task corresponding to 'argv[0]' could
+ * not be started (possibly because it does not exist).
* 0 (OK) if the application task corresponding to 'argv[0]' was
* and successfully started. If CONFIG_SCHED_WAITPID is
* defined, this return value also indicates that the
* application returned successful status (EXIT_SUCCESS)
* 1 If CONFIG_SCHED_WAITPID is defined, then this return value
- * indicates that the application task was spawned successfully
- * but returned failure exit status.
+ * indicates that the application task was spawned
+ * successfully but returned failure exit status.
*
- * Note the priority if not effected by nice-ness.
+ * 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.
*/
@@ -574,8 +574,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