If you want to know what it does just refer to the source; it is and always has been distributed with Visual C. See C:\Program Files\Microsoft Visual Studio .NET 2003\vc7\crt\src\stdargv.c
Richard -----Original Message----- From: Simon Peyton-Jones Sent: 29 January 2004 15:18 To: Simon Marlow; 'Claus Reinke'; '[EMAIL PROTECTED]' Cc: Richard Black; Simon Peyton-Jones Subject: RE: Problem with ghc on Windows ME Well found! Still, I found I could not understand the rules. But I think the story this Convert \" to \\\" otherwise convert " to \" otherwise do no conversion I think it's probably easiest to express this directly: translate :: String -> String translate str = '"' : go str where go ('\\' : '"' : s) = '\\' : '\\' : '\\' : '"' : go s go ('"' : s) = '\\' : '"' : go s go (c:s) = c : go s go [] = ['"'] Simon | -----Original Message----- | From: Simon Marlow | Sent: 29 January 2004 14:53 | To: Claus Reinke; Simon Peyton-Jones; [EMAIL PROTECTED] | Subject: RE: Problem with ghc on Windows ME | | After Googling around a bit, I found this description of exactly how Windows interprets command lines | in the C runtime: | | http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccelng /htm/progs_12.asp | | As you can see, the rules are indeed very strange, but they are invertible. I think this code should do | the trick: | | translate :: String -> String | translate str = '"' : snd (foldr escape (True,"\"") str) | where escape '"' (_, str) = (True, '\\' : '"' : str) | escape '\\' (True, str) = (True, '\\' : '\\' : str) | escape '\\' (False, str) = (False, '\\' : str) | escape c (_, str) = (False, c : str) | | Cheers, | Simon | | > -----Original Message----- | > From: [EMAIL PROTECTED] | > [mailto:[EMAIL PROTECTED] On Behalf | > Of Simon Marlow | > Sent: 29 January 2004 11:31 | > To: Claus Reinke; Simon Peyton-Jones; | > [EMAIL PROTECTED] | > Subject: RE: Problem with ghc on Windows ME | > | > | > > So does that mean functionality has been lost in the move from | > > ghc-6.0.1? | > | > No, the behaviour is improved in 6.2 because we're now | > careful to escape | > quotes before passing the command-line to the operating system. | > | > I think confusion has arisen because Simon pointed out that there's no | > way, on Windows, to pass this sequence of characters as an | > argument to a | > command: | > | > \" | > | > This is not entirely true, I just discovered that the | > sequence \\\" will | > turn into \". But in general, the sequence \\ does not turn into \. | > Windows' command-line quoting rules are highly mysterious, to say the | > least. | > | > So the patch I posted is not complete. It looks like rawSystem should | > additionally translate \" as \\\". | > | > > Because that (on win98) happily accepts such useful | > > contraptions as | > > | > > System.Cmd.rawSystem "\"c:\\silly | > > space\\Vim\\vim62\\gvim.exe\" --servername GVIM --remote-send | > > \":echo \\\"hi \\\\\\\" there\\\"<cr>\"" >>= print | > | > The idea is that you should pass to rawSystem *exactly* the | > command and | > arguments you want to run, with no quoting except that required by the | > Haskell lexical syntax. You'll notice that rawSystem now takes the | > command and list of arguments separately in 6.2. The | > implementation of | > rawSystem will attempt to compensate for the internal translation that | > Windows does on the command-line; on Unix no translation is necessary. | > So clients of rawSystem should be more portable, because they | > don't have | > to know about quoting that happens under the hood. | > | > Your example will probably work once it's reformulated for | > 6.2's version | > of rawSystem, and once we fix rawSystem in light of the \\\" hack I | > discovered above. | > | > Cheers, | > Simon | > _______________________________________________ | > Glasgow-haskell-users mailing list | > [EMAIL PROTECTED] | > http://www.haskell.org/mailman/listinfo/glasgow-haskell-users | > _______________________________________________ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users