X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: Hans-Bernhard Broeker Newsgroups: comp.os.msdos.djgpp Subject: Re: W2K, Environment, system(), (and MAKE) Date: 19 Feb 2004 12:45:03 GMT Organization: Aachen University of Technology (RWTH) Lines: 75 Message-ID: References: NNTP-Posting-Host: ac3b07.physik.rwth-aachen.de X-Trace: nets3.rz.RWTH-Aachen.DE 1077194703 25526 137.226.33.205 (19 Feb 2004 12:45:03 GMT) X-Complaints-To: abuse AT rwth-aachen DOT de NNTP-Posting-Date: 19 Feb 2004 12:45:03 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Roger S Gay wrote: > In W2K, a MSDOS box is implemented as the program CMD.EXE. Not quite. Cmd.exe is the *Win32* command prompt processor. It has essentially nothing to do with MS-DOS at all. It's a pure Windows thing. The actual DOS Box on NT-based platforms is formed by NTVDM.EXE, DOSX.EXE and COMMAND.COM. But a command prompt window is not a DOS box unless you're running a DOS program in it. Try mem /c | more in a command window, and look at its output. Do you see any cmd.exe in there? Also look at the Task manager's list of running programs to see ntvdm.exe. > While running > this program one may issue "SET" which lists the environment variables and > their settings, and which shows me > ComSpec=C:\WINDOWS\system32\cmd.exe > however a dump of the environ variable from a running C program shows > COMSPEC=C:\WINDOWS\SYSTEM32\COMMAND.COM That's not caused by that being a C program, but rather by it being a *DOS* program. If you compile the same C source with a Win32 native compiler like MinGW32 or Cygwin, you'll get ComSpec. > COMSPEC is listed first with the remaining variables in two > alphabetically ordered lists, including those which should > precede it. I don't think your assumption that the environment variables "should" be listed in any particular order is backed by fact. They may usually be, but I don't think there's any rule whatsoever about this. > Now, I am a very occasional user of system(...) but MAKE calls it > frequently on my behalf, and of course COMMAND.COM gets invoked. Not anywhere near as often as you think, as Eli explained. DJGPP's system() is pretty good at avoiding having to call COMMAND.COM. > Under W2K COMMAND.COM is somewhat of a second class citizen. Actually, under the NT family, *all* MS-DOS programs are somewhat of a second-class citizen, and that includes all of DJGPP's tools, and the ones you compile using them. > In particular > the PATH is not set from W2K's list of settings, but is set instead > from AUTOEXEC.NT. That's only *if* you have an AUTOEXEC.NT in the first place, and put a PATH in there. If you don't have an AUTOEXEC.NT, DOS sessions do get a (possibly edited) copy of the main %Path% as their %PATH%. > be safely ignored. A rudimentary path is set up in it at W2K install time. AFAIK, that happens only if you install W2K (or XP, for that matter) as an upgrade to an existing Win9x installation (i.e.: on a dist that did have a c:\autoexec.bat at the time you installed W2K). > What goes on with COMSPEC? Is the value varied by the startup code > ignoring the W2K settings list, or is this another example of Microsoft > What_You_See_Is_Nearly_But_Not_Quite_What_You_Get ? The latter. -- Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de) Even if all the snow were burnt, ashes would remain.