home *** CD-ROM | disk | FTP | other *** search
- To: vim-dev@vim.org
- Subject: Patch 5.5.062 (extra)
- Fcc: outbox
- From: Bram Moolenaar <Bram@moolenaar.net>
- ------------
-
- Patch 5.5.062 (extra)
- Problem: Win32 console: Temp files are created in the root of the current
- drive, which may be read-only. (Peterson)
- Solution: Use the same mechanism of the GUI version: Use $TMP, $TEMP or the
- current directory. Cleaned up vim_tempname() a bit.
- Files: src/fileio.c, src/os_win32.h, runtime/doc/os_dos.txt
-
-
- *** ../vim-5.5.61/src/fileio.c Sat Dec 4 13:53:42 1999
- --- src/fileio.c Tue Dec 7 15:47:47 1999
- ***************
- *** 20,25 ****
- --- 20,29 ----
-
- #include "vim.h"
-
- + #ifdef WIN32
- + # include <windows.h> /* For DeleteFile(), GetTempPath(), etc. */
- + #endif
- +
- #ifdef HAVE_FCNTL_H
- # include <fcntl.h>
- #endif
- ***************
- *** 2982,2990 ****
- vim_tempname(extra_char)
- int extra_char; /* character to use in the name instead of '?' */
- {
- ! #ifdef USE_GUI_WIN32
- ! # undef USE_TMPNAM
- ! # define TEMPNAMELEN 256
- char szTempFile[_MAX_PATH+1];
- char buf4[4];
- #endif
- --- 2986,2992 ----
- vim_tempname(extra_char)
- int extra_char; /* character to use in the name instead of '?' */
- {
- ! #ifdef WIN32
- char szTempFile[_MAX_PATH+1];
- char buf4[4];
- #endif
- ***************
- *** 2993,3000 ****
- #else
- char_u itmp[TEMPNAMELEN];
- #endif
- ! #if defined(TEMPDIRNAMES) || (!defined(USE_GUI_WIN32) && !defined(USE_TMPNAM))
- ! char_u *p;
- #endif
-
- #ifdef TEMPDIRNAMES
- --- 2995,3002 ----
- #else
- char_u itmp[TEMPNAMELEN];
- #endif
- ! #if defined(TEMPDIRNAMES) || !defined(USE_TMPNAM)
- ! char_u *p;
- #endif
-
- #ifdef TEMPDIRNAMES
- ***************
- *** 3017,3023 ****
- if (first_try)
- first_dir = i; /* start here next time */
- first_try = FALSE;
- ! #ifdef __EMX__
- /*
- * if $TMP contains a forward slash (perhaps because we're using
- * bash or tcsh, right Stefan?), don't add a backslash to the
- --- 3019,3025 ----
- if (first_try)
- first_dir = i; /* start here next time */
- first_try = FALSE;
- ! # ifdef __EMX__
- /*
- * if $TMP contains a forward slash (perhaps because we're using
- * bash or tcsh, right Stefan?), don't add a backslash to the
- ***************
- *** 3028,3034 ****
- if (vim_strchr(itmp, '/'))
- STRCAT(itmp, "/");
- else
- ! #endif
- add_pathsep(itmp);
- STRCAT(itmp, TEMPNAME);
- if ((p = vim_strchr(itmp, '?')) != NULL)
- --- 3030,3036 ----
- if (vim_strchr(itmp, '/'))
- STRCAT(itmp, "/");
- else
- ! # endif
- add_pathsep(itmp);
- STRCAT(itmp, TEMPNAME);
- if ((p = vim_strchr(itmp, '?')) != NULL)
- ***************
- *** 3039,3056 ****
- }
- }
- return NULL;
- #else /* !TEMPDIRNAMES */
-
- ! # ifdef USE_GUI_WIN32
- STRCPY(itmp, "");
- ! GetTempPath(_MAX_PATH, szTempFile);
- strcpy(buf4, "VIM");
- buf4[2] = extra_char; /* make it "VIa", "VIb", etc. */
- if (GetTempFileName(szTempFile, buf4, 0, itmp) == 0)
- # else
- # ifdef USE_TMPNAM
- /* tmpnam() will make its own name */
- if (*tmpnam((char *)itmp) == NUL)
- # else
- # ifdef VMS_TEMPNAM
- /* mktemp() is not working on VMS. It seems to be
- --- 3041,3064 ----
- }
- }
- return NULL;
- +
- #else /* !TEMPDIRNAMES */
-
- ! # ifdef WIN32
- STRCPY(itmp, "");
- ! if (GetTempPath(_MAX_PATH, szTempFile) == 0)
- ! szTempFile[0] = NUL; /* GetTempPath() failed, use current dir */
- strcpy(buf4, "VIM");
- buf4[2] = extra_char; /* make it "VIa", "VIb", etc. */
- if (GetTempFileName(szTempFile, buf4, 0, itmp) == 0)
- + return NULL;
- + /* GetTempFileName() will create the file, we don't want that */
- + (void)DeleteFile(itmp);
- # else
- # ifdef USE_TMPNAM
- /* tmpnam() will make its own name */
- if (*tmpnam((char *)itmp) == NUL)
- + return NULL;
- # else
- # ifdef VMS_TEMPNAM
- /* mktemp() is not working on VMS. It seems to be
- ***************
- *** 3067,3089 ****
- free(p);
- }
- else
- # else
- STRCPY(itmp, TEMPNAME);
- if ((p = vim_strchr(itmp, '?')) != NULL)
- *p = extra_char;
- if (mktemp((char *)itmp) == NULL)
- # endif
- # endif
- # endif
- - return NULL;
-
- - # ifdef USE_GUI_WIN32
- - /* GetTempFileName() will create the file, we don't want that */
- - (void)DeleteFile(itmp);
- - # endif
- # ifdef WIN32
- {
- - char_u *p;
- char_u *retval;
-
- /* Backslashes in a temp file name cause problems when filtering with
- --- 3075,3093 ----
- free(p);
- }
- else
- + return NULL;
- # else
- STRCPY(itmp, TEMPNAME);
- if ((p = vim_strchr(itmp, '?')) != NULL)
- *p = extra_char;
- if (mktemp((char *)itmp) == NULL)
- + return NULL;
- # endif
- # endif
- # endif
-
- # ifdef WIN32
- {
- char_u *retval;
-
- /* Backslashes in a temp file name cause problems when filtering with
- *** ../vim-5.5.61/src/os_win32.h Wed Sep 22 10:06:28 1999
- --- src/os_win32.h Tue Dec 7 15:07:26 1999
- ***************
- *** 25,31 ****
- #endif
- #define HAVE_STRFTIME /* guessed */
- #define HAVE_MEMSET
- - #define USE_TMPNAM /* use tmpnam() instead of mktemp() */
- #define HAVE_LOCALE_H
- #define HAVE_FCNTL_H
- #define HAVE_QSORT
- --- 25,30 ----
- ***************
- *** 74,79 ****
- --- 73,80 ----
- #define MAXPATHL 1024
-
- #define BASENAMELEN (_MAX_PATH - 5) /* length of base of file name */
- +
- + #define TEMPNAMELEN _MAX_PATH /* length of temp file name path */
-
- #ifndef MAXMEM
- # define MAXMEM (2*1024) /* use up to 2 Mbyte for a buffer */
- *** ../vim-5.5.61/runtime/doc/os_dos.txt Wed Sep 22 10:06:42 1999
- --- runtime/doc/os_dos.txt Tue Dec 7 14:43:27 1999
- ***************
- *** 1,4 ****
- ! *os_dos.txt* For Vim version 5.5. Last change: 1999 Sep 14
-
-
- VIM REFERENCE MANUAL by Bram Moolenaar
- --- 1,4 ----
- ! *os_dos.txt* For Vim version 5.5. Last change: 1999 Dec 07
-
-
- VIM REFERENCE MANUAL by Bram Moolenaar
- ***************
- *** 238,249 ****
- --- 238,258 ----
- ==============================================================================
- 8. Temp files *dos-temp-files*
-
- + Only for the 16 bit and 32 bit DOS version:
- Vim puts temporary files (for filtering) in the first of these directories
- that exists and in which Vim can create a file:
- $TMP
- $TEMP
- C:\TMP
- C:\TEMP
- + current directory
- +
- + For the Win32 version (both console and GUI):
- + Vim uses standard Windows functions to obtain a temporary file name (for
- + filtering). The first of these directories that exists and in which Vim can
- + create a file is used:
- + $TMP
- + $TEMP
- current directory
-
- ==============================================================================
- *** ../vim-5.5.61/src/version.c Tue Dec 7 12:51:33 1999
- --- src/version.c Tue Dec 7 15:11:33 1999
- ***************
- *** 420,420 ****
- --- 420,421 ----
- { /* Add new patch number below this line */
- + 62,
-
- --
- The software said it requires Windows 95 or better, so I installed Linux.
-
- --/-/---- Bram Moolenaar ---- Bram@moolenaar.net ---- Bram@vim.org ---\-\--
- \ \ www.vim.org/iccf www.moolenaar.net www.vim.org / /
-