{-# LANGUAGE OverloadedStrings #-}
module Main where
-import Prelude hiding (log, length, readFile)
-import Data.ByteString.Char8 (ByteString, readFile, unpack)
+import Prelude hiding (log, length, readFile, getContents)
+import Data.ByteString.Char8 (ByteString, getContents, readFile, unpack)
import System.Environment (getArgs)
import System.Exit (exitSuccess)
import System.Directory (doesFileExist)
usage = putStrLn "usage: functorrent torrent-file"
parse :: [String] -> IO ByteString
-parse [] = usage >> exit
+parse [] = getContents
parse [a] = do
fileExist <- doesFileExist a
if fileExist