int argc_l = 0;
int done = 0;
int argv_alloced;
- int i;
+ int i, saw_quote = 0;
char quote = '\0';
int count;
struct child_prog *prog;
*src == ']') *buf++ = '\\';
*buf++ = *src;
} else if (isspace(*src)) {
- if (*prog->argv[argc_l]) {
+ if (*prog->argv[argc_l] || saw_quote) {
buf++, argc_l++;
/* +1 here leaves room for the NULL which ends argv */
if ((argc_l + 1) == argv_alloced) {
argv_alloced);
}
prog->argv[argc_l] = buf;
+ saw_quote = 0;
}
} else
switch (*src) {
case '"':
case '\'':
quote = *src;
+ saw_quote = 1;
break;
case '#': /* comment */
case '|': /* pipe */
/* finish this command */
- if (*prog->argv[argc_l])
+ if (*prog->argv[argc_l] || saw_quote)
argc_l++;
if (!argc_l) {
error_msg("empty command in pipe");
src++;
}
- if (*prog->argv[argc_l]) {
+ if (*prog->argv[argc_l] || saw_quote) {
argc_l++;
}
if (!argc_l) {
int argc_l = 0;
int done = 0;
int argv_alloced;
- int i;
+ int i, saw_quote = 0;
char quote = '\0';
int count;
struct child_prog *prog;
*src == ']') *buf++ = '\\';
*buf++ = *src;
} else if (isspace(*src)) {
- if (*prog->argv[argc_l]) {
+ if (*prog->argv[argc_l] || saw_quote) {
buf++, argc_l++;
/* +1 here leaves room for the NULL which ends argv */
if ((argc_l + 1) == argv_alloced) {
argv_alloced);
}
prog->argv[argc_l] = buf;
+ saw_quote = 0;
}
} else
switch (*src) {
case '"':
case '\'':
quote = *src;
+ saw_quote = 1;
break;
case '#': /* comment */
case '|': /* pipe */
/* finish this command */
- if (*prog->argv[argc_l])
+ if (*prog->argv[argc_l] || saw_quote)
argc_l++;
if (!argc_l) {
error_msg("empty command in pipe");
src++;
}
- if (*prog->argv[argc_l]) {
+ if (*prog->argv[argc_l] || saw_quote) {
argc_l++;
}
if (!argc_l) {
int argc_l = 0;
int done = 0;
int argv_alloced;
- int i;
+ int i, saw_quote = 0;
char quote = '\0';
int count;
struct child_prog *prog;
*src == ']') *buf++ = '\\';
*buf++ = *src;
} else if (isspace(*src)) {
- if (*prog->argv[argc_l]) {
+ if (*prog->argv[argc_l] || saw_quote) {
buf++, argc_l++;
/* +1 here leaves room for the NULL which ends argv */
if ((argc_l + 1) == argv_alloced) {
argv_alloced);
}
prog->argv[argc_l] = buf;
+ saw_quote = 0;
}
} else
switch (*src) {
case '"':
case '\'':
quote = *src;
+ saw_quote = 1;
break;
case '#': /* comment */
case '|': /* pipe */
/* finish this command */
- if (*prog->argv[argc_l])
+ if (*prog->argv[argc_l] || saw_quote)
argc_l++;
if (!argc_l) {
error_msg("empty command in pipe");
src++;
}
- if (*prog->argv[argc_l]) {
+ if (*prog->argv[argc_l] || saw_quote) {
argc_l++;
}
if (!argc_l) {