| delorie.com/archives/browse.cgi | search |
| X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f |
| X-Trace-PostClient-IP: | 68.147.112.94 |
| From: | "Roger S Gay" <roger DOT gay AT shaw DOT ca> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | W2K, Environment, system(), (and MAKE) |
| Lines: | 54 |
| Organization: | Southern Alberta Institute for the Terminally Bewildered |
| X-Priority: | 3 |
| X-MSMail-Priority: | Normal |
| X-Newsreader: | Microsoft Outlook Express 6.00.2800.1158 |
| X-MimeOLE: | Produced By Microsoft MimeOLE V6.00.2800.1165 |
| Message-ID: | <wrVYb.541277$JQ1.490156@pd7tw1no> |
| Date: | Thu, 19 Feb 2004 02:45:48 GMT |
| NNTP-Posting-Host: | 24.71.223.147 |
| X-Complaints-To: | abuse AT shaw DOT ca |
| X-Trace: | pd7tw1no 1077158748 24.71.223.147 (Wed, 18 Feb 2004 19:45:48 MST) |
| NNTP-Posting-Date: | Wed, 18 Feb 2004 19:45:48 MST |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
In W2K, a MSDOS box is implemented as the program CMD.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
COMSPEC is listed first with the remaining variables in two
alphabetically ordered lists, including those which should
precede it. All variable names are in uppercase, not the mixed case
shown by SET. A GETENV("ComSpec") call returns a null pointer.
In the absence of a SHELL environment setting, system(...) honours the
COMSPEC setting and invokes COMMAND.COM. (A SHELL setting overrides this
behaviour and I can use it successfully to specify CMD.EXE)
Now, I am a very occasional user of system(...) but MAKE calls it
frequently on my behalf, and of course COMMAND.COM gets invoked.
Under W2K COMMAND.COM is somewhat of a second class citizen. In particular
the PATH is not set from W2K's list of settings, but is set instead
from AUTOEXEC.NT. Most doccos say that this file is not used by W2K and may
be safely ignored. A rudimentary path is set up in it at W2K install time.
So MAKE gets this rudimentary path and flakes in a way most puzzling to the
inexperienced DJGPP user. (All commands get a -1 return code)
Questions:
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 ?
System() is documented as being able to determine that the command given
will invoke a .BAT script. CMD.EXE prefers a .CMD suffix. Is system()
sensitive to this? Could it or should it be made so?
Is it possible that the install instructions, particularly those on the
zip-picker page could emphasize the importance of setting up a correct path
in AUTOEXEC.NT and the desirability of setting the SHELL environment
variable
if the user has specified W2K (or XP) as his OS.
Thanks for your patience reading this
Roger S Gay
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |