summaryrefslogtreecommitdiff
path: root/apps/examples/discover/main.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-09-12 21:42:36 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-09-12 21:42:36 +0000
commit10b060ab7da0989ec6f4fe79d31a0a3a390dfd80 (patch)
tree00d05ed1e5e55ee705dc48e8d79b27c80b42faf8 /apps/examples/discover/main.c
parent6649286b2f4917b87ecdd790eba138aefcf2b210 (diff)
downloadnuttx-10b060ab7da0989ec6f4fe79d31a0a3a390dfd80.tar.gz
nuttx-10b060ab7da0989ec6f4fe79d31a0a3a390dfd80.tar.bz2
nuttx-10b060ab7da0989ec6f4fe79d31a0a3a390dfd80.zip
Suppress network configuration in discover example if it is an NSH built-in functin
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5139 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'apps/examples/discover/main.c')
-rw-r--r--apps/examples/discover/main.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/apps/examples/discover/main.c b/apps/examples/discover/main.c
index 619995186..d076deb11 100644
--- a/apps/examples/discover/main.c
+++ b/apps/examples/discover/main.c
@@ -87,6 +87,11 @@
int discover_main(int argc, char *argv[])
{
+ /* If this task is excecutated as an NSH built-in function, then the
+ * network has already been configured by NSH's start-up logic.
+ */
+
+#ifndef CONFIG_NSH_BUILTIN_APPS
struct in_addr addr;
#if defined(CONFIG_EXAMPLE_DISCOVER_DHCPC) || defined(CONFIG_EXAMPLE_DISCOVER_NOMAC)
uint8_t mac[IFHWADDRLEN];
@@ -168,7 +173,9 @@ int discover_main(int argc, char *argv[])
dhcpc_close(handle);
printf("IP: %s\n", inet_ntoa(ds.ipaddr));
}
-#endif
+
+#endif /* CONFIG_EXAMPLE_DISCOVER_DHCPC */
+#endif /* CONFIG_NSH_BUILTIN_APPS */
if (discover_start() < 0)
{