Mail Archives: djgpp/2004/04/26/06:34:39
On Fri, 23 Apr 2004, Eli Zaretskii wrote:
> If you send a patch to do that, I will check it into the Emacs CVS.
This is untested (I'm not very willing to compile Emacs on my slow
machine), but it should work. I use FILENAME_MAX instead of PATH_MAX
because PATH_MAX is twice as large as DOS supports.
*** msdos.c.orig Mon Apr 26 12:48:44 2004
--- msdos.c Mon Apr 26 13:09:24 2004
***************
*** 4408,4421 ****
for (i = 0; i < imax ; i++)
{
const char *tmp = tempdirs[i];
if (*tmp == '$')
! tmp = getenv (tmp + 1);
/* Note that `access' can lie to us if the directory resides on a
read-only filesystem, like CD-ROM or a write-protected floppy.
The only way to be really sure is to actually create a file and
see if it succeeds. But I think that's too much to ask. */
! if (tmp && access (tmp, D_OK) == 0)
{
setenv ("TMPDIR", tmp, 1);
break;
--- 4408,4437 ----
for (i = 0; i < imax ; i++)
{
const char *tmp = tempdirs[i];
+ char buf[FILENAME_MAX];
if (*tmp == '$')
! {
! int tmp_len;
!
! tmp = getenv (tmp + 1);
! if (!tmp)
! continue;
!
! tmp_len = strlen(tmp);
! if (tmp[tmp_len - 1] != '/' && tmp[tmp_len - 1] != '\\')
! {
! strcpy(buf, tmp);
! buf[tmp_len++] = '/', buf[tmp_len] = 0;
! tmp = buf;
! }
! }
!
/* Note that `access' can lie to us if the directory resides on a
read-only filesystem, like CD-ROM or a write-protected floppy.
The only way to be really sure is to actually create a file and
see if it succeeds. But I think that's too much to ask. */
! if (access (tmp, D_OK) == 0)
{
setenv ("TMPDIR", tmp, 1);
break;
--
Esa Peuha
student of mathematics at the University of Helsinki
http://www.helsinki.fi/~peuha/
- Raw text -