Date: Thu, 18 Apr 1996 12:35:14 +0200 (IST) From: Eli Zaretskii To: djgpp-workers AT delorie DOT com Subject: Spawning DOS programs Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII There appears to be a contradiction between `spawnXX' and the startup code on c1args.c about how the command-line arguments are handled. When you call `spawnXX', it assumes that every member of the argv[] array is a single argument. That means that if it includes embedded whitespace or any special characters, they should be treated as if they were quoted. This is fine with me (btw, does `execXX' on Unix behaves the same? what does POSIX say on this?), but when functions from dosexec.c process the call, the above holds only if the program is invoked with the !proxy method. If it is a DOS program or a batch file which are invoked with `direct_exec' or `dosexec_command_exec', the individual arguments from argv[] are pasted together with a blank between them. On the other hand, the startup code on c1args.c only handles quoting when it gets the commad from DOS or from the response file, not via !proxy. What this does is that you cannot invoke programs with arguments that include special characters (like whitespace and quotes) without knowing in advance if it will be invoked by !proxy or otherwise. Specifically, it breaks programs that invoke inferior programs both with `spawnXX' and `system'. I think that functions on `dosexec.c' that invoke programs via DOS Exec call should test for special characters and if found, quote the argument that includes them. (A simple solution would be to quote all the arguments, but that will unnecessarily enlarge the command line and might exceed the infamous 126-character limit.) I implemented such a quoting, but I'd like to hear comments before I submit the patches.