# Generate the converted .mo files separately, it's no problem if this fails.
languages:
@if test -n "$(MAKEMO)" -a -f $(PODIR)/Makefile; then \
- $(MAKE) language-check; \
cd $(PODIR); \
CC="$(CC)" $(MAKE) prefix=$(DESTDIR)$(prefix); \
fi
cd $(PODIR); CC="$(CC)" $(MAKE) prefix=$(DESTDIR)$(prefix) converted; \
fi
-# Separate target to check the po files for valitidy, because it depends on
-# ./vim.
-language-check: $(VIMTARGET)
- cd $(PODIR); $(MAKE) check VIM=../$(VIMTARGET)
-
# Update the *.po files for changes in the sources. Only run manually.
update-po:
cd $(PODIR); CC="$(CC)" $(MAKE) prefix=$(DESTDIR)$(prefix) update-po
test check:
$(MAKE) -f Makefile $(VIMTARGET)
cd testdir; $(MAKE) -f Makefile $(GUI_TESTTARGET) VIMPROG=../$(VIMTARGET) $(GUI_TESTARG)
+ @if test -n "$(MAKEMO)" -a -f $(PODIR)/Makefile; then \
+ cd $(PODIR); $(MAKE) -f Makefile check VIM=../$(VIMTARGET); \
+ fi
testclean:
cd testdir; $(MAKE) -f Makefile clean
+ if test -d $(PODIR); then \
+ cd $(PODIR); $(MAKE) checkclean; \
+ fi
#
# Avoid overwriting an existing executable, somebody might be running it and
{
retval = 1;
- /* set b_mtime to stop further warnings */
+ /* set b_mtime to stop further warnings (e.g., when executing
+ * FileChangedShell autocmd) */
if (stat_res < 0)
{
buf->b_mtime = 0;
if (reload)
/* Reload the buffer. */
- buf_reload(buf);
+ buf_reload(buf, orig_mode);
#ifdef FEAT_GUI
/* restore this in case an autocommand has set it; it would break
/*
* Reload a buffer that is already loaded.
* Used when the file was changed outside of Vim.
+ * "orig_mode" is buf->b_orig_mode before the need for reloading was detected.
+ * buf->b_orig_mode may have been reset already.
*/
void
-buf_reload(buf)
+buf_reload(buf, orig_mode)
buf_T *buf;
+ int orig_mode;
{
exarg_T ea;
pos_T old_cursor;
linenr_T old_topline;
int old_ro = buf->b_p_ro;
- int orig_mode = buf->b_orig_mode;
buf_T *savebuf;
int saved = OK;
#ifdef FEAT_AUTOCMD
# define SEEK_END 2
#endif
+#define SHELL_SPECIAL (char_u *)"\t \"&';<>[\\]|"
+
/* ARGSUSED */
int
mch_expand_wildcards(num_pat, pat, num_file, file, flags)
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;
- }
+ for (j = 0; pat[i][j] != NUL; ++j)
+ {
+ if (vim_strchr(SHELL_SPECIAL, pat[i][j]) != NULL)
+ ++len; /* may add a backslash */
+ ++len;
+ }
#endif
}
command = alloc(len);
*/
if (shell_style == STYLE_BT)
{
- STRCPY(command, pat[0] + 1); /* exclude first backtick */
+ /* change `command; command& ` to (command; command ) */
+ STRCPY(command, "(");
+ STRCAT(command, pat[0] + 1); /* exclude first backtick */
p = command + STRLEN(command) - 1;
- *p = ' '; /* remove last backtick */
+ *p-- = ')'; /* remove last backtick */
while (p > command && vim_iswhite(*p))
--p;
if (*p == '&') /* remove trailing '&' */
for (i = 0; i < num_pat; ++i)
{
/* When using system() always add extra quotes, because the shell
- * is started twice. Otherwise only put quotes around spaces and
- * single quotes. */
+ * is started twice. Otherwise put a backslash before special
+ * characters, except insice ``. */
#ifdef USE_SYSTEM
STRCAT(command, " \"");
STRCAT(command, pat[i]);
p = command + STRLEN(command);
*p++ = ' ';
- for (j = 0; pat[i][j] != NUL; )
+ for (j = 0; pat[i][j] != NUL; ++j)
{
if (pat[i][j] == '`')
{
intick = !intick;
- *p++ = pat[i][j++];
+ *p++ = pat[i][j];
}
- else if (!intick && vim_strchr((char_u *)" ';&<>",
- pat[i][j]) != NULL)
+ else if (pat[i][j] == '\\' && pat[i][j + 1] != NUL)
{
- /* Put quotes around special characters, but not when
- * inside ``. */
- *p++ = '"';
- while (pat[i][j] != NUL && vim_strchr((char_u *)" ';&<>",
+ /* Remove a backslash, take char literally. */
+ *p++ = pat[i][++j];
+ }
+ else if (!intick && vim_strchr(SHELL_SPECIAL,
pat[i][j]) != NULL)
- *p++ = pat[i][j++];
- *p++ = '"';
+ {
+ /* Put a backslash before a special character, but not
+ * when inside ``. */
+ *p++ = '\\';
+ *p++ = pat[i][j];
}
else
{
/* For a backslash also copy the next character, don't
* want to put quotes around it. */
- if ((*p++ = pat[i][j++]) == '\\' && pat[i][j] != NUL)
- *p++ = pat[i][j++];
+ if ((*p++ = pat[i][j]) == '\\' && pat[i][j + 1] != NUL)
+ *p++ = pat[i][++j];
}
}
*p = NUL;