summaryrefslogtreecommitdiff
path: root/apps/nshlib/nsh_netcmds.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-10-20 13:47:30 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-10-20 13:47:30 +0000
commit915c0105267a9685d3fa1bc915dc08bbb5883d55 (patch)
tree748852e6262da138e2481a706be911c0b548df57 /apps/nshlib/nsh_netcmds.c
parente67fe7912645818ff9f4f19481b64fe363f5d357 (diff)
downloadnuttx-915c0105267a9685d3fa1bc915dc08bbb5883d55.tar.gz
nuttx-915c0105267a9685d3fa1bc915dc08bbb5883d55.tar.bz2
nuttx-915c0105267a9685d3fa1bc915dc08bbb5883d55.zip
DNS fixes from Darcy Gong (part 1 of 2)
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5235 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'apps/nshlib/nsh_netcmds.c')
-rw-r--r--apps/nshlib/nsh_netcmds.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/apps/nshlib/nsh_netcmds.c b/apps/nshlib/nsh_netcmds.c
index cfea5a08a..e04dab123 100644
--- a/apps/nshlib/nsh_netcmds.c
+++ b/apps/nshlib/nsh_netcmds.c
@@ -51,6 +51,7 @@
#include <fcntl.h> /* Needed for open */
#include <libgen.h> /* Needed for basename */
#include <errno.h>
+#include <debug.h>
#include <nuttx/net/net.h>
#include <nuttx/clock.h>
@@ -80,6 +81,12 @@
# endif
#endif
+#ifdef CONFIG_HAVE_GETHOSTBYNAME
+# include <netdb.h>
+#else
+# include <apps/netutils/resolv.h>
+#endif
+
#include "nsh.h"
#include "nsh_console.h"
@@ -599,7 +606,7 @@ int cmd_ping(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
if (optind == argc-1)
{
staddr = argv[optind];
- if (!uiplib_ipaddrconv(staddr, (FAR unsigned char*)&ipaddr))
+ if (dns_gethostip(staddr, &ipaddr) < 0)
{
goto errout;
}
@@ -621,7 +628,11 @@ int cmd_ping(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
/* Loop for the specified count */
- nsh_output(vtbl, "PING %s %d bytes of data\n", staddr, DEFAULT_PING_DATALEN);
+ nsh_output(vtbl, "PING %d.%d.%d.%d %d bytes of data\n",
+ (ipaddr ) & 0xff, (ipaddr >> 8 ) & 0xff,
+ (ipaddr >> 16 ) & 0xff, (ipaddr >> 24 ) & 0xff,
+ DEFAULT_PING_DATALEN);
+
start = g_system_timer;
for (i = 1; i <= count; i++)
{