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) {
if (interactive==TRUE) {
//printf( "optind=%d argv[optind]='%s'\n", optind, argv[optind]);
/* Looks like they want an interactive shell */
- printf( "\n\nBusyBox v%s (%s) Built-in shell (lash)\n", BB_VER, BB_BT);
+ printf( "\n\n" BB_BANNER " Built-in shell (lash)\n");
printf( "Enter 'help' for a list of built-in commands.\n\n");
} else if (local_pending_command==NULL) {
//printf( "optind=%d argv[optind]='%s'\n", optind, argv[optind]);