From 9cb84e6d5bb8357e463486c9dbd29929d9982d4b Mon Sep 17 00:00:00 2001 From: Karsten Hopp Date: Oct 17 2006 11:16:16 +0000 Subject: - patchlevel 130 --- diff --git a/7.0.130 b/7.0.130 new file mode 100644 index 0000000..50b2abe --- /dev/null +++ b/7.0.130 @@ -0,0 +1,169 @@ +To: vim-dev@vim.org +Subject: Patch 7.0.130 +Fcc: outbox +From: Bram Moolenaar +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 8bit +------------ + +Patch 7.0.130 (extra) +Problem: Win32: Trying to edit or write devices may cause Vim to get stuck. +Solution: Add the 'opendevice' option, default off. Disallow + reading/writing from/to devices when it's off. + Also detect more devices by the full name starting with "\\.\". +Files: runtime/doc/options.txt, src/fileio.c, src/option.c, src/option.h, + src/os_win32.c + + +*** ../vim-7.0.129/runtime/doc/options.txt Sun May 7 17:07:10 2006 +--- runtime/doc/options.txt Tue Oct 10 17:34:48 2006 +*************** +*** 4792,4801 **** + completion with CTRL-X CTRL-O. |i_CTRL-X_CTRL-O| + See |complete-functions| for an explanation of how the function is + invoked and what it should return. +! This option is usually set by a filetype plugin. + |:filetype-plugin-on| + + + *'operatorfunc'* *'opfunc'* + 'operatorfunc' 'opfunc' string (default: empty) + global +--- 4815,4836 ---- + completion with CTRL-X CTRL-O. |i_CTRL-X_CTRL-O| + See |complete-functions| for an explanation of how the function is + invoked and what it should return. +! This option is usually set by a filetype plugin: + |:filetype-plugin-on| + + ++ *'opendevice* *'odev* *'noopendevice* *'noodev* ++ 'opendevice' 'odev' boolean (default off) ++ global ++ {not in Vi} ++ {only for MS-DOS, MS-Windows and OS/2} ++ Enable reading and writing from devices. This may get Vim stuck on a ++ device that can be opened but doesn't actually do the I/O. Therefore ++ it is off by default. ++ Note that on MS-Windows editing "aux.h", "lpt1.txt" and the like also ++ result in editing a device. ++ ++ + *'operatorfunc'* *'opfunc'* + 'operatorfunc' 'opfunc' string (default: empty) + global +*** ../vim-7.0.129/src/fileio.c Thu Sep 14 11:07:08 2006 +--- src/fileio.c Tue Oct 10 18:41:24 2006 +*************** +*** 419,424 **** +--- 419,438 ---- + } + #endif + ++ #if defined(MSDOS) || defined(MSWIN) || defined(OS2) ++ /* ++ * MS-Windows allows opening a device, but we will probably get stuck ++ * trying to read it. ++ */ ++ if (!p_odev && mch_nodetype(fname) == NODE_WRITABLE) ++ { ++ filemess(curbuf, fname, (char_u *)_("is a device (disabled with 'opendevice' option"), 0); ++ msg_end(); ++ msg_scroll = msg_save; ++ return FAIL; ++ } ++ #endif ++ + /* set default 'fileformat' */ + if (set_options) + { +*************** +*** 3163,3168 **** +--- 3177,3192 ---- + } + if (c == NODE_WRITABLE) + { ++ # if defined(MSDOS) || defined(MSWIN) || defined(OS2) ++ /* MS-Windows allows opening a device, but we will probably get stuck ++ * trying to write to it. */ ++ if (!p_odev) ++ { ++ errnum = (char_u *)"E796: "; ++ errmsg = (char_u *)_("writing to device disabled with 'opendevice' option"); ++ goto fail; ++ } ++ # endif + device = TRUE; + newfile = TRUE; + perm = -1; +*** ../vim-7.0.129/src/option.c Tue Sep 5 16:29:38 2006 +--- src/option.c Tue Oct 10 17:16:00 2006 +*************** +*** 1810,1815 **** +--- 1810,1823 ---- + {"open", NULL, P_BOOL|P_VI_DEF, + (char_u *)NULL, PV_NONE, + {(char_u *)FALSE, (char_u *)0L}}, ++ {"opendevice", "odev", P_BOOL|P_VI_DEF, ++ #if defined(MSDOS) || defined(MSWIN) || defined(OS2) ++ (char_u *)&p_odev, PV_NONE, ++ #else ++ (char_u *)NULL, PV_NONE, ++ #endif ++ {(char_u *)FALSE, (char_u *)FALSE} ++ }, + {"operatorfunc", "opfunc", P_STRING|P_VI_DEF|P_SECURE, + (char_u *)&p_opfunc, PV_NONE, + {(char_u *)"", (char_u *)0L} }, +*** ../vim-7.0.129/src/option.h Mon Apr 24 21:37:06 2006 +--- src/option.h Tue Oct 10 17:17:09 2006 +*************** +*** 618,623 **** +--- 618,626 ---- + #ifdef FEAT_MZSCHEME + EXTERN long p_mzq; /* 'mzquantum */ + #endif ++ #if defined(MSDOS) || defined(MSWIN) || defined(OS2) ++ EXTERN int p_odev; /* 'opendevice' */ ++ #endif + EXTERN char_u *p_opfunc; /* 'operatorfunc' */ + EXTERN char_u *p_para; /* 'paragraphs' */ + EXTERN int p_paste; /* 'paste' */ +*** ../vim-7.0.129/src/os_win32.c Sun Apr 23 00:24:31 2006 +--- src/os_win32.c Tue Oct 10 17:08:23 2006 +*************** +*** 2702,2707 **** +--- 2702,2713 ---- + HANDLE hFile; + int type; + ++ /* We can't open a file with a name "\\.\con" or "\\.\prn" and trying to ++ * read from it later will cause Vim to hang. Thus return NODE_WRITABLE ++ * here. */ ++ if (STRNCMP(name, "\\\\.\\", 4) == 0) ++ return NODE_WRITABLE; ++ + hFile = CreateFile(name, /* file name */ + GENERIC_WRITE, /* access mode */ + 0, /* share mode */ +*** ../vim-7.0.129/src/version.c Tue Oct 10 18:29:21 2006 +--- src/version.c Tue Oct 10 18:37:12 2006 +*************** +*** 668,669 **** +--- 668,671 ---- + { /* Add new patch number below this line */ ++ /**/ ++ 130, + /**/ + +-- +"Space is big. Really big. You just won't believe how vastly hugely mind- +bogglingly big it is. I mean, you may think it's a long way down the +road to the chemist, but that's just peanuts to space." + -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy" + + /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ +/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ +\\\ download, build and distribute -- http://www.A-A-P.org /// + \\\ help me help AIDS victims -- http://ICCF-Holland.org ///