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