1
0
forked from aniani/vim

updated for version 7.0-130

This commit is contained in:
Bram Moolenaar
2006-10-10 16:44:07 +00:00
parent 57ac3a2163
commit 043545e0f6
6 changed files with 56 additions and 1 deletions

View File

@@ -419,6 +419,20 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags)
}
#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,6 +3177,16 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit,
}
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;

View File

@@ -1810,6 +1810,14 @@ static struct vimoption
{"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} },

View File

@@ -618,6 +618,9 @@ EXTERN int p_more; /* 'more' */
#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' */

View File

@@ -2702,6 +2702,12 @@ mch_nodetype(char_u *name)
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 */

View File

@@ -666,6 +666,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
130,
/**/
129,
/**/