[Pkg-haskell-commits] [SCM] haskell-testpack branch, master, updated. debian/1.0.2-1-4-gb0d6b36

John Goerzen jgoerzen at complete.org
Fri Apr 23 15:03:52 UTC 2010


The following commit has been merged in the master branch:
commit f2c4195b49abd607a1da7da1afbd5b91ff66717b
Author: John Goerzen <jgoerzen at complete.org>
Date:   Tue Oct 11 01:46:54 2005 +0100

    Initial add of HeaderParser

diff --git a/MissingH/FileArchive/Tar/HeaderParser.hs b/MissingH/FileArchive/Tar/HeaderParser.hs
new file mode 100644
index 0000000..3900d6b
--- /dev/null
+++ b/MissingH/FileArchive/Tar/HeaderParser.hs
@@ -0,0 +1,76 @@
+{-
+Copyright (C) 2005 John Goerzen <jgoerzen at complete.org>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+-}
+
+{- |
+   Module     : MissingH.FileArchive.Tar.HeaderParser
+   Copyright  : Copyright (C) 2005 John Goerzen
+   License    : GNU GPL, version 2 or above
+
+   Maintainer : John Goerzen <jgoerzen at complete.org>
+   Stability  : provisional
+   Portability: portable
+
+Parser for tar-format headers.
+
+Copyright (c) 2005 John Goerzen, jgoerzen\@complete.org
+
+-}
+module MissingH.FileArchive.Tar.HeaderParser
+    (
+
+     )
+
+where
+
+import Text.ParserCombinators.Parsec
+import Data.Word
+import Numeric
+
+{- | The data structure representing the Tar header.  This occurs
+at the beginning of each 'Section'. -}
+data Header = 
+    UStar {
+           name :: String,
+           mode :: Int,
+           uid :: Int,
+           gid :: Int,
+           size :: Integer,
+           mtime :: Integer,
+           chksum :: Word32,
+           typeflag :: Char,
+           linkname :: String,
+           magic :: String,
+           version :: String,
+           uname :: String,
+           gname :: String,
+           devmajor :: Integer,
+           devminor :: Integer,
+           prefix :: String}
+    deriving (Eq, Show)
+
+parseHeader :: CharParser st ()
+parseHeader =
+    do name <- (slurp 100 >>= rchopstr)
+       return ()
+    where slurp n = count n anyChar
+          chopstr = takeWhile (\c -> c /= '\0')
+          rchopstr = return . chopstr
+          chopsstr = takeWhile (\c -> c /= ' ') . chopstr
+
+--          readoct = fst . head . readOct . chopsstr
+--         rreadoct = return . readoct
\ No newline at end of file

-- 
haskell-testpack



More information about the Pkg-haskell-commits mailing list