Skip to content

Commit

Permalink
Merge pull request #652 from LemonBoy/trailing-arg
Browse files Browse the repository at this point in the history
Properly check the command arguments in tail place.
  • Loading branch information
ailin-nemui committed Mar 4, 2017
2 parents 647ef19 + e4601b4 commit 5a92a39
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/core/commands.c
Expand Up @@ -567,13 +567,14 @@ static int get_cmd_options(char **data, int ignore_unknown,

option = NULL; pos = -1;
for (;;) {
if (**data == '-') {
if (**data == '\0' || **data == '-') {
if (option != NULL && *optlist[pos] == '+') {
/* required argument missing! */
*data = optlist[pos] + 1;
return CMDERR_OPTION_ARG_MISSING;
}

}
if (**data == '-') {
(*data)++;
if (**data == '-' && (*data)[1] == ' ') {
/* -- option means end of options even
Expand Down

0 comments on commit 5a92a39

Please sign in to comment.