Mirror of :pserver:cvs@cvs.fefe.de:/cvs libowfat https://www.fefe.de/libowfat/
You can not 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
334 B

  1. #include "scan.h"
  2. #include "ip4.h"
  3. unsigned int scan_ip4(const char *s,char ip[4])
  4. {
  5. unsigned int len;
  6. unsigned long u;
  7. int i;
  8. len = 0;
  9. for (i=0; i<4; ++i) {
  10. register unsigned int j;
  11. len+=(j=scan_ulong(s,&u))+1;
  12. if (!j) return 0;
  13. ip[i]=u; s+=j;
  14. if (i<3 && *s!='.') return 0; ++s;
  15. }
  16. return len-1;
  17. }