changeset 1045:7f01e52cc97a v7.0.171

updated for version 7.0-171
author vimboss
date Tue, 28 Nov 2006 16:43:58 +0000
parents f66abfa335bb
children 26ff011aec2d
files src/Make_vms.mms src/buffer.c src/os_unix.c src/version.c
diffstat 4 files changed, 74 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/src/Make_vms.mms
+++ b/src/Make_vms.mms
@@ -2,7 +2,7 @@
 # Makefile for Vim on OpenVMS
 #
 # Maintainer:   Zoltan Arpadffy <arpadffy@polarhome.com>
-# Last change:  2006 Apr 30
+# Last change:  2006 Sep 04
 #
 # This has script been tested on VMS 6.2 to 8.2 on DEC Alpha, VAX and IA64
 # with MMS and MMK
@@ -13,7 +13,7 @@
 #
 # Edit the lines in the Configuration section below for fine tuning.
 #
-# To build:    mms/descrip=Make_vms.mms
+# To build:    mms/descrip=Make_vms.mms /ignore=warning
 # To clean up: mms/descrip=Make_vms.mms clean
 #
 # Hints and detailed description could be found in INSTALLVMS.TXT file.
@@ -21,10 +21,6 @@
 ######################################################################
 # Configuration section.
 ######################################################################
-# Platform selection
-# Define this if you will use the VAX platform to build.
-# VAX = YES
-
 # VMS version
 # Uncomment if you use VMS version 6.2 or older
 # OLD_VMS = YES
@@ -49,6 +45,7 @@ GUI = YES
 
 # GUI with GTK
 # If you have GTK installed you might want to enable this option.
+# NOTE: you will need to properly define GTK_DIR below
 # GTK = YES
 
 # GUI/Motif with XPM
@@ -97,7 +94,7 @@ CCVER = YES
 
 # Compiler setup
 
-.IFDEF VAX
+.IFDEF MMSVAX
 .IFDEF DECC	     # VAX with DECC
 CC_DEF  = cc # /decc # some system requires this switch
 		     # but when it is not required /ver might fail
@@ -165,8 +162,8 @@ GTK = ""
 # NOTE: you need to set up your GTK_DIR (GTK root directory), because it is
 # unique on every system - logicals are not accepted
 # please note: directory should end with . in order to /trans=conc work
-# Example: GTK_DIR  = $1$DGA104:[USERS.ZAY.WORK.GTK1210.]
-GTK_DIR  = DKA0:[GTK1210.]
+# This value for GTK_DIR is an example.
+GTK_DIR  = $1$DGA104:[USERS.ZAY.WORK.GTK1210.]
 DEFS     = "HAVE_CONFIG_H","FEAT_GUI_GTK"
 LIBS     = ,OS_VMS_GTK.OPT/OPT
 GUI_FLAG = /name=(as_is,short)/float=ieee/ieee=denorm
@@ -274,7 +271,6 @@ TAG_DEF = ,"FEAT_TAG_ANYWHITE"
 # Please, do not change anything below without programming experience.
 ######################################################################
 
-
 MODEL_DEF = "FEAT_$(MODEL)",
 
 # These go into pathdef.c
@@ -360,7 +356,8 @@ pathdef.c : check_ccver $(CONFIG_H)
 	-@ write pd "char_u *all_lflags = (char_u *)""$(LD_DEF)$(LDFLAGS) /exe=$(TARGET) *.OBJ $(ALL_LIBS)"";"
 	-@ write pd "char_u *compiler_version = (char_u *) ""''CC_VER'"";"
 	-@ write pd "char_u *compiled_user = (char_u *) "$(VIMUSER)";"
-	-@ write pd "char_u *compiled_sys = (char_u *) "$(VIMHOST)";"
+	-@ write pd "char_u *compiled_sys  = (char_u *) "$(VIMHOST)";"
+	-@ write pd "char_u *compiled_arch = (char_u *) ""$(MMSARCH_NAME)"";"
 	-@ close pd
 
 if_perl.c : if_perl.xs
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -4145,11 +4145,13 @@ fix_fname(fname)
     /*
      * Force expanding the path always for Unix, because symbolic links may
      * 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,
      * because "c:/src/../README" is equal to "c:/README".
      * For MS-Windows also expand names like "longna~1" to "longname".
      */
