delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/07/05/03:24:23

Date: Mon, 5 Jul 1999 10:21:11 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Martin Str|mberg <ams AT ludd DOT luth DOT se>
cc: DJGPP-WORKERS <djgpp-workers AT delorie DOT com>
Subject: Re: Real mode redir.exe
In-Reply-To: <199907041700.TAA12362@father.ludd.luth.se>
Message-ID: <Pine.SUN.3.91.990705102007.278A-100000@is>
MIME-Version: 1.0
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

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019