git.gnu.io has moved to IP address 209.51.188.249 -- please double check where you are logging in.

Commit 0f38822c authored by Nikita Karetnikov's avatar Nikita Karetnikov

Decode before returning the result.

parent 3c0fbd5f
......@@ -365,6 +365,7 @@ executable SnowdriftSendmail
main-is: SnowdriftSendmail.hs
build-depends: base
, bytestring
, mime
test-suite test
type: exitcode-stdio-1.0
......
......@@ -2,13 +2,18 @@
module Main where
import qualified Data.ByteString.Char8 as C
import System.Environment (getArgs)
import System.IO (stdin)
import Data.Monoid ((<>))
import qualified Codec.MIME.QuotedPrintable as QuotedPrintable
import Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Char8 as C
import System.Environment (getArgs)
import System.IO (stdin)
import Data.Monoid ((<>))
main :: IO ()
main = getArgs >>= \case
[] -> C.hGetContents stdin >>= C.putStrLn
[file] -> C.hGetContents stdin >>= C.writeFile file
args -> error $ "invalid arguments: " <> unwords args
\ No newline at end of file
[] -> C.hGetContents stdin >>= C.putStrLn . decode
[file] -> C.hGetContents stdin >>= C.writeFile file . decode
args -> error $ "invalid arguments: " <> unwords args
decode :: ByteString -> ByteString
decode = C.pack . QuotedPrintable.decode . C.unpack
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment