From d4987bf5ebc7f7830259326daf9dc1c685b34ac0 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 15 May 2013 16:02:52 +0200 Subject: options: fix exit code when using help options Basically a cosmetic change. Fixes github issue #88. --- core/parser-mpcmd.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'core/parser-mpcmd.c') diff --git a/core/parser-mpcmd.c b/core/parser-mpcmd.c index 25535582a2..3336fce027 100644 --- a/core/parser-mpcmd.c +++ b/core/parser-mpcmd.c @@ -118,9 +118,11 @@ static bool parse_flag(bstr name, bstr f) return !!val; } -bool m_config_parse_mp_command_line(m_config_t *config, struct playlist *files, - int argc, char **argv) +// returns M_OPT_... error code +int m_config_parse_mp_command_line(m_config_t *config, struct playlist *files, + int argc, char **argv) { + int ret = M_OPT_UNKNOWN; int mode = 0; struct playlist_entry *local_start = NULL; bool shuffle = false; @@ -139,8 +141,10 @@ bool m_config_parse_mp_command_line(m_config_t *config, struct playlist *files, int r; r = m_config_set_option_ext(config, p.arg, p.param, mode == LOCAL ? M_SETOPT_CHECK_ONLY : 0); - if (r <= M_OPT_EXIT) + if (r <= M_OPT_EXIT) { + ret = r; goto err_out; + } if (r < 0) { mp_tmsg(MSGT_CFGPARSER, MSGL_FATAL, "Setting commandline option --%.*s=%.*s failed.\n", @@ -276,15 +280,13 @@ bool m_config_parse_mp_command_line(m_config_t *config, struct playlist *files, if (shuffle) playlist_shuffle(files); - talloc_free(local_params); - assert(!config->file_local_mode); - return true; + ret = 0; // success err_out: talloc_free(local_params); if (config->file_local_mode) m_config_leave_file_local(config); - return false; + return ret; } extern int mp_msg_levels[]; -- cgit v1.2.3