import Data.List
import Data.List.Split
import qualified Data.ByteString.Lazy as B
+import Control.Monad
#ifdef DEBUG
import Text.Printf
parseArgs :: [String] -> Bool -> IO ()
parseArgs ("-jar":jarpath:_) stdcp = do
- if not stdcp then addClassPath "./" else return ()
+ unless stdcp $ addClassPath "./"
addClassPathJAR jarpath
res <- readMainClass jarpath
case res of
parseArgs (('-':_):_) _ = error "Usage: mate [-cp|-classpath <cp1:cp2:..>] [<class-file> | -jar <jar-file>]"
-- first argument which isn't prefixed by '-' should be a class file
parseArgs (clspath:_) stdcp = do
- if not stdcp then addClassPath "./" else return ()
+ unless stdcp $ addClassPath "./"
let bclspath = B.pack $ map (fromIntegral . ord) clspath
cls <- getClassFile bclspath
executeMain bclspath cls