From: simonpj Date: Tue, 27 Jan 2004 09:16:27 +0000 (+0000) Subject: [project @ 2004-01-27 09:16:27 by simonpj] X-Git-Tag: Approx_11550_changesets_converted~117 X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=b2a9c48ee5593cda05748c2cd261897392c7152d [project @ 2004-01-27 09:16:27 by simonpj] Comments only --- diff --git a/ghc/compiler/main/SysTools.lhs b/ghc/compiler/main/SysTools.lhs index 912636a..0320cff 100644 --- a/ghc/compiler/main/SysTools.lhs +++ b/ghc/compiler/main/SysTools.lhs @@ -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