mirror of
https://github.com/mpv-player/mpv
synced 2025-04-23 23:56:20 +00:00
options: commandline: allow "--" without filenames after it
A "--" argument on the command line is used to indicate that all following arguments should be interpreted as filenames, not options. Specifying it as the last argument was considered an error. I see no particular reason to forbid the following filename list to be empty, nor do other programs with similar functionalitly I know about treat it that way. So just ignore a "--" with no more arguments.
This commit is contained in:
parent
f25accbc51
commit
0010ffefc4
@ -76,7 +76,7 @@ play_tree_t *m_config_parse_mp_command_line(m_config_t *config, int argc,
|
|||||||
int i, j, start_title = -1, end_title = -1;
|
int i, j, start_title = -1, end_title = -1;
|
||||||
char *opt, *splitpos = NULL;
|
char *opt, *splitpos = NULL;
|
||||||
char entbuf[15];
|
char entbuf[15];
|
||||||
int no_more_opts = 0;
|
bool no_more_opts = false;
|
||||||
int opt_exit = 0; // whether mplayer should exit without playing anything
|
int opt_exit = 0; // whether mplayer should exit without playing anything
|
||||||
play_tree_t *last_parent, *last_entry = NULL, *root;
|
play_tree_t *last_parent, *last_entry = NULL, *root;
|
||||||
|
|
||||||
@ -99,13 +99,7 @@ play_tree_t *m_config_parse_mp_command_line(m_config_t *config, int argc,
|
|||||||
opt = argv[i];
|
opt = argv[i];
|
||||||
/* check for -- (no more options id.) except --help! */
|
/* check for -- (no more options id.) except --help! */
|
||||||
if (!strcmp(opt, "--")) {
|
if (!strcmp(opt, "--")) {
|
||||||
no_more_opts = 1;
|
no_more_opts = true;
|
||||||
if (i + 1 >= argc) {
|
|
||||||
mp_tmsg(MSGT_CFGPARSER, MSGL_ERR,
|
|
||||||
"'--' indicates no more options, "
|
|
||||||
"but no filename was given on the command line.\n");
|
|
||||||
goto err_out;
|
|
||||||
}
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ((opt[0] == '{') && (opt[1] == '\0')) {
|
if ((opt[0] == '{') && (opt[1] == '\0')) {
|
||||||
|
Loading…
Reference in New Issue
Block a user