-#ifdef UNIX
+#if defined(UNIX) || defined(VMS)
     return FullName_save(fname, TRUE);
 #else
     if (!vim_isAbsName(fname) || strstr((char *)fname, "..") != NULL
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -2202,7 +2202,7 @@ slash_adjust(p)
 #endif
 
 /*
- * Get absolute file name into buffer 'buf' of length 'len' bytes.
+ * Get absolute file name into "buf[len]".
  *
  * return FAIL for failure, OK for success
  */
@@ -2212,22 +2212,50 @@ mch_FullName(fname, buf, len, force)
     int		len;
     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.
+     */
+    if (force || !mch_isFullName(fname))
+    {
+	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;
-#ifdef OS2
+# ifdef OS2
     int		only_drive;	/* file name is only a drive letter */
-#endif
-#ifdef HAVE_FCHDIR
+# endif
+# ifdef HAVE_FCHDIR
     int		fd = -1;
     static int	dont_fchdir = FALSE;	/* TRUE when fchdir() doesn't work */
-#endif
+# endif
     char_u	olddir[MAXPATHL];
     char_u	*p;
     int		retval = OK;
 
-#ifdef VMS
-    fname = vms_fixfilename(fname);
-#endif
-
     /* expand it if forced or not an absolute path */
     if (force || !mch_isFullName(fname))
     {
@@ -2236,16 +2264,16 @@ mch_FullName(fname, buf, len, force)
 	 * and then do the getwd() (and get back to where we were).
 	 * This will get the correct path name with "../" things.
 	 */
-#ifdef OS2
+# ifdef OS2
 	only_drive = 0;
 	if (((p = vim_strrchr(fname, '/')) != NULL)
 		|| ((p = vim_strrchr(fname, '\\')) != NULL)
 		|| (((p = vim_strchr(fname,  ':')) != NULL) && ++only_drive))
-#else
+# else
 	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
 	     * reliable.  But on SunOS 4 it might not work.  Check this by
@@ -2261,14 +2289,14 @@ mch_FullName(fname, buf, len, force)
 		    dont_fchdir = TRUE;	    /* don't try again */
 		}
 	    }
-#endif
+# endif
 
 	    /* Only change directory when we are sure we can return to where
 	     * we are now.  After doing "su" chdir(".") might not work. */
 	    if (
-#ifdef HAVE_FCHDIR
+# ifdef HAVE_FCHDIR
 		fd < 0 &&
-#endif
+# endif
 			(mch_dirname(olddir, MAXPATHL) == FAIL
 					   || mch_chdir((char *)olddir) != 0))
 	    {
@@ -2277,7 +2305,7 @@ mch_FullName(fname, buf, len, force)
 	    }
 	    else
 	    {
-#ifdef OS2
+# ifdef OS2
 		/*
 		 * compensate for case where ':' from "D:" was the only
 		 * path separator detected in the file name; the _next_
@@ -2285,7 +2313,7 @@ mch_FullName(fname, buf, len, force)
 		 */
 		if (only_drive)
 		    p++;
-#endif
+# endif
 		/* The directory is copied into buf[], to be able to remove
 		 * the file name without changing it (could be a string in
 		 * read-only memory) */
@@ -2300,14 +2328,14 @@ mch_FullName(fname, buf, len, force)
 			fname = p + 1;
 		    *buf = NUL;
 		}
-#ifdef OS2
+# ifdef OS2
 		if (only_drive)
 		{
 		    p--;
 		    if (retval != FAIL)
 			fname--;
 		}
-#endif
+# endif
 	    }
 	}
 	if (mch_dirname(buf, len) == FAIL)
@@ -2317,14 +2345,14 @@ mch_FullName(fname, buf, len, force)
 	}
 	if (p != NULL)
 	{
-#ifdef HAVE_FCHDIR
+# ifdef HAVE_FCHDIR
 	    if (fd >= 0)
 	    {
 		l = fchdir(fd);
 		close(fd);
 	    }
 	    else
-#endif
+# endif
 		l = mch_chdir((char *)olddir);
 	    if (l != 0)
 		EMSG(_(e_prev_dir));
@@ -2333,15 +2361,14 @@ mch_FullName(fname, buf, len, force)
 	l = STRLEN(buf);
 	if (l >= len)
 	    retval = FAIL;
-#ifndef VMS
 	else
 	{
 	    if (l > 0 && buf[l - 1] != '/' && *fname != NUL
 						   && STRCMP(fname, ".") != 0)
 		STRCAT(buf, "/");
 	}
-#endif
     }
+
     /* Catch file names which are too long. */
     if (retval == FAIL || STRLEN(buf) + STRLEN(fname) >= len)
 	return FAIL;
@@ -2350,6 +2377,8 @@ mch_FullName(fname, buf, len, force)
     if (STRCMP(fname, ".") != 0)
 	STRCAT(buf, fname);
 
+#endif /* VMS */
+
     return OK;
 }
 
--- a/src/version.c
+++ b/src/version.c
@@ -667,6 +667,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    171,
+/**/
     170,
 /**/
     169,
@@ -1113,6 +1115,14 @@ list_version()
 #endif
 #ifdef VMS
     MSG_PUTS("\nOpenVMS version");
+# ifdef HAVE_PATHDEF
+    if (*compiled_arch != NUL)
+    {
+	MSG_PUTS(" - ");
+	MSG_PUTS(compiled_arch);
+    }
+# endif
+
 #endif
 
     /* Print the list of patch numbers if there is at least one. */