History

Revert "parse_commandline: fail gracefully on bad args"

This reverts commit 38b05daf7d16898f4a63e4ccf48479d8964e6e19. There was actually no LGPL relicensing agreement with wd0.

wm4 committed 9 years ago

Commit 933db1b1 parent f8cc1842 files · +3 −6Browse files

Unified · Split

2 files
  1. options/m_option.c +1 −1
  2. options/parse_commandline.c +2 −5
options/m_option.c+1−1
@@ -62,7 +62,7 @@ char *m_option_strerror(int code) · 61 unmodified lines
6262 case M_OPT_MISSING_PARAM:
6363 return "option requires parameter";
6464 case M_OPT_INVALID:
65− return "option could not be parsed";
65+ return "option parameter could not be parsed";
6666 case M_OPT_OUT_OF_RANGE:
6767 return "parameter is outside values allowed for option";
6868 case M_OPT_DISALLOW_PARAM:
options/parse_commandline.c+2−5
@@ -78,9 +78,6 @@ static int split_opt_silent(struct parse_state *p) · 77 unmodified lines
7878
7979 bool ambiguous = !bstr_split_tok(p->arg, "=", &p->arg, &p->param);
8080
81− if (!p->arg.len)
82− return M_OPT_INVALID;
83−
8481 bool need_param = m_config_option_requires_param(p->config, p->arg) > 0;
8582
8683 if (ambiguous && need_param) {
@@ -101,7 +98,7 @@ static bool split_opt(struct parse_state *p) · 14 unmodified lines
10198 return r == 0;
10299 p->error = true;
103100
104− MP_FATAL(p->config, "Error parsing command line option '%.*s': %s\n",
101+ MP_FATAL(p->config, "Error parsing commandline option %.*s: %s\n",
105102 BSTR_P(p->arg), m_option_strerror(r));
106103 return false;
107104 }
@@ -154,7 +151,7 @@ int m_config_parse_mp_command_line(m_config_t *config, struct playlist *files, · 46 unmodified lines
154151 ret = r;
155152 goto err_out;
156153 } else if (r < 0) {
157− MP_FATAL(config, "Setting command line option '--%.*s=%.*s' failed.\n",
154+ MP_FATAL(config, "Setting commandline option --%.*s=%.*s failed.\n",
158155 BSTR_P(p.arg), BSTR_P(p.param));
159156 goto err_out;
160157 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t