[project @ 2004-01-27 09:16:27 by simonpj]
authorsimonpj <unknown>
Tue, 27 Jan 2004 09:16:27 +0000 (09:16 +0000)
committersimonpj <unknown>
Tue, 27 Jan 2004 09:16:27 +0000 (09:16 +0000)
Comments only

ghc/compiler/main/SysTools.lhs

index 912636a..0320cff 100644 (file)
@@ -801,6 +801,12 @@ rawSystem cmd args = do
        n  -> return (ExitFailure n)
 
 translate :: String -> String
+-- Returns a string wrapped in double-quotes
+-- If the input string starts with double-quote, don't touch it
+-- If not, wrap it in double-quotes and double any backslashes
+--     foo\baz    -->  "foo\\baz"
+--     "foo\baz"  -->  "foo\baz"
+
 translate str@('"':_) = str -- already escaped.
 translate str = '"' : foldr escape "\"" str
   where escape '"'  str = '\\' : '"'  : str