delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/31/08:04:35

Date: Wed, 31 Dec 1997 15:02:45 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Daniel Taupin <taupin AT lps DOT u-psud DOT fr>
cc: DJGPP List <djgpp AT delorie DOT com>, Latex2html list <latex2html AT mcs DOT anl DOT gov>,
taupin AT lps DOT u-psud DOT fr
Subject: Re: Problems djgpp+perl+MSDOS
In-Reply-To: <34AA1DC4.1FC2B0AC@lps.u-psud.fr>
Message-ID: <Pine.SUN.3.91.971231144625.4144B-100000@is>
MIME-Version: 1.0

On Wed, 31 Dec 1997, Daniel Taupin wrote:

>  1. Does djgpp+windows-dos-windows allow a C "system(...)" command 
> which calls a djggpp routine which in turn contains a system(...) command?

`system' cannot call a djgpp routine, it invokes another program.  If you 
mean that `system' calls a child program which itself calls `system', 
then yes, it should and does work.

>  Or are embedded system(...) commands forbidden|dangerous|discouraged?

No, they should work.  You can write a simple test program that invokes 
itself recursively to test this (I did that at the time).

The only limitation on the recursive invocation is the amount of free DOS 
memory.  Each DJGPP program needs some amount of conventional memory below 
1MB mark.  The exact amount depends on the DPMI server; see section 15.8 
of the DJGPP FAQ list for more details.

In most installations, at least 5 recursive invocations should be 
possible, much more under CWSDPMI or Windows.

>  2. When C calls "system(some-command)", which is the default directory 
> for "some-command" 

The same directory where the parent program was when it called `system'.  
This is how everything works on MS-DOS, and DJGPP is no different.

>  3. Is the perl "system(...)" command identical or similar to C's 
> command?

I think it is, but Molnar should have the definitive answer.

> My feeling is that Perl (DOS Perl) works in a 
> different way, since it seems (seems, not always) to recognize whether 
> "some-command" is a perl script and executes it, 
> although DOS is unable to execute a perl script and requires:
> 
>    perl some-command
> 
> when "some-command" is a perl script, and NOT a *.EXE, not a *.COM, not 
> a *.BAT. 

You are mixing `system' from libc with MS-DOS.  `system' in the DJGPP
library doesn't call COMMAND.COM, it does most of the work itself, because
DOS and COMMAND.COM are too stupid.  It is `system' from the DJGPP library
that correctly decides how to call a Perl script (it looks at the first
line, sees "#!/bin/perl" there and calls Perl to execute the script). 

So if Perl indeed uses `system' from the DJGPP library (as I think it 
does), it will inherit this feature as well.

Btw, you might consider reading the documentation of the `system' library 
function in libc reference: all these features are described there in 
quite some detail (type "info libc alpha system" from the DOS prompt).

> ==> My impression is that MSDOS perl5004 keeps some information (some 
> variables) when running an embedded perl script, 
> but this information might be destroyed by running a non-perl command 
> inside system(...). Your opinion?

Please post an example, as I don't understand what are you talking about.

As a matter of fact, I'd suggest to post examples for all of the problems 
that you are describing.  It might be that you are looking for the causes 
in the wrong place.

> (to djgpp folks,  do not answer only to dgjpp list but also to all 
> recipients of this message, thanks) > 

The last time I replied, the copy to latex2html list bounced.

- Raw text -


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