0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

updated for version 7.4.191

Problem:    Escaping a file name for shell commands can't be done without a
            function.
Solution:   Add the :S file name modifier.
This commit is contained in:
Bram Moolenaar
2014-02-23 23:39:13 +01:00
parent 581966e832
commit 26df092843
20 changed files with 126 additions and 26 deletions

View File

@@ -1369,12 +1369,14 @@ csh_like_shell()
* Escape a newline, depending on the 'shell' option.
* When "do_special" is TRUE also replace "!", "%", "#" and things starting
* with "<" like "<cfile>".
* When "do_newline" is FALSE do not escape newline unless it is csh shell.
* Returns the result in allocated memory, NULL if we have run out.
*/
char_u *
vim_strsave_shellescape(string, do_special)
vim_strsave_shellescape(string, do_special, do_newline)
char_u *string;
int do_special;
int do_newline;
{
unsigned length;
char_u *p;
@@ -1403,7 +1405,8 @@ vim_strsave_shellescape(string, do_special)
# endif
if (*p == '\'')
length += 3; /* ' => '\'' */
if (*p == '\n' || (*p == '!' && (csh_like || do_special)))
if ((*p == '\n' && (csh_like || do_newline))
|| (*p == '!' && (csh_like || do_special)))
{
++length; /* insert backslash */
if (csh_like && do_special)
@@ -1454,7 +1457,8 @@ vim_strsave_shellescape(string, do_special)
++p;
continue;
}
if (*p == '\n' || (*p == '!' && (csh_like || do_special)))
if ((*p == '\n' && (csh_like || do_newline))
|| (*p == '!' && (csh_like || do_special)))
{
*d++ = '\\';
if (csh_like && do_special)