summaryrefslogtreecommitdiff
path: root/nuttx/netutils
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-09-02 23:04:10 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-09-02 23:04:10 +0000
commit9f60d09c6faaac732a62a188228a88321aad7368 (patch)
tree4404ee0e25d63abaad5e23b9aa8dce9ed6a9c8e9 /nuttx/netutils
parent8a2d54981a1c1ee6563f3444cffc1d2d4784156e (diff)
downloadpx4-nuttx-9f60d09c6faaac732a62a188228a88321aad7368.tar.gz
px4-nuttx-9f60d09c6faaac732a62a188228a88321aad7368.tar.bz2
px4-nuttx-9f60d09c6faaac732a62a188228a88321aad7368.zip
Add NSH ping command
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@870 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/netutils')
-rw-r--r--nuttx/netutils/uiplib/uiplib.c56
1 files changed, 33 insertions, 23 deletions
diff --git a/nuttx/netutils/uiplib/uiplib.c b/nuttx/netutils/uiplib/uiplib.c
index a60d5743b..4dd2e31da 100644
--- a/nuttx/netutils/uiplib/uiplib.c
+++ b/nuttx/netutils/uiplib/uiplib.c
@@ -46,33 +46,43 @@
#include <net/uip/uip.h>
#include <net/uip/uip-lib.h>
-unsigned char uiplib_ipaddrconv(char *addrstr, unsigned char *ipaddr)
+boolean uiplib_ipaddrconv(const char *addrstr, ubyte *ipaddr)
{
unsigned char tmp;
char c;
- unsigned char i, j;
+ unsigned char i;
+ unsigned char j;
tmp = 0;
- for(i = 0; i < 4; ++i) {
- j = 0;
- do {
- c = *addrstr;
- ++j;
- if(j > 4) {
- return 0;
- }
- if(c == '.' || c == 0) {
- *ipaddr = tmp;
- ++ipaddr;
- tmp = 0;
- } else if(c >= '0' && c <= '9') {
- tmp = (tmp * 10) + (c - '0');
- } else {
- return 0;
- }
- ++addrstr;
- } while(c != '.' && c != 0);
- }
- return 1;
+ for (i = 0; i < 4; ++i)
+ {
+ j = 0;
+ do
+ {
+ c = *addrstr;
+ ++j;
+ if (j > 4)
+ {
+ return FALSE;
+ }
+ if (c == '.' || c == 0)
+ {
+ *ipaddr = tmp;
+ ++ipaddr;
+ tmp = 0;
+ }
+ else if(c >= '0' && c <= '9')
+ {
+ tmp = (tmp * 10) + (c - '0');
+ }
+ else
+ {
+ return FALSE;
+ }
+ ++addrstr;
+ }
+ while(c != '.' && c != 0);
+ }
+ return TRUE;
}