diff options
-rw-r--r-- | lib/KeyRing.hs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/KeyRing.hs b/lib/KeyRing.hs index bd6de27..bc3af6a 100644 --- a/lib/KeyRing.hs +++ b/lib/KeyRing.hs | |||
@@ -260,11 +260,11 @@ data SpecError = SpecENone String | |||
260 | 260 | ||
261 | -- | parseSpec3 - Parse a key specification. | 261 | -- | parseSpec3 - Parse a key specification. |
262 | parseSpec3 :: Maybe MatchingField -> String -> Either SpecError Spec | 262 | parseSpec3 :: Maybe MatchingField -> String -> Either SpecError Spec |
263 | parseSpec3 maybeExpecting spec@(wordsBy '/' -> fields) = | 263 | parseSpec3 maybeExpecting spec@(wordsBy '/' -> fields) = |
264 | tooBigError maybeExpecting =<< applyContext maybeExpecting . fixUpSubstrMatch <$> | 264 | tooBigError maybeExpecting =<< applyContext maybeExpecting . fixUpSubstrMatch <$> |
265 | case fields of | 265 | case fields of |
266 | [] -> Left (SpecENone spec) | 266 | [] -> Left (SpecENone spec) |
267 | xs@[t] -> | 267 | xs@[t] -> |
268 | let ds = [0] | 268 | let ds = [0] |
269 | x = l ds xs | 269 | x = l ds xs |
270 | getTup1 [x] = tupSection1 (adjustPos x maybeExpecting) x | 270 | getTup1 [x] = tupSection1 (adjustPos x maybeExpecting) x |
@@ -272,10 +272,10 @@ parseSpec3 maybeExpecting spec@(wordsBy '/' -> fields) = | |||
272 | tupSection1 0 = (AnyMatch,AnyMatch,) | 272 | tupSection1 0 = (AnyMatch,AnyMatch,) |
273 | tupSection1 1 = (AnyMatch,,AnyMatch) | 273 | tupSection1 1 = (AnyMatch,,AnyMatch) |
274 | tupSection1 2 = (,AnyMatch,AnyMatch) | 274 | tupSection1 2 = (,AnyMatch,AnyMatch) |
275 | tupSection1 _ = tupSection1 0 | 275 | tupSection1 _ = tupSection1 0 |
276 | in if all fst x then Right $ getTup1 (map (fst . snd) x) | 276 | in if all fst x then Right $ getTup1 (map (fst . snd) x) |
277 | else Left $ mismatch x | 277 | else Left $ mismatch x |
278 | xs@[u,t] -> | 278 | xs@[u,t] -> |
279 | let ds = [1,0] | 279 | let ds = [1,0] |
280 | x = l ds xs | 280 | x = l ds xs |
281 | getTup2 [u,t] = indexHole (head (filter (`notElem` gots [u,t]) [0..2])) u t | 281 | getTup2 [u,t] = indexHole (head (filter (`notElem` gots [u,t]) [0..2])) u t |
@@ -312,7 +312,7 @@ parseSpec3 maybeExpecting spec@(wordsBy '/' -> fields) = | |||
312 | 312 | ||
313 | gotIndex :: Int -> SingleKeySpec -> Int | 313 | gotIndex :: Int -> SingleKeySpec -> Int |
314 | gotIndex dflt (SubstringMatch (Just got) _) = fromEnum got | 314 | gotIndex dflt (SubstringMatch (Just got) _) = fromEnum got |
315 | gotIndex dflt _ = dflt | 315 | gotIndex dflt _ = dflt |
316 | 316 | ||
317 | -- FIXME: This throws an exception if input is | 317 | -- FIXME: This throws an exception if input is |
318 | -- not an erroneous SubstringMatch. | 318 | -- not an erroneous SubstringMatch. |
@@ -341,7 +341,7 @@ parseSpec3 maybeExpecting spec@(wordsBy '/' -> fields) = | |||
341 | applyContext (Just GroupIDField) ((AnyMatch,u,x)) = (u,AnyMatch,x) | 341 | applyContext (Just GroupIDField) ((AnyMatch,u,x)) = (u,AnyMatch,x) |
342 | applyContext (Just GroupIDField) x = x | 342 | applyContext (Just GroupIDField) x = x |
343 | 343 | ||
344 | --applyContext (Just UserIDField) (Right (g,u,x)) = Left $ | 344 | --applyContext (Just UserIDField) (Right (g,u,x)) = Left $ |
345 | -- SpecEMissMatch (getStr g) (Just GroupIDField) UserIDField | 345 | -- SpecEMissMatch (getStr g) (Just GroupIDField) UserIDField |
346 | tooBigError _ s@(_,_,SubstringMatch (Just GroupIDField) str) = Left $ | 346 | tooBigError _ s@(_,_,SubstringMatch (Just GroupIDField) str) = Left $ |
347 | SpecEMissMatch str (Just GroupIDField) KeyTypeField | 347 | SpecEMissMatch str (Just GroupIDField) KeyTypeField |
@@ -411,7 +411,7 @@ filterNewSubs fname spec (KeyData p sigs uids subs) = KeyData p sigs uids subs' | |||
411 | subkeySpec (KeyGrip grip,Nothing) = (matchAll, KeyGrip grip) | 411 | subkeySpec (KeyGrip grip,Nothing) = (matchAll, KeyGrip grip) |
412 | subkeySpec (topspec,Just mtag) = (topspec , KeyTag (packet p) mtag) | 412 | subkeySpec (topspec,Just mtag) = (topspec , KeyTag (packet p) mtag) |
413 | 413 | ||
414 | match spec mps | 414 | match spec mps |
415 | = not . null | 415 | = not . null |
416 | . snd | 416 | . snd |
417 | . seek_key spec | 417 | . seek_key spec |
@@ -1241,7 +1241,7 @@ getHomeDir protohome = do | |||
1241 | 1241 | ||
1242 | #if MIN_VERSION_base(4,6,0) | 1242 | #if MIN_VERSION_base(4,6,0) |
1243 | #else | 1243 | #else |
1244 | lookupEnv :: String -> IO (Maybe String) | 1244 | lookupEnv :: String -> IO (Maybe String) |
1245 | lookupEnv var = | 1245 | lookupEnv var = |
1246 | handleIO_ (return Nothing) $ fmap Just (getEnv var) | 1246 | handleIO_ (return Nothing) $ fmap Just (getEnv var) |
1247 | #endif | 1247 | #endif |