(parse): Trailing whitespace was interpreted as an another (empty)
argument. Ignore it.
This commit is contained in:
parent
f221adc42c
commit
fdd7679fea
1 changed files with 5 additions and 5 deletions
|
@ -61,14 +61,12 @@ parse(register s_char *buf, s_char **argpp, s_char **condp, s_char *space,
|
||||||
if (condp != 0)
|
if (condp != 0)
|
||||||
*condp = 0;
|
*condp = 0;
|
||||||
for (argnum = 0; *buf && argnum < 100;) {
|
for (argnum = 0; *buf && argnum < 100;) {
|
||||||
arg[argnum] = bp1;
|
|
||||||
argnum++;
|
|
||||||
while (isspace(*buf))
|
while (isspace(*buf))
|
||||||
buf++;
|
buf++;
|
||||||
|
if (!*buf)
|
||||||
|
break;
|
||||||
if (redir && (*buf == '>' || *buf == '|')) {
|
if (redir && (*buf == '>' || *buf == '|')) {
|
||||||
*redir = buf;
|
*redir = buf;
|
||||||
argnum--;
|
|
||||||
arg[argnum] = 0;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
quoted = 0;
|
quoted = 0;
|
||||||
|
@ -87,7 +85,9 @@ parse(register s_char *buf, s_char **argpp, s_char **condp, s_char *space,
|
||||||
*bp1++ = 0;
|
*bp1++ = 0;
|
||||||
if (*bp2 == '?' && condp != 0) {
|
if (*bp2 == '?' && condp != 0) {
|
||||||
*condp = bp2 + 1;
|
*condp = bp2 + 1;
|
||||||
argnum--;
|
} else {
|
||||||
|
arg[argnum] = bp2;
|
||||||
|
argnum++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
arg[argnum] = 0;
|
arg[argnum] = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue