updated for version 7.1-299
diff --git a/src/ex_getln.c b/src/ex_getln.c
index e7f8c1b..b575e29 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -3656,22 +3656,7 @@
#endif
}
}
-#ifdef BACKSLASH_IN_FILENAME
- {
- char_u buf[20];
- int j = 0;
-
- /* Don't escape '[' and '{' if they are in 'isfname'. */
- for (p = PATH_ESC_CHARS; *p != NUL; ++p)
- if ((*p != '[' && *p != '{') || !vim_isfilec(*p))
- buf[j++] = *p;
- buf[j] = NUL;
- p = vim_strsave_escaped(files[i], buf);
- }
-#else
- p = vim_strsave_escaped(files[i],
- xp->xp_shell ? SHELL_ESC_CHARS : PATH_ESC_CHARS);
-#endif
+ p = vim_strsave_fnameescape(files[i], xp->xp_shell);
if (p != NULL)
{
vim_free(files[i]);
@@ -3710,6 +3695,31 @@
}
/*
+ * Escape special characters in "fname" for when used as a file name argument
+ * after a Vim command, or, when "shell" is non-zero, a shell command.
+ * Returns the result in allocated memory.
+ */
+ char_u *
+vim_strsave_fnameescape(fname, shell)
+ char_u *fname;
+ int shell;
+{
+#ifdef BACKSLASH_IN_FILENAME
+ char_u buf[20];
+ int j = 0;
+
+ /* Don't escape '[' and '{' if they are in 'isfname'. */
+ for (p = PATH_ESC_CHARS; *p != NUL; ++p)
+ if ((*p != '[' && *p != '{') || !vim_isfilec(*p))
+ buf[j++] = *p;
+ buf[j] = NUL;
+ return vim_strsave_escaped(fname, buf);
+#else
+ return vim_strsave_escaped(fname, shell ? SHELL_ESC_CHARS : PATH_ESC_CHARS);
+#endif
+}
+
+/*
* Put a backslash before the file name in "pp", which is in allocated memory.
*/
static void