bug-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Cvs-cvs] Changes to ccvs/windows-NT/filesubr.c


From: Conrad T. Pino
Subject: RE: [Cvs-cvs] Changes to ccvs/windows-NT/filesubr.c
Date: Tue, 20 Sep 2005 08:29:36 -0700

Hi Derek,

> From: Derek Price
> 
> Conrad T. Pino wrote:
> 
> >@@ -705,9 +704,14 @@
> > 
> >     /* assert (filename != NULL); */
> > 
> >-    fn = _tempnam (Tmpdir, "cvs");
> >+    fn = _tempnam (getenv("TEMP"), "cvs");
> >
> 
> This raises several questions:
> 
> First, there's a new get_cvs_tmp_dir() function in src/main.c that
> should be used rather than querying the environment directly. 
> Otherwise, tmpdirs set on the command line and in the config file won't
> be noticed.
> 
> Likewise, the TMPDIR_ENV macro probably needs to be split into config.h
> so that `TMPDIR' can be used on UNIX & `TEMP' on Windows.  Right now the
> get_cvs_tmp_dir() function always uses `TMPDIR', I believe.  This also
> needs doc in cvs.texinfo - I just removed the reference to TEMP the
> other day since I noticed it was not being used while I was rewriting
> the tmpdir stuff.  Just grep for TMPDIR and add TEMP with a note about
> it being used on Windows.

The 'getenv("TEMP")' is an unimportant place holder that's done what I hoped.
The "_tempnam" function references "TMP" enviroment variable as the preferred
location.  The "dir" (first) parameter is typically not used and can be NULL.
This is worth the reading time:

http://msdn.microsoft.com/library/en-us/vclib/html/_crt__tempnam.2c_._wtempnam.2c_.tmpnam.2c_._wtmpnam.asp

Here are some Win32 Native API functions that are relevant and show the
platform's preferred envirnoment variables:

http://msdn.microsoft.com/library/en-us/fileio/fs/gettemppath.asp
http://msdn.microsoft.com/library/en-us/fileio/fs/gettempfilename.asp

> Lastly, does Windows have the POSIX "mkstemp" function, perhaps called
> _mkstemp()?  If not, does the lib/mkstemp.c (which depends on
> lib/tempname.c) compile on Windows?  If either of these is the case,
> then we could move the cvs_temp_file() function from src/filesubr.c into
> src/subr.c and remove the windows-NT  variant completely.

This is the closest I could find on MS WWW site or in VC6 header files:

http://msdn.microsoft.com/library/en-us/vclib/html/_crt__mktemp.2c_._wmktemp.asp

Let me know if any of this information changes the suggested direction.
I await your reply to this message.

> Regards,

Ditto,

> Derek

Conrad





reply via email to

[Prev in Thread] Current Thread [Next in Thread]