packages feed

nptools-0.2.2: getpin.hs

import System.Exit
import System.IO

unesc :: String -> String
unesc [] = []
unesc ('%':'2':'5':xs) = '%':unesc xs
unesc ('%':'0':'A':xs) = '\n':unesc xs
unesc (x:xs) = x:unesc xs

main :: IO ()
main = do hSetEncoding stdin utf8
          inp <- getContents
          case dropWhile p $ lines inp of
            ['D':' ':xs,"OK"] -> putStrLn (unesc xs)
            _ -> exitFailure
  where p ('D':' ':_) = False
        p _ = True