summaryrefslogtreecommitdiff
path: root/src/misc2.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-03-26 16:27:38 +0100
committerBram Moolenaar <Bram@vim.org>2020-03-26 16:27:38 +0100
commit7851b1ca992222880df1314684a790f293e11896 (patch)
tree71631a93383bb440a41f850664ba21b562609d02 /src/misc2.c
parenta9c3a30891edd7347d94298c48ea68bb5c165fd7 (diff)
downloadvim-git-7851b1ca992222880df1314684a790f293e11896.tar.gz
patch 8.2.0453: trailing space in job_start() command causes empty argumentv8.2.0453
Problem: Trailing space in job_start() command causes empty argument. Solution: Ignore trailing space. (closes #5851)
Diffstat (limited to 'src/misc2.c')
-rw-r--r--src/misc2.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/misc2.c b/src/misc2.c
index 6ef420cab..864d1fd40 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -4242,14 +4242,14 @@ mch_parse_cmd(char_u *cmd, int use_shcf, char ***argv, int *argc)
* 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, char ***argv, int *argc)
// 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);
}