char_u *p;
static int recursive = FALSE;
int add_pat;
+ int retval = OK;
#if defined(FEAT_SEARCHPATH)
int did_expand_in_path = FALSE;
#endif
#ifdef VIM_BACKTICK
if (vim_backtick(p))
+ {
add_pat = expand_backtick(&ga, p, flags);
+ if (add_pat == -1)
+ retval = FAIL;
+ }
else
#endif
{
recursive = FALSE;
- return (ga.ga_data != NULL) ? OK : FAIL;
+ return (ga.ga_data != NULL) ? retval : FAIL;
}
# ifdef VIM_BACKTICK
/*
* Expand an item in `backticks` by executing it as a command.
* Currently only works when pat[] starts and ends with a `.
- * Returns number of file names found.
+ * Returns number of file names found, -1 if an error is encountered.
*/
static int
expand_backtick(gap, pat, flags)
/* Create the command: lop off the backticks. */
cmd = vim_strnsave(pat + 1, (int)STRLEN(pat) - 2);
if (cmd == NULL)
- return 0;
+ return -1;
#ifdef FEAT_EVAL
if (*cmd == '=') /* `={expr}`: Expand expression */
(flags & EW_SILENT) ? SHELL_SILENT : 0, NULL);
vim_free(cmd);
if (buffer == NULL)
- return 0;
+ return -1;
cmd = buffer;
while (*cmd != NUL)