Mail Archives: djgpp-workers/2001/12/17/02:39:59
On Sun, 16 Dec 2001, Andris Pavenis wrote:
> > int
> > main(void)
> > {
> > system("Foo=bar");
> > }
> >
> >
> > both, as expected, spawn a single instance of command.com, and exit
> > after
> > that shell is exited, the following does not:
> >
> > int
> > main(void)
> > {
> > system("");
> > system("Foo=bar");
> > }
>
> I guess Your executable were named foo.exe.
> ========
That could indeed explain the problem, but then why didn't the
previous example, the one with a single system("Foo=bar"), cause the
same infinite series of subprogram invocations?
> As far as I tested system ("Foo=bar") is interpretted as
> 'Foo "=bar"'
This interpretation is in COMMAND.COM, not in `system': an unquoted
`=' characters is treated as a delimiter by COMMAND.COM. (Old
versions of COMMAND.COM, such as the one in DOS 5.0, don't support
quoting, so `=' is _always_ a delimiter there.)
(COMMAND.COM is in this example invoked by `system' because it doesn't
find a program called `Foo=bar', with or without an executable
extension.)
- Raw text -