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.130 < prev    next >
Encoding:
Internet Message Format  |  2006-10-09  |  5.4 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 7.0.130
  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.130 (extra)
  11. Problem:    Win32: Trying to edit or write devices may cause Vim to get stuck.
  12. Solution:   Add the 'opendevice' option, default off.  Disallow
  13.         reading/writing from/to devices when it's off.
  14.         Also detect more devices by the full name starting with "\\.\".
  15. Files:        runtime/doc/options.txt, src/fileio.c, src/option.c, src/option.h,
  16.         src/os_win32.c
  17.  
  18.  
  19. *** ../vim-7.0.129/runtime/doc/options.txt    Sun May  7 17:07:10 2006
  20. --- runtime/doc/options.txt    Tue Oct 10 17:34:48 2006
  21. ***************
  22. *** 4792,4801 ****
  23.       completion with CTRL-X CTRL-O. |i_CTRL-X_CTRL-O|
  24.       See |complete-functions| for an explanation of how the function is
  25.       invoked and what it should return.
  26. !     This option is usually set by a filetype plugin.
  27.       |:filetype-plugin-on|
  28.   
  29.   
  30.                           *'operatorfunc'* *'opfunc'*
  31.   'operatorfunc' 'opfunc'    string    (default: empty)
  32.               global
  33. --- 4815,4836 ----
  34.       completion with CTRL-X CTRL-O. |i_CTRL-X_CTRL-O|
  35.       See |complete-functions| for an explanation of how the function is
  36.       invoked and what it should return.
  37. !     This option is usually set by a filetype plugin:
  38.       |:filetype-plugin-on|
  39.   
  40.   
  41. +                 *'opendevice* *'odev* *'noopendevice* *'noodev*
  42. + 'opendevice' 'odev'    boolean    (default off)
  43. +             global
  44. +             {not in Vi}
  45. +             {only for MS-DOS, MS-Windows and OS/2}
  46. +     Enable reading and writing from devices.  This may get Vim stuck on a
  47. +     device that can be opened but doesn't actually do the I/O.  Therefore
  48. +     it is off by default.
  49. +     Note that on MS-Windows editing "aux.h", "lpt1.txt" and the like also
  50. +     result in editing a device.
  51.                           *'operatorfunc'* *'opfunc'*
  52.   'operatorfunc' 'opfunc'    string    (default: empty)
  53.               global
  54. *** ../vim-7.0.129/src/fileio.c    Thu Sep 14 11:07:08 2006
  55. --- src/fileio.c    Tue Oct 10 18:41:24 2006
  56. ***************
  57. *** 419,424 ****
  58. --- 419,438 ----
  59.       }
  60.   #endif
  61.   
  62. + #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
  63. +     /*
  64. +      * MS-Windows allows opening a device, but we will probably get stuck
  65. +      * trying to read it.
  66. +      */
  67. +     if (!p_odev && mch_nodetype(fname) == NODE_WRITABLE)
  68. +     {
  69. +     filemess(curbuf, fname, (char_u *)_("is a device (disabled with 'opendevice' option"), 0);
  70. +     msg_end();
  71. +     msg_scroll = msg_save;
  72. +     return FAIL;
  73. +     }
  74. + #endif
  75.       /* set default 'fileformat' */
  76.       if (set_options)
  77.       {
  78. ***************
  79. *** 3163,3168 ****
  80. --- 3177,3192 ----
  81.       }
  82.       if (c == NODE_WRITABLE)
  83.       {
  84. + # if defined(MSDOS) || defined(MSWIN) || defined(OS2)
  85. +     /* MS-Windows allows opening a device, but we will probably get stuck
  86. +      * trying to write to it.  */
  87. +     if (!p_odev)
  88. +     {
  89. +         errnum = (char_u *)"E796: ";
  90. +         errmsg = (char_u *)_("writing to device disabled with 'opendevice' option");
  91. +         goto fail;
  92. +     }
  93. + # endif
  94.       device = TRUE;
  95.       newfile = TRUE;
  96.       perm = -1;
  97. *** ../vim-7.0.129/src/option.c    Tue Sep  5 16:29:38 2006
  98. --- src/option.c    Tue Oct 10 17:16:00 2006
  99. ***************
  100. *** 1810,1815 ****
  101. --- 1810,1823 ----
  102.       {"open",        NULL,   P_BOOL|P_VI_DEF,
  103.                   (char_u *)NULL, PV_NONE,
  104.                   {(char_u *)FALSE, (char_u *)0L}},
  105. +     {"opendevice",  "odev", P_BOOL|P_VI_DEF,
  106. + #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
  107. +                 (char_u *)&p_odev, PV_NONE,
  108. + #else
  109. +                 (char_u *)NULL, PV_NONE,
  110. + #endif
  111. +                 {(char_u *)FALSE, (char_u *)FALSE}
  112. +                 },
  113.       {"operatorfunc", "opfunc", P_STRING|P_VI_DEF|P_SECURE,
  114.                   (char_u *)&p_opfunc, PV_NONE,
  115.                   {(char_u *)"", (char_u *)0L} },
  116. *** ../vim-7.0.129/src/option.h    Mon Apr 24 21:37:06 2006
  117. --- src/option.h    Tue Oct 10 17:17:09 2006
  118. ***************
  119. *** 618,623 ****
  120. --- 618,626 ----
  121.   #ifdef FEAT_MZSCHEME
  122.   EXTERN long    p_mzq;        /* 'mzquantum */
  123.   #endif
  124. + #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
  125. + EXTERN int    p_odev;        /* 'opendevice' */
  126. + #endif
  127.   EXTERN char_u    *p_opfunc;    /* 'operatorfunc' */
  128.   EXTERN char_u    *p_para;    /* 'paragraphs' */
  129.   EXTERN int    p_paste;    /* 'paste' */
  130. *** ../vim-7.0.129/src/os_win32.c    Sun Apr 23 00:24:31 2006
  131. --- src/os_win32.c    Tue Oct 10 17:08:23 2006
  132. ***************
  133. *** 2702,2707 ****
  134. --- 2702,2713 ----
  135.       HANDLE    hFile;
  136.       int        type;
  137.   
  138. +     /* We can't open a file with a name "\\.\con" or "\\.\prn" and trying to
  139. +      * read from it later will cause Vim to hang.  Thus return NODE_WRITABLE
  140. +      * here. */
  141. +     if (STRNCMP(name, "\\\\.\\", 4) == 0)
  142. +     return NODE_WRITABLE;
  143.       hFile = CreateFile(name,        /* file name */
  144.           GENERIC_WRITE,        /* access mode */
  145.           0,            /* share mode */
  146. *** ../vim-7.0.129/src/version.c    Tue Oct 10 18:29:21 2006
  147. --- src/version.c    Tue Oct 10 18:37:12 2006
  148. ***************
  149. *** 668,669 ****
  150. --- 668,671 ----
  151.   {   /* Add new patch number below this line */
  152. + /**/
  153. +     130,
  154.   /**/
  155.  
  156. -- 
  157. "Space is big.  Really big.  You just won't believe how vastly hugely mind-
  158. bogglingly big it is.  I mean, you may think it's a long way down the
  159. road to the chemist, but that's just peanuts to space."
  160.         -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
  161.  
  162.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  163. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  164. \\\        download, build and distribute -- http://www.A-A-P.org        ///
  165.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  166.