delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/16/04:18:29

Date: Mon, 16 Jun 1997 11:16:55 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Nate Eldredge <eldredge AT ap DOT net>
cc: djgpp AT delorie DOT com
Subject: Re: 4DOS command line passing support
In-Reply-To: <199706151745.KAA25084@adit.ap.net>
Message-ID: <Pine.SUN.3.91.970616111617.17543D-100000@is>
MIME-Version: 1.0

On Sun, 15 Jun 1997, Nate Eldredge wrote:

> Are there any plans to support 4DOS's method for passing long(er) command
> lines (up to 255 chars)?

Since everyone can submit changes to the library, I cannot speak for
others, but personally, I don't have any plans to add this.  Some of
the reasons are explained below; the upshot is that IMHO introducing
this would be too messy, the gains too low, and there are work-arounds
that are there to make it work for you right now.

However, you (or anybody else who knows enough about 4DOS and feels
such a feature is needed) are welcome to submit patches to library
sources that would implement this support.

> The way it works is the environment variable "CMDLINE" is set equal
> to the entire command line.  [...] it would be nice for the startup
> code to detect this, use it if available, and do the parsing.

Sorry, it's just ain't that easy at all.  First, "CMDLINE" is also
used by Windows 95 to pass long command lines, but some crucial
details about how this is done are different (W95 is not limited by
255 characters), so such a support needs to distinguish between the
two and support both.

Second, this would have a nasty effect of punishing *all* DJGPP
programs (since command-line argument expansion is in the startup code
which gets linked into every application), even if they don't use
4DOS.  One more reason for newcomers to complain about bloated exe
size.

Third, how many different and incompatible ways of passing command
lines could an environment such as DJGPP be expected to support?
Correct me if I'm wrong, but there aren't too much non-DJGPP programs
that support this feature, right?  If so, why should DJGPP be
different?

(Things would be even more messy if you also want to be able to
*invoke* child programs using this method, but as far as I understand,
you didn't talk about this.)

Finally, adding such a support requires a good knowledge of 4DOS and
its features (which AFAIK have changed with its different versions),
and I have never used 4DOS seriously.  (In particular, I don't know
how this feature behaves when the command line uses pipes: can I put
the entire command line into "CMDLINE"? does the entire command need
to be shorter than 256 chars, or only every stage of the pipe?  I have
actually looked for these and related items in the 4DOS docs but
couldn't find it anywhere.)

Have I yet convinced you that general support for 4DOS is far from
a simple change?  If so, let's talk about work-arounds.

First, you can use Bash, or write a Makefile and use Make.

Second, many cases of long command lines arise when you use pipes and
redirection.  Since DJGPP's `system' emulates these internally without
calling the shell, at least some of these cases don't need long
command lines at all when they are invoked from DJGPP programs.

Lastly, my own experience (I'm using COMMAND.COM) shows that the cases
where I need to exceed the 126-character limit while typing from the
command line is *extremely* rare.  Long commands *are* needed when
calling programs from a Makefile or in a script, but for these cases
solutions already exist.

Once again, the above is my personal opinion, please don't think it's
an official position of the DJGPP project (only DJ Delorie gets to
declare such official positions).  So you are welcome to contribute
any code you'd like to add to DJGPP; what I say here is only meant to
shed additional light on this issue.

- Raw text -


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