blob: be95b9b4b31fbaecb940b7f547488573984a12ef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
module Input where
import System.Environment
import System.IO
import System.Process
getInput :: Int -> IO [String]
getInput day = do
let fname = show day ++ ".in"
args <- getArgs
str <- case args of
["-"] -> getContents
[] -> readFile fname
["c"] -> readProcess "xsel" ["-bo"] ""
_ -> do
hPutStrLn stderr $ "WARNING: Unrecognised command-line parameters " ++ show args ++
", reading from " ++ fname
readFile fname
return (lines str)
|