Author: gotar                        Date: Mon Nov  2 17:13:17 2009 GMT
Module: packages                      Tag: HEAD
---- Log message:
- from http://www.pc-tools.net/unix/grepcidr/contrib-tarreau/ altered not
  to conflict with regex.diff

---- Files affected:
packages/grepcidr:
   makefile.diff (NONE -> 1.1)  (NEW), find-anywhere.diff (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/grepcidr/makefile.diff
diff -u /dev/null packages/grepcidr/makefile.diff:1.1
--- /dev/null   Mon Nov  2 18:13:17 2009
+++ packages/grepcidr/makefile.diff     Mon Nov  2 18:13:12 2009
@@ -0,0 +1,12 @@
+diff -ru grepcidr-1.3/Makefile grepcidr-1.3-flx0.1/Makefile
+--- grepcidr-1.3/Makefile      2005-04-20 05:19:14.000000000 +0200
++++ grepcidr-1.3-flx0.1/Makefile       2005-06-06 14:57:25.000000000 +0200
+@@ -11,7 +11,7 @@
+ 
+ # End of settable values
+ 
+-grepcidr:
++grepcidr: grepcidr.c getopt.c
+       $(CC) $(CFLAGS) -o grepcidr grepcidr.c getopt.c
+ 
+ all:  grepcidr

================================================================
Index: packages/grepcidr/find-anywhere.diff
diff -u /dev/null packages/grepcidr/find-anywhere.diff:1.1
--- /dev/null   Mon Nov  2 18:13:17 2009
+++ packages/grepcidr/find-anywhere.diff        Mon Nov  2 18:13:12 2009
@@ -0,0 +1,45 @@
+--- ./grepcidr.c.orig  2005-06-06 15:16:09.000000000 +0200
++++ ./grepcidr.c       2005-06-06 15:19:15.000000000 +0200
+@@ -81,13 +81,38 @@
+       Convert IP address string to 32-bit integer version
+       Returns 0 on failure
+ */
+-unsigned int ip_to_uint(const char* ip)
++unsigned int ip_to_uint(char** ip)
+ {
+       unsigned int IP[4];     /* 4 octets for IP address */
+-      if ((sscanf(ip, "%u.%u.%u.%u", &IP[0], &IP[1], &IP[2], &IP[3]) == 4) && 
VALID_IP(IP))
++      char *p = *ip;
++      char *dot;
++
++      while (*p) {
++          while (*p && (*p < '0' || *p > '9'))
++              p++;
++          if (!*p)
++              break;
++
++          /* speedup: check if the first digits are followed by a dot */
++          dot = p + 1;
++          while (*dot >= '0' && *dot <='9')
++              dot++;
++          if (dot > p+3 || *dot != '.') {
++              p = dot;
++              continue;
++          }
++
++          if ((sscanf(p, "%u.%u.%u.%u", &IP[0], &IP[1], &IP[2], &IP[3]) == 4) 
&& VALID_IP(IP)) {
++              /* point to next possible integer */
++              while (*p >= '0' && *p <= '9')
++                  p++;
++              *ip = p;
+               return BUILD_IP(IP);
+-      else
+-              return 0;
++          }
++          p++;
++      }
++      *ip = p;
++      return 0;
+ }
+ 
+ 
================================================================
_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to