Date: Mon, 5 Jul 1999 10:21:11 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz AT is To: Martin Str|mberg cc: DJGPP-WORKERS Subject: Re: Real mode redir.exe In-Reply-To: <199907041700.TAA12362@father.ludd.luth.se> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp-workers AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Sun, 4 Jul 1999, Martin Str|mberg wrote: > > To say nothing of the fact that the current version of REDIR won't > > even compile with anything but DJGPP without extensive changes (and > > the changed version won't work correctly), since it uses some trickery > > to pass the command-line arguments unaltered (i.e. without expanding > > wildcards and without removing quotes) to the child programs. > > ??? It did compile relatively painlessly with some old Borland compiler. The problems are subtle. Try using it with quoted arguments and you will see them. The original version of REDIR took the naive approach of disabling wildcard expansion (this happens by default with Borland ;-), but neglected the more subtle problems with quoted arguments (e.g., when command-line arguments include embedded whitespace). The latest versions use a special crt0 flag which was invented specifically for this purpose, to tell the startup code to retain the quotes. You cannot do that with Borland, unless you hack their startup code, which I think is illegal. Btw, Borland handling of quoted command-line arguments is badly broken in all versions up to and including 3.1 (after that, I stopped using their compiler). I forget the details, but I think passing a quote itself is all but impossible, and the closing quote is not stripped(!). Try playing with a trivial program that echoes its argv[] and you will see the mess.