summaryrefslogtreecommitdiff
path: root/src/os_unix.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2005-01-31 19:09:12 +0000
committerBram Moolenaar <Bram@vim.org>2005-01-31 19:09:12 +0000
commitb23c33872aa46de39bdc2cd2cbded697afa6ad08 (patch)
tree5ea25ecb55e8227f7e45c4982b1b7adf323d1f58 /src/os_unix.c
parent65c1b0166982f95d78106c3f0a3fac48424ba87d (diff)
downloadvim-git-b23c33872aa46de39bdc2cd2cbded697afa6ad08.tar.gz
updated for version 7.0046
Diffstat (limited to 'src/os_unix.c')
-rw-r--r--src/os_unix.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index 7c5b899e5..abfcdcc6f 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -4873,8 +4873,32 @@ mch_expand_wildcards(num_pat, pat, num_file, file, flags)
/* "unset nonomatch; print -N >" plus two is 29 */
len = STRLEN(tempname) + 29;
- for (i = 0; i < num_pat; ++i) /* count the length of the patterns */
+ for (i = 0; i < num_pat; ++i)
+ {
+ /* Count the length of the patterns in the same way as they are put in
+ * "command" below. */
+#ifdef USE_SYSTEM
len += STRLEN(pat[i]) + 3; /* add space and two quotes */
+#else
+ ++len; /* add space */
+ for (j = 0; pat[i][j] != NUL; )
+ if (vim_strchr((char_u *)" '", pat[i][j]) != NULL)
+ {
+ len += 2; /* add two quotes */
+ while (pat[i][j] != NUL
+ && vim_strchr((char_u *)" '", pat[i][j]) != NULL)
+ {
+ ++len;
+ ++j;
+ }
+ }
+ else
+ {
+ ++len;
+ ++j;
+ }
+#endif
+ }
command = alloc(len);
if (command == NULL)
{