0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

updated for version 7.0-208

This commit is contained in:
Bram Moolenaar 2007-03-06 19:22:53 +00:00
parent 81b85876ad
commit 38323e4f4a
4 changed files with 28 additions and 56 deletions

View File

@ -4145,13 +4145,11 @@ fix_fname(fname)
/* /*
* Force expanding the path always for Unix, because symbolic links may * Force expanding the path always for Unix, because symbolic links may
* mess up the full path name, even though it starts with a '/'. * mess up the full path name, even though it starts with a '/'.
* Also expand always for VMS, it may have alternate paths that need to be
* resolved.
* Also expand when there is ".." in the file name, try to remove it, * Also expand when there is ".." in the file name, try to remove it,
* because "c:/src/../README" is equal to "c:/README". * because "c:/src/../README" is equal to "c:/README".
* For MS-Windows also expand names like "longna~1" to "longname". * For MS-Windows also expand names like "longna~1" to "longname".
*/ */
#if defined(UNIX) || defined(VMS) #ifdef UNIX
return FullName_save(fname, TRUE); return FullName_save(fname, TRUE);
#else #else
if (!vim_isAbsName(fname) || strstr((char *)fname, "..") != NULL if (!vim_isAbsName(fname) || strstr((char *)fname, "..") != NULL

View File

@ -3592,9 +3592,8 @@ makeswapname(fname, ffname, buf, dir_name)
#else #else
(buf->b_p_sn || buf->b_shortname), (buf->b_p_sn || buf->b_shortname),
#endif #endif
#if defined(VMS) || defined(RISCOS) #ifdef RISCOS
/* Avoid problems if fname has special chars, eg <Wimp$Scrap>. /* Avoid problems if fname has special chars, eg <Wimp$Scrap> */
* For VMS always use full path for swapfile. */
ffname, ffname,
#else #else
# ifdef HAVE_READLINK # ifdef HAVE_READLINK

View File

@ -2214,49 +2214,22 @@ mch_FullName(fname, buf, len, force)
int len; int len;
int force; /* also expand when already absolute path */ int force; /* also expand when already absolute path */
{ {
#ifdef VMS
/*
* VMS does this in a completely different way.
*
* By default a file found in a complex path is written to the first
* directory in the path and not to the original directory. This
* behaviour should be avoided for the existing files and we need to find
* the exact path of the edited file.
*/
{
char_u *fixed_fname = vms_fixfilename(fname);
int fd = mch_open((char *)fixed_fname, O_RDONLY | O_EXTRA, 0);
if (fd > 0)
{
char nbuf[MAXNAMLEN];
/* File exists, use getname() to get the real name. */
if (getname(fd, nbuf))
vim_strncpy(fixed_fname, (char_u *)nbuf, (size_t)(len - 1));
close(fd);
}
if (STRLEN(fixed_fname) >= len)
return FAIL;
STRCPY(buf, fixed_fname);
}
#else /* not VMS */
int l; int l;
# ifdef OS2 #ifdef OS2
int only_drive; /* file name is only a drive letter */ int only_drive; /* file name is only a drive letter */
# endif #endif
# ifdef HAVE_FCHDIR #ifdef HAVE_FCHDIR
int fd = -1; int fd = -1;
static int dont_fchdir = FALSE; /* TRUE when fchdir() doesn't work */ static int dont_fchdir = FALSE; /* TRUE when fchdir() doesn't work */
# endif #endif
char_u olddir[MAXPATHL]; char_u olddir[MAXPATHL];
char_u *p; char_u *p;
int retval = OK; int retval = OK;
#ifdef VMS
fname = vms_fixfilename(fname);
#endif
/* expand it if forced or not an absolute path */ /* expand it if forced or not an absolute path */
if (force || !mch_isFullName(fname)) if (force || !mch_isFullName(fname))
{ {
@ -2265,16 +2238,16 @@ mch_FullName(fname, buf, len, force)
* and then do the getwd() (and get back to where we were). * and then do the getwd() (and get back to where we were).
* This will get the correct path name with "../" things. * This will get the correct path name with "../" things.
*/ */
# ifdef OS2 #ifdef OS2
only_drive = 0; only_drive = 0;
if (((p = vim_strrchr(fname, '/')) != NULL) if (((p = vim_strrchr(fname, '/')) != NULL)
|| ((p = vim_strrchr(fname, '\\')) != NULL) || ((p = vim_strrchr(fname, '\\')) != NULL)
|| (((p = vim_strchr(fname, ':')) != NULL) && ++only_drive)) || (((p = vim_strchr(fname, ':')) != NULL) && ++only_drive))
# else #else
if ((p = vim_strrchr(fname, '/')) != NULL) if ((p = vim_strrchr(fname, '/')) != NULL)
# endif #endif
{ {
# ifdef HAVE_FCHDIR #ifdef HAVE_FCHDIR
/* /*
* Use fchdir() if possible, it's said to be faster and more * Use fchdir() if possible, it's said to be faster and more
* reliable. But on SunOS 4 it might not work. Check this by * reliable. But on SunOS 4 it might not work. Check this by
@ -2290,14 +2263,14 @@ mch_FullName(fname, buf, len, force)
dont_fchdir = TRUE; /* don't try again */ dont_fchdir = TRUE; /* don't try again */
} }
} }
# endif #endif
/* Only change directory when we are sure we can return to where /* Only change directory when we are sure we can return to where
* we are now. After doing "su" chdir(".") might not work. */ * we are now. After doing "su" chdir(".") might not work. */
if ( if (
# ifdef HAVE_FCHDIR #ifdef HAVE_FCHDIR
fd < 0 && fd < 0 &&
# endif #endif
(mch_dirname(olddir, MAXPATHL) == FAIL (mch_dirname(olddir, MAXPATHL) == FAIL
|| mch_chdir((char *)olddir) != 0)) || mch_chdir((char *)olddir) != 0))
{ {
@ -2306,7 +2279,7 @@ mch_FullName(fname, buf, len, force)
} }
else else
{ {
# ifdef OS2 #ifdef OS2
/* /*
* compensate for case where ':' from "D:" was the only * compensate for case where ':' from "D:" was the only
* path separator detected in the file name; the _next_ * path separator detected in the file name; the _next_
@ -2314,7 +2287,7 @@ mch_FullName(fname, buf, len, force)
*/ */
if (only_drive) if (only_drive)
p++; p++;
# endif #endif
/* The directory is copied into buf[], to be able to remove /* The directory is copied into buf[], to be able to remove
* the file name without changing it (could be a string in * the file name without changing it (could be a string in
* read-only memory) */ * read-only memory) */
@ -2329,14 +2302,14 @@ mch_FullName(fname, buf, len, force)
fname = p + 1; fname = p + 1;
*buf = NUL; *buf = NUL;
} }
# ifdef OS2 #ifdef OS2
if (only_drive) if (only_drive)
{ {
p--; p--;
if (retval != FAIL) if (retval != FAIL)
fname--; fname--;
} }
# endif #endif
} }
} }
if (mch_dirname(buf, len) == FAIL) if (mch_dirname(buf, len) == FAIL)
@ -2346,14 +2319,14 @@ mch_FullName(fname, buf, len, force)
} }
if (p != NULL) if (p != NULL)
{ {
# ifdef HAVE_FCHDIR #ifdef HAVE_FCHDIR
if (fd >= 0) if (fd >= 0)
{ {
l = fchdir(fd); l = fchdir(fd);
close(fd); close(fd);
} }
else else
# endif #endif
l = mch_chdir((char *)olddir); l = mch_chdir((char *)olddir);
if (l != 0) if (l != 0)
EMSG(_(e_prev_dir)); EMSG(_(e_prev_dir));
@ -2362,12 +2335,14 @@ mch_FullName(fname, buf, len, force)
l = STRLEN(buf); l = STRLEN(buf);
if (l >= len) if (l >= len)
retval = FAIL; retval = FAIL;
#ifndef VMS
else else
{ {
if (l > 0 && buf[l - 1] != '/' && *fname != NUL if (l > 0 && buf[l - 1] != '/' && *fname != NUL
&& STRCMP(fname, ".") != 0) && STRCMP(fname, ".") != 0)
STRCAT(buf, "/"); STRCAT(buf, "/");
} }
#endif
} }
/* Catch file names which are too long. */ /* Catch file names which are too long. */
@ -2378,8 +2353,6 @@ mch_FullName(fname, buf, len, force)
if (STRCMP(fname, ".") != 0) if (STRCMP(fname, ".") != 0)
STRCAT(buf, fname); STRCAT(buf, fname);
#endif /* VMS */
return OK; return OK;
} }

View File

@ -666,6 +666,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
208,
/**/ /**/
207, 207,
/**/ /**/