diff options
Diffstat (limited to 'nuttx/examples/nsh')
-rw-r--r-- | nuttx/examples/nsh/nsh_main.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/nuttx/examples/nsh/nsh_main.c b/nuttx/examples/nsh/nsh_main.c index 9981ad073..a13c6dae0 100644 --- a/nuttx/examples/nsh/nsh_main.c +++ b/nuttx/examples/nsh/nsh_main.c @@ -55,6 +55,10 @@ # include <pthread.h> #endif +#ifdef CONFIG_EXAMPLES_NSH_BUILTIN_APPS +# include <nuttx/nuttapp.h> +#endif + #include "nsh.h" /**************************************************************************** @@ -487,6 +491,35 @@ static int nsh_execute(FAR struct nsh_vtbl_s *vtbl, int argc, char *argv[]) } } +#ifdef CONFIG_EXAMPLES_NSH_BUILTIN_APPS + if (handler == cmd_unrecognized) + { + /* Try to find command within pre-built application list. */ + + if ((ret = exec_nuttapp(cmd, argv)) < 0) + { + if (errno != ENOENT) + { + return -errno; + } + } + else + { + /* Is the background mode or foreground mode desired? */ +#if 0 + if (argc > 1 && strcmp(argv[argc-1], "&") == 0) + { + } + else + { + waitpid(ret, ); + } +#endif + return ret; + } + } +#endif + ret = handler(vtbl, argc, argv); return ret; } |