TMP/TEMP environment variable and /tmp
Ken Brown
kbrown@cornell.edu
Fri Sep 18 02:17:59 GMT 2020
On 9/17/2020 7:58 PM, Doug Henderson via Cygwin wrote:
> On Thu, 17 Sep 2020 at 15:56, Ken Brown via Cygwin <> wrote:
>>
>
> #include <stdio.h>
> #include <stdlib.h>
> int
> main ()
> {
> char *temp_nam;
> char *p_tmp_nam;
>
> printf ("$TMP is '%s'\n", getenv ("TMP"));
> printf ("$TMPDIR is '%s'\n", getenv ("TMPDIR"));
> printf ("$TEMP is '%s'\n", getenv ("TEMP"));
> printf ("P_tmpdir is '%s'\n", P_tmpdir);
> p_tmp_nam = tmpnam(0);
> printf ("tmpnam() is '%s'\n", p_tmp_nam);
> temp_nam = tempnam(0, 0);
> printf ("tempnam() is '%s'\n", temp_nam);
> free(temp_nam);
> }
>
>
> # start a new shell
> $ sh
> $ TMP= TEMP= ./show_tmp
> $TMP is ''
> $TMPDIR is '(null)'
> $TEMP is ''
> P_tmpdir is '/tmp'
> tmpnam() is '/tmp/t707.0'
> tempnam() is '/tmp/ffffd187.2'
>
> # start cmd.exe
> $ /cygdrive/c/windows/system32/cmd.exe
> Microsoft Windows [Version 10.0.18363.1082]
> (c) 2019 Microsoft Corporation. All rights reserved.
>> set TMP=
>> set TEMP=
>> show_tmp
> $TMP is '(null)'
> $TMPDIR is '(null)'
> $TEMP is '(null)'
> P_tmpdir is '/tmp'
> tmpnam() is '/tmp/t709.0'
> tempnam() is '/tmp/ffffd189.2'
>
> P_tmpdir is defined in <stdio.h>
Sorry, but I'm missing your point. How is this related to Kristian's claim that
Cygwin is changing the value of the TMP environment variable to "/tmp"?
Ken
More information about the Cygwin
mailing list