Allowed option parser to reset flags (needed in scriptfiles).

master
Julian M. Kunkel 2019-03-27 22:32:38 +00:00
parent 07ca5247d7
commit b4fb80a69e
1 changed files with 6 additions and 1 deletions

View File

@ -246,7 +246,12 @@ static void option_parse_token(char ** argv, int * flag_parsed_next, int * requi
switch(o->arg){
case (OPTION_FLAG):{
assert(o->type == 'd');
(*(int*) o->variable)++;
if(arg != NULL){
int val = atoi(arg);
(*(int*) o->variable) = (val < 0) ? 0 : val;
}else{
(*(int*) o->variable)++;
}
break;
}
case (OPTION_OPTIONAL_ARGUMENT):