diff src/msdos.c @ 83114:0c11f1f77626

Merged in changes from CVS trunk. Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-256 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-257 {arch}/=cvs-sync-make-log: Use new features of tla-changelogs-to-log git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-154
author Karoly Lorentey <lorentey@elte.hu>
date Wed, 28 Apr 2004 14:10:58 +0000
parents 1029206e72f2 dabd7326e596
children 46882e012e30
line wrap: on
line diff
--- a/src/msdos.c	Tue Apr 27 15:53:30 2004 +0000
+++ b/src/msdos.c	Wed Apr 28 14:10:58 2004 +0000
@@ -4408,9 +4408,28 @@
   for (i = 0; i < imax ; i++)
     {
       const char *tmp = tempdirs[i];
+      char buf[FILENAME_MAX];
 
       if (*tmp == '$')
-	tmp = getenv (tmp + 1);
+	{
+	  int tmp_len;
+
+	  tmp = getenv (tmp + 1);
+	  if (!tmp)
+	    continue;
+
+	  /* Some lusers set TMPDIR=e:, probably because some losing
+	     programs cannot handle multiple slashes if they use e:/.
+	     e: fails in `access' below, so we interpret e: as e:/.  */
+	  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