diff options
author | Joe Crayne <joe@jerkface.net> | 2019-07-06 17:33:40 -0400 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2019-07-06 17:33:40 -0400 |
commit | b7da6a23a4ae94e8ce376376df77401ee779f028 (patch) | |
tree | b126cf0b6bc6cb0fb6e383409f35430a32fe58bf /lib | |
parent | b1ae1ecdc9d1f16134ea40b07a6cedcc26a94db8 (diff) |
sigs
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CommandLine.hs | 2 | ||||
-rw-r--r-- | lib/Hosts.hs | 4 | ||||
-rw-r--r-- | lib/PEM.hs | 2 |
3 files changed, 8 insertions, 0 deletions
diff --git a/lib/CommandLine.hs b/lib/CommandLine.hs index 55b77b3..ea5d6b8 100644 --- a/lib/CommandLine.hs +++ b/lib/CommandLine.hs | |||
@@ -286,6 +286,7 @@ vanilla flags = ArgsStyle { parseInvocation = parse flags } | |||
286 | -- | 286 | -- |
287 | -- * default polyvariadic - Implicit polyvariadic option if no other option is specified. | 287 | -- * default polyvariadic - Implicit polyvariadic option if no other option is specified. |
288 | -- | 288 | -- |
289 | fancy :: [([Char], Int)] -> [[Char]] -> [Char] -> ArgsStyle | ||
289 | fancy sargspsec polyVariadicArgs defaultPoly = ArgsStyle | 290 | fancy sargspsec polyVariadicArgs defaultPoly = ArgsStyle |
290 | { parseInvocation = parse sargspsec polyVariadicArgs defaultPoly } | 291 | { parseInvocation = parse sargspsec polyVariadicArgs defaultPoly } |
291 | where | 292 | where |
@@ -436,6 +437,7 @@ sortOn f = | |||
436 | #endif | 437 | #endif |
437 | #endif | 438 | #endif |
438 | 439 | ||
440 | removeIntersection :: Ord a => [a] -> [a] -> ([a], [a]) | ||
439 | removeIntersection (x:xs) (y:ys) | 441 | removeIntersection (x:xs) (y:ys) |
440 | | x == y = removeIntersection xs ys | 442 | | x == y = removeIntersection xs ys |
441 | | x < y = first (x :) $ removeIntersection xs (y:ys) | 443 | | x < y = first (x :) $ removeIntersection xs (y:ys) |
diff --git a/lib/Hosts.hs b/lib/Hosts.hs index 5f09de1..0f1d9a6 100644 --- a/lib/Hosts.hs +++ b/lib/Hosts.hs | |||
@@ -162,6 +162,7 @@ chaddr n addr hosts = | |||
162 | where oo = (.) . (.) | 162 | where oo = (.) . (.) |
163 | (a,ws') = splitAt 2 ws | 163 | (a,ws') = splitAt 2 ws |
164 | 164 | ||
165 | isLonerName :: L.ByteString -> Bool | ||
165 | isLonerName line = length ws' <= 2 | 166 | isLonerName line = length ws' <= 2 |
166 | where (x,_) = L.break (=='#') line | 167 | where (x,_) = L.break (=='#') line |
167 | ws = L.groupBy ( (==EQ) `oo` comparing isSpace) x | 168 | ws = L.groupBy ( (==EQ) `oo` comparing isSpace) x |
@@ -186,12 +187,15 @@ cannonizeName name line = scrubName f line | |||
186 | where | 187 | where |
187 | (pre,rst) = break (==name) ws | 188 | (pre,rst) = break (==name) ws |
188 | 189 | ||
190 | removeName :: L.ByteString -> Hosts -> Hosts | ||
189 | removeName name hosts = hosts' | 191 | removeName name hosts = hosts' |
190 | where | 192 | where |
191 | hosts' = scrubTrailingEmpties (maybe hosts (removeName0 name hosts) ns) | 193 | hosts' = scrubTrailingEmpties (maybe hosts (removeName0 name hosts) ns) |
192 | ns = Map.lookup name (namenum hosts) | 194 | ns = Map.lookup name (namenum hosts) |
193 | 195 | ||
194 | 196 | ||
197 | removeName0 :: Foldable t => | ||
198 | L.ByteString -> Hosts -> t Int -> Hosts | ||
195 | removeName0 name hosts nums = hosts | 199 | removeName0 name hosts nums = hosts |
196 | { namenum = Map.delete name (namenum hosts) | 200 | { namenum = Map.delete name (namenum hosts) |
197 | , numline = foldl' scrub (numline hosts) nums | 201 | , numline = foldl' scrub (numline hosts) nums |
@@ -20,6 +20,8 @@ data PEMBlob = PEMBlob { pemType :: L.ByteString | |||
20 | } | 20 | } |
21 | deriving (Eq,Show) | 21 | deriving (Eq,Show) |
22 | 22 | ||
23 | pemParser :: Maybe L.ByteString | ||
24 | -> ScanningParser L.ByteString PEMBlob | ||
23 | pemParser mtyp = ScanningParser (maybe fndany fndtyp mtyp) pbdy | 25 | pemParser mtyp = ScanningParser (maybe fndany fndtyp mtyp) pbdy |
24 | where | 26 | where |
25 | hdr typ = "-----BEGIN " <> typ <> "-----" | 27 | hdr typ = "-----BEGIN " <> typ <> "-----" |