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/04/19 14:07:17 UTC

[incubator-nuttx-apps] 03/09: nshlib: Reset NSH_NP_SET_OPTIONS_INIT in nsh_initscript

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 9dbdc73df6a199fe7d0fee365d5ad0ad953e5138
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Fri Apr 17 13:55:15 2020 +0800

    nshlib: Reset NSH_NP_SET_OPTIONS_INIT in nsh_initscript
    
    to ensure the reset get executed in all console implementation
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 nshlib/nsh_consolemain.c | 6 ------
 nshlib/nsh_script.c      | 6 ++++++
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/nshlib/nsh_consolemain.c b/nshlib/nsh_consolemain.c
index 5ff9f0e..e213c4c 100644
--- a/nshlib/nsh_consolemain.c
+++ b/nshlib/nsh_consolemain.c
@@ -96,12 +96,6 @@ int nsh_consolemain(int argc, char *argv[])
   /* Execute the start-up script */
 
   nsh_initscript(&pstate->cn_vtbl);
-
-#ifndef CONFIG_NSH_DISABLESCRIPT
-  /* Reset the option flags */
-
-  pstate->cn_vtbl.np.np_flags = NSH_NP_SET_OPTIONS_INIT;
-#endif
 #endif
 
 #ifdef CONFIG_NSH_NETINIT
diff --git a/nshlib/nsh_script.c b/nshlib/nsh_script.c
index cf77ef9..cf0d536 100644
--- a/nshlib/nsh_script.c
+++ b/nshlib/nsh_script.c
@@ -191,6 +191,12 @@ int nsh_initscript(FAR struct nsh_vtbl_s *vtbl)
     {
       ret = nsh_script(vtbl, "init", NSH_INITPATH);
 
+#ifndef CONFIG_NSH_DISABLESCRIPT
+      /* Reset the option flags */
+
+      vtbl->np.np_flags = NSH_NP_SET_OPTIONS_INIT;
+#endif
+
 #if defined(CONFIG_NSH_ARCHINIT) && defined(CONFIG_BOARDCTL_FINALINIT)
       /* Perform architecture-specific final-initialization (if configured) */