Mail Archives: djgpp-workers/1999/07/05/03:24:23
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.
- Raw text -