X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2FMain.hs;h=25413cec9fdf024632911ac8e9a1dd169da83753;hb=e2cb918f1808f7f54cc742418050d49b424848c5;hp=a3b1bfe4a811faad00f6e8503b58de540bd8703f;hpb=6c671cd410b81257514e1be76ca3f252ea69ccdb;p=hath.git diff --git a/src/Main.hs b/src/Main.hs index a3b1bfe..25413ce 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -4,7 +4,15 @@ import System.IO (stderr, hPutStrLn) import Cidr (Cidr(..), cidr_from_string, - combine_all) + combine_all, + max_octet1, + max_octet2, + max_octet3, + max_octet4, + min_octet1, + min_octet2, + min_octet3, + min_octet4 ) import CommandLine (help_set, help_text, @@ -13,7 +21,6 @@ import CommandLine (help_set, parse_errors, parse_mode) -import IPv4Address import Octet -- Some exit codes, used in the ExitFailure constructor. @@ -54,14 +61,14 @@ cidr_to_regex cidr = range2 = numeric_range min2 max2 range3 = numeric_range min3 max3 range4 = numeric_range min4 max4 - min1 = octet_to_int (min_octet1 (ipv4address cidr) (maskbits cidr)) - min2 = octet_to_int (min_octet2 (ipv4address cidr) (maskbits cidr)) - min3 = octet_to_int (min_octet3 (ipv4address cidr) (maskbits cidr)) - min4 = octet_to_int (min_octet4 (ipv4address cidr) (maskbits cidr)) - max1 = octet_to_int (max_octet1 (ipv4address cidr) (maskbits cidr)) - max2 = octet_to_int (max_octet2 (ipv4address cidr) (maskbits cidr)) - max3 = octet_to_int (max_octet3 (ipv4address cidr) (maskbits cidr)) - max4 = octet_to_int (max_octet4 (ipv4address cidr) (maskbits cidr)) + min1 = octet_to_int (min_octet1 cidr) + min2 = octet_to_int (min_octet2 cidr) + min3 = octet_to_int (min_octet3 cidr) + min4 = octet_to_int (min_octet4 cidr) + max1 = octet_to_int (max_octet1 cidr) + max2 = octet_to_int (max_octet2 cidr) + max3 = octet_to_int (max_octet3 cidr) + max4 = octet_to_int (max_octet4 cidr) @@ -130,3 +137,12 @@ main = do return () where dupes = cidrs \\ (combine_all cidrs) + Diff -> do + mapM putStrLn deletions + mapM putStrLn additions + return () + where + dupes = cidrs \\ (combine_all cidrs) + deletions = map (\s -> "-" ++ (show s)) dupes + newcidrs = (combine_all cidrs) \\ cidrs + additions = map (\s -> "+" ++ (show s)) newcidrs