]> gitweb.michael.orlitzky.com - dead/htnef.git/blob - src/htnef.hs
Initial commit.
[dead/htnef.git] / src / htnef.hs
1 --
2 -- htnef, a program to do things to TNEF files.
3 --
4 -- Copyright Michael Orlitzky
5 --
6 -- http://michael.orlitzky.com/
7 --
8 -- This program is free software: you can redistribute it and/or modify
9 -- it under the terms of the GNU General Public License as published by
10 -- the Free Software Foundation, either version 3 of the License, or
11 -- (at your option) any later version.
12 --
13 -- This program is distributed in the hope that it will be useful,
14 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
15 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 -- GNU General Public License for more details.
17 --
18 -- http://www.fsf.org/licensing/licenses/gpl.html
19
20 import Data.Binary
21 import System.Environment (getArgs)
22 import Tnef.File
23
24
25 -- Sequential IO
26 -- Perform x, ignoring the result.
27 -- Then return the result of doing the rest of the operations,
28 -- which will be a single IO (). This forces evaluation
29 -- of a list of IOs, i.e. [IO ()]
30 sequential_io :: [IO ()] -> IO ()
31 sequential_io [] = return ()
32 sequential_io (x:xs) = do
33 x
34 sequential_io xs
35
36
37 -- Decode whatever file is passed on the command line.
38 main :: IO ()
39 main = do
40 args <- getArgs
41 tf :: TnefFile <- decodeFile (args !! 0)
42 putStrLn (show tf) -- Dump the data...
43 sequential_io (write_tnef_file tf) -- And write the attachments
44