mirror of
https://github.com/vim/vim.git
synced 2025-10-02 05:04:20 -04:00
updated for version 7.3.446
Problem: Win32: External commands with special characters don't work. Solution: Add the 'shellxescape' option.
This commit is contained in:
@@ -6043,8 +6043,9 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
|
|
||||||
*'shellxquote'* *'sxq'*
|
*'shellxquote'* *'sxq'*
|
||||||
'shellxquote' 'sxq' string (default: "";
|
'shellxquote' 'sxq' string (default: "";
|
||||||
for Win32, when 'shell' is cmd.exe or
|
for Win32, when 'shell' is cmd.exe: "("
|
||||||
contains "sh" somewhere: "\""
|
for Win32, when 'shell' contains "sh"
|
||||||
|
somewhere: "\""
|
||||||
for Unix, when using system(): "\"")
|
for Unix, when using system(): "\"")
|
||||||
global
|
global
|
||||||
{not in Vi}
|
{not in Vi}
|
||||||
@@ -6052,6 +6053,9 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
the "!" and ":!" commands. Includes the redirection. See
|
the "!" and ":!" commands. Includes the redirection. See
|
||||||
'shellquote' to exclude the redirection. It's probably not useful
|
'shellquote' to exclude the redirection. It's probably not useful
|
||||||
to set both options.
|
to set both options.
|
||||||
|
When the value is '(' then ')' is appended. When the value is '"('
|
||||||
|
then ')"' is appended.
|
||||||
|
When the value is '(' then also see 'shellxescape'.
|
||||||
This is an empty string by default on most systems, but is known to be
|
This is an empty string by default on most systems, but is known to be
|
||||||
useful for on Win32 version, either for cmd.exe which automatically
|
useful for on Win32 version, either for cmd.exe which automatically
|
||||||
strips off the first and last quote on a command, or 3rd-party shells
|
strips off the first and last quote on a command, or 3rd-party shells
|
||||||
@@ -6061,6 +6065,16 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
This option cannot be set from a |modeline| or in the |sandbox|, for
|
This option cannot be set from a |modeline| or in the |sandbox|, for
|
||||||
security reasons.
|
security reasons.
|
||||||
|
|
||||||
|
*'shellxescape'* *'sxe'*
|
||||||
|
'shellxescape' 'sxe' string (default: "";
|
||||||
|
for MS-DOS and MS-Windows: "\"&|<>()@^")
|
||||||
|
global
|
||||||
|
{not in Vi}
|
||||||
|
When 'shellxquote' is set to "(" then the characters listed in this
|
||||||
|
option will be escaped with a '^' character. This makes it possible
|
||||||
|
to execute most external commands with cmd.exe.
|
||||||
|
|
||||||
|
|
||||||
*'shiftround'* *'sr'* *'noshiftround'* *'nosr'*
|
*'shiftround'* *'sr'* *'noshiftround'* *'nosr'*
|
||||||
'shiftround' 'sr' boolean (default off)
|
'shiftround' 'sr' boolean (default off)
|
||||||
global
|
global
|
||||||
|
14
src/misc2.c
14
src/misc2.c
@@ -3225,11 +3225,19 @@ call_shell(cmd, opt)
|
|||||||
retval = mch_call_shell(cmd, opt);
|
retval = mch_call_shell(cmd, opt);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ncmd = alloc((unsigned)(STRLEN(cmd) + STRLEN(p_sxq) * 2 + 1));
|
char_u *ecmd = cmd;
|
||||||
|
|
||||||
|
if (*p_sxe != NUL && STRCMP(p_sxq, "(") == 0)
|
||||||
|
{
|
||||||
|
ecmd = vim_strsave_escaped_ext(cmd, p_sxe, '^', FALSE);
|
||||||
|
if (ecmd == NULL)
|
||||||
|
ecmd = cmd;
|
||||||
|
}
|
||||||
|
ncmd = alloc((unsigned)(STRLEN(ecmd) + STRLEN(p_sxq) * 2 + 1));
|
||||||
if (ncmd != NULL)
|
if (ncmd != NULL)
|
||||||
{
|
{
|
||||||
STRCPY(ncmd, p_sxq);
|
STRCPY(ncmd, p_sxq);
|
||||||
STRCAT(ncmd, cmd);
|
STRCAT(ncmd, ecmd);
|
||||||
/* When 'shellxquote' is ( append ).
|
/* When 'shellxquote' is ( append ).
|
||||||
* When 'shellxquote' is "( append )". */
|
* When 'shellxquote' is "( append )". */
|
||||||
STRCAT(ncmd, STRCMP(p_sxq, "(") == 0 ? (char_u *)")"
|
STRCAT(ncmd, STRCMP(p_sxq, "(") == 0 ? (char_u *)")"
|
||||||
@@ -3240,6 +3248,8 @@ call_shell(cmd, opt)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
retval = -1;
|
retval = -1;
|
||||||
|
if (ecmd != cmd)
|
||||||
|
vim_free(ecmd);
|
||||||
}
|
}
|
||||||
#ifdef FEAT_GUI
|
#ifdef FEAT_GUI
|
||||||
--hold_gui_events;
|
--hold_gui_events;
|
||||||
|
@@ -2271,6 +2271,15 @@ static struct vimoption
|
|||||||
(char_u *)"\"",
|
(char_u *)"\"",
|
||||||
#else
|
#else
|
||||||
(char_u *)"",
|
(char_u *)"",
|
||||||
|
#endif
|
||||||
|
(char_u *)0L} SCRIPTID_INIT},
|
||||||
|
{"shellxescape", "sxe", P_STRING|P_VI_DEF|P_SECURE,
|
||||||
|
(char_u *)&p_sxe, PV_NONE,
|
||||||
|
{
|
||||||
|
#if defined(MSDOS) || defined(WIN16) || defined(WIN3264)
|
||||||
|
(char_u *)"\"&|<>()@^",
|
||||||
|
#else
|
||||||
|
(char_u *)"",
|
||||||
#endif
|
#endif
|
||||||
(char_u *)0L} SCRIPTID_INIT},
|
(char_u *)0L} SCRIPTID_INIT},
|
||||||
{"shiftround", "sr", P_BOOL|P_VI_DEF|P_VIM,
|
{"shiftround", "sr", P_BOOL|P_VI_DEF|P_VIM,
|
||||||
|
@@ -712,6 +712,7 @@ EXTERN char_u *p_sp; /* 'shellpipe' */
|
|||||||
#endif
|
#endif
|
||||||
EXTERN char_u *p_shq; /* 'shellquote' */
|
EXTERN char_u *p_shq; /* 'shellquote' */
|
||||||
EXTERN char_u *p_sxq; /* 'shellxquote' */
|
EXTERN char_u *p_sxq; /* 'shellxquote' */
|
||||||
|
EXTERN char_u *p_sxe; /* 'shellxescape' */
|
||||||
EXTERN char_u *p_srr; /* 'shellredir' */
|
EXTERN char_u *p_srr; /* 'shellredir' */
|
||||||
#ifdef AMIGA
|
#ifdef AMIGA
|
||||||
EXTERN long p_st; /* 'shelltype' */
|
EXTERN long p_st; /* 'shelltype' */
|
||||||
|
@@ -714,6 +714,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
446,
|
||||||
/**/
|
/**/
|
||||||
445,
|
445,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user