Catch some bad shell syntax

This commit is contained in:
K. Lange 2018-08-15 11:45:47 +09:00
parent 8680e66f65
commit 6ac1370025
1 changed files with 9 additions and 0 deletions

View File

@ -835,6 +835,10 @@ _done:
}
if (!strcmp(c, PIPE_TOKEN)) {
if (arg_starts[cmdi] == &argv[i]) {
fprintf(stderr, "Syntax error: Unexpected pipe token\n");
return 2;
}
argv[i] = 0;
i++;
cmdi++;
@ -923,6 +927,11 @@ _nope:
list_free(args);
if (!*arg_starts[cmdi]) {
fprintf(stderr, "Syntax error: Unexpected end of input\n");
return 2;
}
char * cmd = *arg_starts[0];
tokenid = i;