home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 7.0 / 7.0.208 < prev    next >
Encoding:
Internet Message Format  |  2007-03-05  |  9.2 KB

  1. To: vim-dev@vim.org
  2. Subject: patch 7.0.208
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=ISO-8859-1
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 7.0.208 (after 7.0.171 and 7.0.180)
  11. Problem:    VMS: changes to path handling cause more trouble than they solve.
  12. Solution:   Revert changes.
  13. Files:        src/buffer.c, src/memline.c, src/os_unix.c
  14.  
  15.  
  16. *** ../vim-7.0.207/src/buffer.c    Tue Nov 28 17:44:51 2006
  17. --- src/buffer.c    Mon Mar  5 21:34:41 2007
  18. ***************
  19. *** 4145,4157 ****
  20.       /*
  21.        * Force expanding the path always for Unix, because symbolic links may
  22.        * mess up the full path name, even though it starts with a '/'.
  23. -      * Also expand always for VMS, it may have alternate paths that need to be
  24. -      * resolved.
  25.        * Also expand when there is ".." in the file name, try to remove it,
  26.        * because "c:/src/../README" is equal to "c:/README".
  27.        * For MS-Windows also expand names like "longna~1" to "longname".
  28.        */
  29. ! #if defined(UNIX) || defined(VMS)
  30.       return FullName_save(fname, TRUE);
  31.   #else
  32.       if (!vim_isAbsName(fname) || strstr((char *)fname, "..") != NULL
  33. --- 4145,4155 ----
  34.       /*
  35.        * Force expanding the path always for Unix, because symbolic links may
  36.        * mess up the full path name, even though it starts with a '/'.
  37.        * Also expand when there is ".." in the file name, try to remove it,
  38.        * because "c:/src/../README" is equal to "c:/README".
  39.        * For MS-Windows also expand names like "longna~1" to "longname".
  40.        */
  41. ! #ifdef UNIX
  42.       return FullName_save(fname, TRUE);
  43.   #else
  44.       if (!vim_isAbsName(fname) || strstr((char *)fname, "..") != NULL
  45. *** ../vim-7.0.207/src/memline.c    Tue Feb 13 04:03:05 2007
  46. --- src/memline.c    Mon Mar  5 21:34:41 2007
  47. ***************
  48. *** 3592,3600 ****
  49.   #else
  50.           (buf->b_p_sn || buf->b_shortname),
  51.   #endif
  52. ! #if defined(VMS) || defined(RISCOS)
  53. !         /* Avoid problems if fname has special chars, eg <Wimp$Scrap>.
  54. !          * For VMS always use full path for swapfile. */
  55.           ffname,
  56.   #else
  57.   # ifdef HAVE_READLINK
  58. --- 3592,3599 ----
  59.   #else
  60.           (buf->b_p_sn || buf->b_shortname),
  61.   #endif
  62. ! #ifdef RISCOS
  63. !         /* Avoid problems if fname has special chars, eg <Wimp$Scrap> */
  64.           ffname,
  65.   #else
  66.   # ifdef HAVE_READLINK
  67. *** ../vim-7.0.207/src/os_unix.c    Tue Feb 27 16:51:07 2007
  68. --- src/os_unix.c    Mon Mar  5 21:40:31 2007
  69. ***************
  70. *** 2214,2262 ****
  71.       int        len;
  72.       int        force;        /* also expand when already absolute path */
  73.   {
  74. - #ifdef VMS
  75. -     /*
  76. -      * VMS does this in a completely different way.
  77. -      *
  78. -      * By default a file found in a complex path is written to the first
  79. -      * directory in the path and not to the original directory.  This
  80. -      * behaviour should be avoided for the existing files and we need to find
  81. -      * the exact path of the edited file.
  82. -      */
  83. -     {
  84. -     char_u    *fixed_fname = vms_fixfilename(fname);
  85. -     int    fd = mch_open((char *)fixed_fname, O_RDONLY | O_EXTRA, 0);
  86. -     if (fd > 0)
  87. -     {
  88. -         char nbuf[MAXNAMLEN];
  89. -         /* File exists, use getname() to get the real name. */
  90. -         if (getname(fd, nbuf))
  91. -         vim_strncpy(fixed_fname, (char_u *)nbuf, (size_t)(len - 1));
  92. -         close(fd);
  93. -     }
  94. -     if (STRLEN(fixed_fname) >= len)
  95. -         return FAIL;
  96. -     STRCPY(buf, fixed_fname);
  97. -     }
  98. - #else /* not VMS */
  99.       int        l;
  100. ! # ifdef OS2
  101.       int        only_drive;    /* file name is only a drive letter */
  102. ! # endif
  103. ! # ifdef HAVE_FCHDIR
  104.       int        fd = -1;
  105.       static int    dont_fchdir = FALSE;    /* TRUE when fchdir() doesn't work */
  106. ! # endif
  107.       char_u    olddir[MAXPATHL];
  108.       char_u    *p;
  109.       int        retval = OK;
  110.   
  111.       /* expand it if forced or not an absolute path */
  112.       if (force || !mch_isFullName(fname))
  113.       {
  114. --- 2214,2235 ----
  115.       int        len;
  116.       int        force;        /* also expand when already absolute path */
  117.   {
  118.       int        l;
  119. ! #ifdef OS2
  120.       int        only_drive;    /* file name is only a drive letter */
  121. ! #endif
  122. ! #ifdef HAVE_FCHDIR
  123.       int        fd = -1;
  124.       static int    dont_fchdir = FALSE;    /* TRUE when fchdir() doesn't work */
  125. ! #endif
  126.       char_u    olddir[MAXPATHL];
  127.       char_u    *p;
  128.       int        retval = OK;
  129.   
  130. + #ifdef VMS
  131. +     fname = vms_fixfilename(fname);
  132. + #endif
  133.       /* expand it if forced or not an absolute path */
  134.       if (force || !mch_isFullName(fname))
  135.       {
  136. ***************
  137. *** 2265,2280 ****
  138.        * and then do the getwd() (and get back to where we were).
  139.        * This will get the correct path name with "../" things.
  140.        */
  141. ! # ifdef OS2
  142.       only_drive = 0;
  143.       if (((p = vim_strrchr(fname, '/')) != NULL)
  144.           || ((p = vim_strrchr(fname, '\\')) != NULL)
  145.           || (((p = vim_strchr(fname,  ':')) != NULL) && ++only_drive))
  146. ! # else
  147.       if ((p = vim_strrchr(fname, '/')) != NULL)
  148. ! # endif
  149.       {
  150. ! # ifdef HAVE_FCHDIR
  151.           /*
  152.            * Use fchdir() if possible, it's said to be faster and more
  153.            * reliable.  But on SunOS 4 it might not work.  Check this by
  154. --- 2238,2253 ----
  155.        * and then do the getwd() (and get back to where we were).
  156.        * This will get the correct path name with "../" things.
  157.        */
  158. ! #ifdef OS2
  159.       only_drive = 0;
  160.       if (((p = vim_strrchr(fname, '/')) != NULL)
  161.           || ((p = vim_strrchr(fname, '\\')) != NULL)
  162.           || (((p = vim_strchr(fname,  ':')) != NULL) && ++only_drive))
  163. ! #else
  164.       if ((p = vim_strrchr(fname, '/')) != NULL)
  165. ! #endif
  166.       {
  167. ! #ifdef HAVE_FCHDIR
  168.           /*
  169.            * Use fchdir() if possible, it's said to be faster and more
  170.            * reliable.  But on SunOS 4 it might not work.  Check this by
  171. ***************
  172. *** 2290,2303 ****
  173.               dont_fchdir = TRUE;        /* don't try again */
  174.           }
  175.           }
  176. ! # endif
  177.   
  178.           /* Only change directory when we are sure we can return to where
  179.            * we are now.  After doing "su" chdir(".") might not work. */
  180.           if (
  181. ! # ifdef HAVE_FCHDIR
  182.           fd < 0 &&
  183. ! # endif
  184.               (mch_dirname(olddir, MAXPATHL) == FAIL
  185.                          || mch_chdir((char *)olddir) != 0))
  186.           {
  187. --- 2263,2276 ----
  188.               dont_fchdir = TRUE;        /* don't try again */
  189.           }
  190.           }
  191. ! #endif
  192.   
  193.           /* Only change directory when we are sure we can return to where
  194.            * we are now.  After doing "su" chdir(".") might not work. */
  195.           if (
  196. ! #ifdef HAVE_FCHDIR
  197.           fd < 0 &&
  198. ! #endif
  199.               (mch_dirname(olddir, MAXPATHL) == FAIL
  200.                          || mch_chdir((char *)olddir) != 0))
  201.           {
  202. ***************
  203. *** 2306,2312 ****
  204.           }
  205.           else
  206.           {
  207. ! # ifdef OS2
  208.           /*
  209.            * compensate for case where ':' from "D:" was the only
  210.            * path separator detected in the file name; the _next_
  211. --- 2279,2285 ----
  212.           }
  213.           else
  214.           {
  215. ! #ifdef OS2
  216.           /*
  217.            * compensate for case where ':' from "D:" was the only
  218.            * path separator detected in the file name; the _next_
  219. ***************
  220. *** 2314,2320 ****
  221.            */
  222.           if (only_drive)
  223.               p++;
  224. ! # endif
  225.           /* The directory is copied into buf[], to be able to remove
  226.            * the file name without changing it (could be a string in
  227.            * read-only memory) */
  228. --- 2287,2293 ----
  229.            */
  230.           if (only_drive)
  231.               p++;
  232. ! #endif
  233.           /* The directory is copied into buf[], to be able to remove
  234.            * the file name without changing it (could be a string in
  235.            * read-only memory) */
  236. ***************
  237. *** 2329,2342 ****
  238.               fname = p + 1;
  239.               *buf = NUL;
  240.           }
  241. ! # ifdef OS2
  242.           if (only_drive)
  243.           {
  244.               p--;
  245.               if (retval != FAIL)
  246.               fname--;
  247.           }
  248. ! # endif
  249.           }
  250.       }
  251.       if (mch_dirname(buf, len) == FAIL)
  252. --- 2302,2315 ----
  253.               fname = p + 1;
  254.               *buf = NUL;
  255.           }
  256. ! #ifdef OS2
  257.           if (only_drive)
  258.           {
  259.               p--;
  260.               if (retval != FAIL)
  261.               fname--;
  262.           }
  263. ! #endif
  264.           }
  265.       }
  266.       if (mch_dirname(buf, len) == FAIL)
  267. ***************
  268. *** 2346,2359 ****
  269.       }
  270.       if (p != NULL)
  271.       {
  272. ! # ifdef HAVE_FCHDIR
  273.           if (fd >= 0)
  274.           {
  275.           l = fchdir(fd);
  276.           close(fd);
  277.           }
  278.           else
  279. ! # endif
  280.           l = mch_chdir((char *)olddir);
  281.           if (l != 0)
  282.           EMSG(_(e_prev_dir));
  283. --- 2319,2332 ----
  284.       }
  285.       if (p != NULL)
  286.       {
  287. ! #ifdef HAVE_FCHDIR
  288.           if (fd >= 0)
  289.           {
  290.           l = fchdir(fd);
  291.           close(fd);
  292.           }
  293.           else
  294. ! #endif
  295.           l = mch_chdir((char *)olddir);
  296.           if (l != 0)
  297.           EMSG(_(e_prev_dir));
  298. ***************
  299. *** 2362,2373 ****
  300. --- 2335,2348 ----
  301.       l = STRLEN(buf);
  302.       if (l >= len)
  303.           retval = FAIL;
  304. + #ifndef VMS
  305.       else
  306.       {
  307.           if (l > 0 && buf[l - 1] != '/' && *fname != NUL
  308.                              && STRCMP(fname, ".") != 0)
  309.           STRCAT(buf, "/");
  310.       }
  311. + #endif
  312.       }
  313.   
  314.       /* Catch file names which are too long. */
  315. ***************
  316. *** 2377,2384 ****
  317.       /* Do not append ".", "/dir/." is equal to "/dir". */
  318.       if (STRCMP(fname, ".") != 0)
  319.       STRCAT(buf, fname);
  320. - #endif /* VMS */
  321.   
  322.       return OK;
  323.   }
  324. --- 2352,2357 ----
  325. *** ../vim-7.0.207/src/version.c    Sun Mar  4 21:25:44 2007
  326. --- src/version.c    Tue Mar  6 20:22:52 2007
  327. ***************
  328. *** 668,669 ****
  329. --- 668,671 ----
  330.   {   /* Add new patch number below this line */
  331. + /**/
  332. +     208,
  333.   /**/
  334.  
  335. -- 
  336. hundred-and-one symptoms of being an internet addict:
  337. 262. Your computer has it's own phone line - but your daughter doesn't.
  338.  
  339.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  340. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  341. \\\        download, build and distribute -- http://www.A-A-P.org        ///
  342.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  343.