From aab98776f602a4bec1a74ee87eb829aadf6437ea Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 16 Dec 2016 16:09:10 +0100 Subject: options: change --h=... behavior Does not match a shell pattern anymore. Instead, a simple sub-string search is done. --- DOCS/man/options.rst | 7 ++++--- options/m_config.c | 8 +------- player/main.c | 2 +- wscript | 4 ---- 4 files changed, 6 insertions(+), 15 deletions(-) diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index e355d933d9..0dd3aad59b 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -350,9 +350,10 @@ Program Behavior ``--help``, ``--h`` Show short summary of options. - You can also pass a shell pattern to this option, which will list all - matching top-level options, e.g. ``--h=*scale*`` for all options that - contain the word "scale". + You can also pass a string to this option, which will list all top-level + options which contain the string in the name, e.g. ``--h=scale`` for all + options that contain the word ``scale``. The special string ``*`` lists + all top-level options. ``-v`` Increment verbosity level, one level for each ``-v`` found on the command diff --git a/options/m_config.c b/options/m_config.c index 2dc3eb569d..14aa56da51 100644 --- a/options/m_config.c +++ b/options/m_config.c @@ -29,10 +29,6 @@ #include #include -#if HAVE_FNMATCH -#include -#endif - #include "libmpv/client.h" #include "mpv_talloc.h" @@ -956,10 +952,8 @@ void m_config_print_option_list(const struct m_config *config, const char *name) const struct m_option *opt = co->opt; if (co->is_hidden) continue; -#if HAVE_FNMATCH - if (fnmatch(name, co->name, 0)) + if (strcmp(name, "*") != 0 && !strstr(co->name, name)) continue; -#endif MP_INFO(config, " %s%-30s", prefix, co->name); if (opt->type == &m_option_type_choice) { MP_INFO(config, " Choices:"); diff --git a/player/main.c b/player/main.c index 1f32d375bd..8ebfc357a2 100644 --- a/player/main.c +++ b/player/main.c @@ -96,7 +96,7 @@ const char mp_help_text[] = " --playlist= specify playlist file\n" "\n" " --list-options list all mpv options\n" -" --h= print options which match the given shell pattern\n" +" --h= print options which contain the given string in their name\n" "\n"; static pthread_mutex_t terminal_owner_lock = PTHREAD_MUTEX_INITIALIZER; diff --git a/wscript b/wscript index 9d9c6a8047..f47f965265 100644 --- a/wscript +++ b/wscript @@ -127,10 +127,6 @@ main_dependencies = [ # This should be good enough. 'func': check_statement(['poll.h', 'unistd.h', 'sys/mman.h'], 'struct pollfd pfd; poll(&pfd, 1, 0); fork(); int f[2]; pipe(f); munmap(f,0)'), - }, { - 'name': 'fnmatch', - 'desc': 'fnmatch()', - 'func': check_statement('fnmatch.h', 'fnmatch("", "", 0)') }, { 'name': 'posix-or-mingw', 'desc': 'development environment', -- cgit v1.2.3