diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-08-21 22:39:35 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-08-21 22:39:35 +0200 |
commit | 9baf297c99cc35adb921bee04369499d76438889 (patch) | |
tree | 2950b9566bc892687dd90839d1da41ce5f68a98a /src/ex_cmds.c | |
parent | de7762a2c1498e2dc43586feb5f982d661799f85 (diff) | |
download | vim-git-9baf297c99cc35adb921bee04369499d76438889.tar.gz |
patch 7.4.2239v7.4.2239
Problem: Warning for missing declaration of skip_vimgrep_pat(). (John
Marriott)
Solution: Move it to another file.
Diffstat (limited to 'src/ex_cmds.c')
-rw-r--r-- | src/ex_cmds.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c index e727ecc18..5c79e9594 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -8392,6 +8392,60 @@ ex_drop(exarg_T *eap) } #endif +#if defined(FEAT_QUICKFIX) || defined(FEAT_EVAL) || defined(PROTO) +/* + * Skip over the pattern argument of ":vimgrep /pat/[g][j]". + * Put the start of the pattern in "*s", unless "s" is NULL. + * If "flags" is not NULL put the flags in it: VGR_GLOBAL, VGR_NOJUMP. + * If "s" is not NULL terminate the pattern with a NUL. + * Return a pointer to the char just past the pattern plus flags. + */ + char_u * +skip_vimgrep_pat(char_u *p, char_u **s, int *flags) +{ + int c; + + if (vim_isIDc(*p)) + { + /* ":vimgrep pattern fname" */ + if (s != NULL) + *s = p; + p = skiptowhite(p); + if (s != NULL && *p != NUL) + *p++ = NUL; + } + else + { + /* ":vimgrep /pattern/[g][j] fname" */ + if (s != NULL) + *s = p + 1; + c = *p; + p = skip_regexp(p + 1, c, TRUE, NULL); + if (*p != c) + return NULL; + + /* Truncate the pattern. */ + if (s != NULL) + *p = NUL; + ++p; + + /* Find the flags */ + while (*p == 'g' || *p == 'j') + { + if (flags != NULL) + { + if (*p == 'g') + *flags |= VGR_GLOBAL; + else + *flags |= VGR_NOJUMP; + } + ++p; + } + } + return p; +} +#endif + #if defined(FEAT_EVAL) || defined(PROTO) /* * List v:oldfiles in a nice way. |