Mercurial > vim
diff src/misc2.c @ 19793:607e5d7968b9 v8.2.0453
patch 8.2.0453: trailing space in job_start() command causes empty argument
Commit: https://github.com/vim/vim/commit/7851b1ca992222880df1314684a790f293e11896
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Mar 26 16:27:38 2020 +0100
patch 8.2.0453: trailing space in job_start() command causes empty argument
Problem: Trailing space in job_start() command causes empty argument.
Solution: Ignore trailing space. (closes https://github.com/vim/vim/issues/5851)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 26 Mar 2020 16:30:03 +0100 |
parents | a961efb326e5 |
children | 435726a03481 |
line wrap: on
line diff
--- a/src/misc2.c +++ b/src/misc2.c @@ -4242,14 +4242,14 @@ mch_parse_cmd(char_u *cmd, int use_shcf, * 1: find number of arguments * 2: separate them and build argv[] */ - for (i = 0; i < 2; ++i) + for (i = 1; i <= 2; ++i) { p = skipwhite(cmd); inquote = FALSE; *argc = 0; - for (;;) + while (*p != NUL) { - if (i == 1) + if (i == 2) (*argv)[*argc] = (char *)p; ++*argc; d = p; @@ -4266,18 +4266,18 @@ mch_parse_cmd(char_u *cmd, int use_shcf, // Second pass: Remove the backslash. ++p; } - if (i == 1) + if (i == 2) *d++ = *p; } ++p; } if (*p == NUL) { - if (i == 1) + if (i == 2) *d++ = NUL; break; } - if (i == 1) + if (i == 2) *d++ = NUL; p = skipwhite(p + 1); }