Mail Archives: djgpp/2002/12/20/19:30:16
Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> 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 <stdio.h>
#include <string.h>
#include <crt0.h>
#include <go32.h>
#include <stubinfo.h>
#include <sys/farptr.h>
#include <sys/movedata.h>
/* 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 <stdio.h>
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
- Raw text -