Skip to content

Commit

Permalink
* Add simple TLE extractor
Browse files Browse the repository at this point in the history
  • Loading branch information
audreyt committed Aug 9, 2013
1 parent a5f22dd commit 354b3b7
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions afp-tledump.hs
@@ -0,0 +1,20 @@
module Main where
import OpenAFP
import System.Exit
import Data.Char (isDigit, isAlphaNum)
import Data.List (find)
import qualified Data.ByteString.Char8 as C

main :: IO ()
main = do
args <- getArgs
if null args then error "Usage: afp-tledump file.afp" else do
let (inFile:_) = args
cs <- readAFP inFile
forM_ (filter (~~ _TLE) cs) $ \tle -> do
let Just (fqn:av:_) = tle_Chunks `applyToChunk` tle
Just key = t_fqn `applyToChunk` fqn
Just val = t_av `applyToChunk` av
putStr (fromAStr key)
putStr "="
putStrLn (fromAStr val)

0 comments on commit 354b3b7

Please sign in to comment.