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
62 case M_OPT_MISSING_PARAM:62 case M_OPT_MISSING_PARAM:
63 return "option requires parameter";63 return "option requires parameter";
64 case M_OPT_INVALID:64 case M_OPT_INVALID:
65 return "option could not be parsed";65 return "option parameter could not be parsed";
66 case M_OPT_OUT_OF_RANGE:66 case M_OPT_OUT_OF_RANGE:
67 return "parameter is outside values allowed for option";67 return "parameter is outside values allowed for option";
68 case M_OPT_DISALLOW_PARAM:68 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
78 78
79 bool ambiguous = !bstr_split_tok(p->arg, "=", &p->arg, &p->param);79 bool ambiguous = !bstr_split_tok(p->arg, "=", &p->arg, &p->param);
80 80
81 if (!p->arg.len)
82 return M_OPT_INVALID;
83
84 bool need_param = m_config_option_requires_param(p->config, p->arg) > 0;81 bool need_param = m_config_option_requires_param(p->config, p->arg) > 0;
85 82
86 if (ambiguous && need_param) {83 if (ambiguous && need_param) {
@@ -101,7 +98,7 @@ static bool split_opt(struct parse_state *p) · 14 unmodified lines
101 return r == 0;98 return r == 0;
102 p->error = true;99 p->error = true;
103 100
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",
105 BSTR_P(p->arg), m_option_strerror(r));102 BSTR_P(p->arg), m_option_strerror(r));
106 return false;103 return false;
107}104}
@@ -154,7 +151,7 @@ int m_config_parse_mp_command_line(m_config_t *config, struct playlist *files, · 46 unmodified lines
154 ret = r;151 ret = r;
155 goto err_out;152 goto err_out;
156 } else if (r < 0) {153 } 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",
158 BSTR_P(p.arg), BSTR_P(p.param));155 BSTR_P(p.arg), BSTR_P(p.param));
159 goto err_out;156 goto err_out;
160 }157 }

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