From: "A. Sinan Unur" Newsgroups: comp.os.msdos.djgpp Subject: Re: getenv problem Date: 21 Dec 2002 00:16:32 GMT Organization: Cornell University Lines: 117 Sender: asu1 AT cornell DOT invalid (on pool-141-149-208-78.syr.east.verizon.net) Message-ID: References: NNTP-Posting-Host: pool-141-149-208-78.syr.east.verizon.net X-Trace: news01.cit.cornell.edu 1040429792 27614 141.149.208.78 (21 Dec 2002 00:16:32 GMT) X-Complaints-To: usenet AT news01 DOT cit DOT cornell DOT edu NNTP-Posting-Date: 21 Dec 2002 00:16:32 GMT User-Agent: Xnews/5.04.25 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Eli Zaretskii wrote in news:Pine DOT SUN DOT 3 DOT 91 DOT 1021219075616 DOT 19808C-100000 AT is: > > On 18 Dec 2002, A. Sinan Unur wrote: > >> so that seems to be a no go. and config.nt does not contain anything >> relevant either. >> >> any more places i should look? > > I'd suggest to step thru the startup code that reads the environment > and the DJGPP.ENV file, and see where did the value of TEMP come from, > exactly. Sorry, I didn't actually get around to doing that fully (I did do some stepping around, but my guess is I need to have a libc and stub that is debug enabled -- is that correct?). Here is something else I did, and the results: C:\Dload\misc>cat myenv.c #include #include #include #include #include #include #include /* disable reading djgpp.env */ void __crt0_load_environment_file(char *_app_name) { }; static void dump(int s) { unsigned i = 0; int c; do { while((c = _farpeekb(s, i++)) != 0) { putchar(c); } putchar('\n'); } while (_farpeekb(s, i) != 0); } int main(void) { short env; movedata(_stubinfo->psp_selector, 0x2c, _my_ds(), (int)&env, 2); dump(env); return 0; } C:\Dload\misc>myenv | grep "TEMP" TEMP=C:\WINDOWS\TEMP TMP=C:\WINDOWS\TEMP The results are the same using cmd.exe and command.com. As usual: C:\Dload\misc>set |grep -i "TEMP" TEMP=C:\DOCUME~1\asu1\LOCALS~1\Temp TMP=C:\DOCUME~1\asu1\LOCALS~1\Temp from both command.com and cmd.exe. I did search every nook and cranny I could think of (using the group policy editor and regedit, and also searching for all files that contain the string "temp") but couldn't find any place where an override might be set. I also downloaded Turbo C 2.01, and compiled the following: #include int main(int argc, char **argv, char **envp) { char **envstr = envp; while(*envstr) { puts(*envstr); ++envstr; } return 0; } and ran it. I again got TEMP=C:\WINDOWS\TEMP TMP=C:\WINDOWS\TEMP even though set displayed the correct user settings. Compiling the program above with cygwin procuded the correct output: C:\Dload\misc>e4 |grep -i "TEMP" TEMP=/cygdrive/c/DOCUME~1/asu1/LOCALS~1/Temp TMP=/cygdrive/c/DOCUME~1/asu1/LOCALS~1/Temp This suggests to me that the Windows is overriding the user TEMP variable with the system one for DOS programs. Sinan. PS: I also tried the INT 0x21 (ah = 0x62) to get the PSP segment, and then reach the environment block from there, and again, TEMP points to C:\WINDOWS\TEMP. -- A. Sinan Unur asu1 AT c-o-r-n-e-l-l DOT edu Remove dashes for address Spam bait: mailto:uce AT ftc DOT gov