options: unbreak -h

Sure is a simple thing to break.
This commit is contained in:
wm4 2017-06-23 20:23:51 +02:00
parent b0d13fa023
commit 48970cd485
3 changed files with 9 additions and 4 deletions

View File

@ -77,6 +77,8 @@ int m_option_required_params(const m_option_t *opt)
{
if (opt->type->flags & M_OPT_TYPE_OPTIONAL_PARAM)
return 0;
if (opt->flags & M_OPT_OPTIONAL_PARAM)
return 0;
if (opt->type == &m_option_type_choice) {
struct m_opt_choice_alternatives *alt;
for (alt = opt->priv; alt->name; alt++) {

View File

@ -402,6 +402,9 @@ struct m_option {
#define UPDATE_OPTS_MASK \
(((UPDATE_OPT_LAST << 1) - 1) & ~(unsigned)(UPDATE_OPT_FIRST - 1))
// Like M_OPT_TYPE_OPTIONAL_PARAM.
#define M_OPT_OPTIONAL_PARAM (1 << 30)
// These are kept for compatibility with older code.
#define CONF_MIN M_OPT_MIN
#define CONF_MAX M_OPT_MAX

View File

@ -244,10 +244,10 @@ const m_option_t mp_opts[] = {
.offset = -1},
OPT_FLAG("list-properties", property_print_help,
CONF_NOCFG | M_OPT_FIXED | M_OPT_NOPROP),
{ "help", CONF_TYPE_STRING, CONF_NOCFG | M_OPT_FIXED | M_OPT_NOPROP,
.offset = -1},
{ "h", CONF_TYPE_STRING, CONF_NOCFG | M_OPT_FIXED | M_OPT_NOPROP,
.offset = -1},
{ "help", CONF_TYPE_STRING, CONF_NOCFG | M_OPT_FIXED | M_OPT_NOPROP |
M_OPT_OPTIONAL_PARAM, .offset = -1},
{ "h", CONF_TYPE_STRING, CONF_NOCFG | M_OPT_FIXED | M_OPT_NOPROP |
M_OPT_OPTIONAL_PARAM, .offset = -1},
OPT_PRINT("list-protocols", stream_print_proto_list),
OPT_PRINT("version", print_version),