Handle noX for OPT_BOOL X.
Originally committed as revision 19572 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
33ae681f5c
commit
b1d6e5e8ad
10
cmdutils.c
10
cmdutils.c
@ -125,11 +125,19 @@ void parse_options(int argc, char **argv, const OptionDef *options,
|
|||||||
opt = argv[optindex++];
|
opt = argv[optindex++];
|
||||||
|
|
||||||
if (handleoptions && opt[0] == '-' && opt[1] != '\0') {
|
if (handleoptions && opt[0] == '-' && opt[1] != '\0') {
|
||||||
|
int bool_val = 1;
|
||||||
if (opt[1] == '-' && opt[2] == '\0') {
|
if (opt[1] == '-' && opt[2] == '\0') {
|
||||||
handleoptions = 0;
|
handleoptions = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
po= find_option(options, opt + 1);
|
po= find_option(options, opt + 1);
|
||||||
|
if (!po->name && opt[1] == 'n' && opt[2] == 'o') {
|
||||||
|
/* handle 'no' bool option */
|
||||||
|
po = find_option(options, opt + 3);
|
||||||
|
if (!(po->name && (po->flags & OPT_BOOL)))
|
||||||
|
goto unknown_opt;
|
||||||
|
bool_val = 0;
|
||||||
|
}
|
||||||
if (!po->name)
|
if (!po->name)
|
||||||
po= find_option(options, "default");
|
po= find_option(options, "default");
|
||||||
if (!po->name) {
|
if (!po->name) {
|
||||||
@ -150,7 +158,7 @@ unknown_opt:
|
|||||||
str = av_strdup(arg);
|
str = av_strdup(arg);
|
||||||
*po->u.str_arg = str;
|
*po->u.str_arg = str;
|
||||||
} else if (po->flags & OPT_BOOL) {
|
} else if (po->flags & OPT_BOOL) {
|
||||||
*po->u.int_arg = 1;
|
*po->u.int_arg = bool_val;
|
||||||
} else if (po->flags & OPT_INT) {
|
} else if (po->flags & OPT_INT) {
|
||||||
*po->u.int_arg = parse_number_or_die(opt+1, arg, OPT_INT64, INT_MIN, INT_MAX);
|
*po->u.int_arg = parse_number_or_die(opt+1, arg, OPT_INT64, INT_MIN, INT_MAX);
|
||||||
} else if (po->flags & OPT_INT64) {
|
} else if (po->flags & OPT_INT64) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user