diff --git a/hscan.1 b/hscan.1 index c4bec29c3a6830bc11053fdb4b09a63b54261254..37086a0a689bbf0e1c5bb584c9ebce330ce0a85d 100644 --- a/hscan.1 +++ b/hscan.1 @@ -23,7 +23,9 @@ tools. For each cluster, two files named \fIcluster\fB.instances\fR and \fIcluster\fB.nodes\fR will be generated holding the instance and node data. These files can then be used in \fBhbal\fR(1) or \fBhn1\fR(1) -via the \fB-i\fR and \fB-n\fR options. +via the \fB-i\fR and \fB-n\fR options. In case the cluster name +contains slashes (as it can happen when the cluster is a +fully-specified URL), these will be replaced with underscores. The one-line output for each cluster will show the following: .RS diff --git a/hscan.hs b/hscan.hs index 4ce9cc71031021d218f6ad3a67b811629346bb08..228998768a4d90b7121e5d29941f16cece5fcd04 100644 --- a/hscan.hs +++ b/hscan.hs @@ -130,6 +130,11 @@ printCluster nl il ktn kti = ccv +-- | Replace slashes with underscore for saving to filesystem + +fixSlash :: String -> String +fixSlash = map (\x -> if x == '/' then '_' else x) + -- | Main function. main :: IO () main = do @@ -170,7 +175,7 @@ main = do putStr $ Cluster.printNodes ktn fix_nl let ndata = serializeNodes nl csf ktn idata = serializeInstances il csf ktn kti - oname = odir </> name + oname = odir </> (fixSlash name) writeFile (oname <.> "nodes") ndata writeFile (oname <.> "instances") idata) ) clusters