base' = mbase {domDelegate = Nothing, domImport = Nothing}
-- print base
if depth <= 0 then return $ Left "Nesting of imports is too deep"
- else case ((domDelegate mbase), (domImport mbase)) of
- (Nothing, Nothing ) -> return $ Right base'
- (Nothing, Just keys) -> foldM mergeIncl1 (Right base') keys
- (Just key, _ ) -> mergeIncl1 (Right emptyNmcDom) key
+ else case ((domDelegate mbase), (domImport mbase)) of
+ (Nothing, Nothing ) -> return $ Right base'
+ (Nothing, Just keys) -> foldM mergeIncl1 (Right base') keys
+ (Just key, _ ) -> mergeIncl1 (Right emptyNmcDom) key
where
mergeIncl1 (Left err) _ = return $ Left err -- can never happen
mergeIncl1 (Right acc) key = do
sub3 = emptyNmcDom { domSrv = Just [srvStr] }
proto = "_" ++ (srvProto sr)
srvid = "_" ++ (srvName sr)
- srvStr = (show (srvPrio sr)) ++ " "
+ srvStr = (show (srvPrio sr)) ++ "\t"
++ (show (srvWeight sr)) ++ " "
++ (show (srvPort sr)) ++ " "
++ (srvHost sr)
if srvName sr == "smtp"
&& srvProto sr == "tcp"
&& srvPort sr == 25
- then Just [(show (srvPrio sr)) ++ " " ++ (srvHost sr)]
+ then Just [(show (srvPrio sr)) ++ "\t" ++ (srvHost sr)]
else Nothing
-- | Convert map elements of the form "subN...sub2.sub1.dom.bit"
stow fqdn sdom acc = insertWith mergeNmcDom fqdn' sdom' acc
where
(fqdn', sdom') =
- nest (map unpack (splitOn (pack ".") (pack fqdn)), sdom)
+ nest (filter (/= "") (splitOnDots fqdn), sdom)
+ splitOnDots s = map unpack (splitOn (pack ".") (pack s))
nest ([], v) = (fqdn, v) -- can split result be empty?
nest ([k], v) = (k, v)
nest (k:ks, v) =