You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
327 B
C

#include "scan.h"
#include "ip4.h"
unsigned int scan_ip4(const char *s,char ip[4])
{
unsigned int len;
unsigned long u;
int i;
len = 0;
for (i=0; i<4; ++i) {
register unsigned int j;
len+=(j=scan_ulong(s,&u))+1;
if (!j) return 0;
ip[i]=u; s+=j;
if (*s!='.') return 0; ++s;
}
return len-1;
}