From b2a9c48ee5593cda05748c2cd261897392c7152d Mon Sep 17 00:00:00 2001 From: simonpj Date: Tue, 27 Jan 2004 09:16:27 +0000 Subject: [PATCH] [project @ 2004-01-27 09:16:27 by simonpj] Comments only --- ghc/compiler/main/SysTools.lhs | 6 ++++++ 1 file changed, 6 insertions(+) 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 -- 1.7.10.4