diff options
author | Uoti Urpala <uau@mplayer2.org> | 2011-07-29 07:24:09 +0300 |
---|---|---|
committer | Uoti Urpala <uau@mplayer2.org> | 2011-07-29 07:24:09 +0300 |
commit | 5d5ca22a6d9e87d3865ea2feb54218a6e0dfffea (patch) | |
tree | 3de73607f684c8117443d25d6c7777023723a41c /playtree.c | |
parent | 8bd13d50cffb82725d2f5385574782c3002903b2 (diff) | |
download | mpv-5d5ca22a6d9e87d3865ea2feb54218a6e0dfffea.tar.bz2 mpv-5d5ca22a6d9e87d3865ea2feb54218a6e0dfffea.tar.xz |
options: commandline: accept --foo=xyz style options
Allow writing commandline options with two leading dashes. In this
mode a parameter for the option, if any, follows after a '=';
following separate commandline arguments are never consumed as a
parameter to a previous double-dash option.
Flag options may omit parameter and behave like old single-dash
syntax. "--fs=yes", "--fs=no" and "--fs" are all valid; the first two
behave like configuration file "fs=yes" and "fs=no", and last is the
same as old "-fs" (same effect as "--fs=yes").
Diffstat (limited to 'playtree.c')
-rw-r--r-- | playtree.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/playtree.c b/playtree.c index abd9b35e0f..0e3295c24c 100644 --- a/playtree.c +++ b/playtree.c @@ -346,7 +346,7 @@ play_tree_remove_file(play_tree_t* pt,const char* file) { } void -play_tree_set_param(play_tree_t* pt, const char* name, const char* val) { +play_tree_set_param(play_tree_t* pt, struct bstr name, struct bstr val) { int n = 0; #ifdef MP_DEBUG @@ -358,8 +358,8 @@ play_tree_set_param(play_tree_t* pt, const char* name, const char* val) { for ( ; pt->params[n].name != NULL ; n++ ) { } pt->params = talloc_realloc(NULL, pt->params, struct play_tree_param, n + 2); - pt->params[n].name = talloc_strdup(pt->params, name); - pt->params[n].value = val != NULL ? talloc_strdup(pt->params, val) : NULL; + pt->params[n].name = bstrdup0(pt->params, name); + pt->params[n].value = bstrdup0(pt->params, val); memset(&pt->params[n+1],0,sizeof(play_tree_param_t)); return; @@ -410,7 +410,7 @@ play_tree_set_params_from(play_tree_t* dest,play_tree_t* src) { return; for(i = 0; src->params[i].name != NULL ; i++) - play_tree_set_param(dest,src->params[i].name,src->params[i].value); + play_tree_set_param(dest, bstr(src->params[i].name), bstr(src->params[i].value)); if(src->flags & PLAY_TREE_RND) // pass the random flag too dest->flags |= PLAY_TREE_RND; |