X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/004b178558907e16c74871d6f74d8854d379b9b0..5d52e7d0456a69b89b73bea74a56a05a66a20c1a:/src/options.c diff --git a/src/options.c b/src/options.c index c09ef0a5..37963cd4 100644 --- a/src/options.c +++ b/src/options.c @@ -142,7 +142,14 @@ create_long_option_table () /* Copy the struct information in the longoptions. */ longopts[j].name = option_table[i].name; longopts[j].has_arg = option_table[i].has_arg; - longopts[j].flag = option_table[i].set_flag; + /* When an options is declared having 'optional_argument' and + a flag is specified to be set, the option is skipped on + command line. So we never use a flag when a command line + option is declared 'optional_argument. */ + if (longopts[j].has_arg == optional_argument) + longopts[j].flag = NULL; + else + longopts[j].flag = option_table[i].set_flag; longopts[j++].val = option_table[i].val; } longopts[number_options].name = NULL;