]> gitweb.michael.orlitzky.com - dead/harbl.git/blobdiff - harbl-cli/src/Main.hs
Add a "new" exit code (shift them all, really) for a host being blacklisted.
[dead/harbl.git] / harbl-cli / src / Main.hs
index d2ac8d294ed7c0751f6d30df678e31d6759dff8f..7b28af57cacfd59327cf7ab7471f32a8eb5a3bc3 100644 (file)
@@ -1,3 +1,5 @@
+{-# LANGUAGE DoAndIfThenElse #-}
+
 module Main ( main )
 where
 
@@ -5,12 +7,13 @@ import Control.Monad ( liftM, when )
 import Data.Monoid ( (<>) )
 import Text.Parsec ( ParseError, parse )
 import System.Console.CmdArgs ( def )
-import System.Exit ( exitWith, ExitCode (ExitFailure) )
+import System.Exit ( exitSuccess, exitWith, ExitCode (ExitFailure) )
 import System.IO ( hPutStrLn, stderr )
 
 import CommandLine ( get_args )
 import Configuration ( Configuration(..), merge_optional )
 import ExitCodes (
+  exit_host_blacklisted,
   exit_no_hosts,
   exit_no_lists,
   exit_unparseable_host,
@@ -80,3 +83,6 @@ main = do
         Right hs -> do
           listings <- concatMapM (lookup_rbl ls) hs
           mapM_ (putStrLn . listing_message) listings
+          if null listings
+          then exitSuccess
+          else exitWith (ExitFailure exit_host_blacklisted)