summaryrefslogtreecommitdiff
path: root/nuttx/examples
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-03-10 14:42:28 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-03-10 14:42:28 +0000
commit506452c6fa4b7d408da0d332100f43a3102168ab (patch)
treebca4f4b7d50f699ff0c88572958ed38f6d747244 /nuttx/examples
parentebc734d8e40e310bc94bd8321a70ce1b8ef5d5a9 (diff)
downloadpx4-nuttx-506452c6fa4b7d408da0d332100f43a3102168ab.tar.gz
px4-nuttx-506452c6fa4b7d408da0d332100f43a3102168ab.tar.bz2
px4-nuttx-506452c6fa4b7d408da0d332100f43a3102168ab.zip
add apps/ dir
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3360 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/examples')
-rw-r--r--nuttx/examples/nsh/nsh_main.c33
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;
}