diff options
author | Bram Moolenaar <Bram@vim.org> | 2012-02-20 22:18:30 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2012-02-20 22:18:30 +0100 |
commit | f66b3fcf6ce2801e3f378827e0ed19596901a9ba (patch) | |
tree | 46a1543aae183a8b03ce18b3572d57e04656e3f2 /src | |
parent | 034b115568a1fc40b374b0b755d89f0a40f6d940 (diff) | |
download | vim-git-f66b3fcf6ce2801e3f378827e0ed19596901a9ba.tar.gz |
updated for version 7.3.446v7.3.446
Problem: Win32: External commands with special characters don't work.
Solution: Add the 'shellxescape' option.
Diffstat (limited to 'src')
-rw-r--r-- | src/misc2.c | 14 | ||||
-rw-r--r-- | src/option.c | 9 | ||||
-rw-r--r-- | src/option.h | 1 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 24 insertions, 2 deletions
diff --git a/src/misc2.c b/src/misc2.c index fc38cd029..045117fe0 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -3225,11 +3225,19 @@ call_shell(cmd, opt) retval = mch_call_shell(cmd, opt); 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) { STRCPY(ncmd, p_sxq); - STRCAT(ncmd, cmd); + STRCAT(ncmd, ecmd); /* When 'shellxquote' is ( append ). * When 'shellxquote' is "( append )". */ STRCAT(ncmd, STRCMP(p_sxq, "(") == 0 ? (char_u *)")" @@ -3240,6 +3248,8 @@ call_shell(cmd, opt) } else retval = -1; + if (ecmd != cmd) + vim_free(ecmd); } #ifdef FEAT_GUI --hold_gui_events; diff --git a/src/option.c b/src/option.c index cac031e18..0cea5586a 100644 --- a/src/option.c +++ b/src/option.c @@ -2273,6 +2273,15 @@ static struct vimoption (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 + (char_u *)0L} SCRIPTID_INIT}, {"shiftround", "sr", P_BOOL|P_VI_DEF|P_VIM, (char_u *)&p_sr, PV_NONE, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, diff --git a/src/option.h b/src/option.h index 21c275342..9dd938723 100644 --- a/src/option.h +++ b/src/option.h @@ -712,6 +712,7 @@ EXTERN char_u *p_sp; /* 'shellpipe' */ #endif EXTERN char_u *p_shq; /* 'shellquote' */ EXTERN char_u *p_sxq; /* 'shellxquote' */ +EXTERN char_u *p_sxe; /* 'shellxescape' */ EXTERN char_u *p_srr; /* 'shellredir' */ #ifdef AMIGA EXTERN long p_st; /* 'shelltype' */ diff --git a/src/version.c b/src/version.c index 7b78a45a0..159fe8681 100644 --- a/src/version.c +++ b/src/version.c @@ -715,6 +715,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 446, +/**/ 445, /**/ 444, |