projects
/
ghc-hetmet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
968763d
)
[project @ 2004-01-27 09:16:27 by simonpj]
author
simonpj
<unknown>
Tue, 27 Jan 2004 09:16:27 +0000
(09:16 +0000)
committer
simonpj
<unknown>
Tue, 27 Jan 2004 09:16:27 +0000
(09:16 +0000)
Comments only
ghc/compiler/main/SysTools.lhs
patch
|
blob
|
history
diff --git
a/ghc/compiler/main/SysTools.lhs
b/ghc/compiler/main/SysTools.lhs
index
912636a
..
0320cff
100644
(file)
--- 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
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
translate str@('"':_) = str -- already escaped.
translate str = '"' : foldr escape "\"" str
where escape '"' str = '\\' : '"' : str