On Fri, 14 Dec 2012 17:53:06 +0100 Colomban Wendling lists.ban@herbesfolles.org wrote:
Apart some more testing, I had some doubts about Windows compatibility here. Will the windows spawn code deal correctly with the escapes? If not, how to escape for Windows too?
Win~1 filenames can not contain " \ ? * and some other characters. Whether filenames with spaces are automatically quoted when creating a win~1 command line depends on the exec/spawn function used; the actual CreateProcess() uses a string, not char **.
As of the win~1 escaping, here is a small program I wrote 10(?) years ago, which takes **argv, quotes them and creates a string, so that if a system() call is executed, the program started receives the same args.
The WIN32 shell re-quoting looks pretty simple, but I can't remember why isn't \ escaped too, or whether a fully correct re-quoting is possible for win~1 cmd. Hope that helps...