diff options
author | Chad Versace <chad.versace@linux.intel.com> | 2014-01-25 14:01:02 -0800 |
---|---|---|
committer | Chad Versace <chad.versace@linux.intel.com> | 2014-01-25 14:02:29 -0800 |
commit | adfa367b361b51c9c5c75210af64f32aabf22341 (patch) | |
tree | abda9656668b7584624ad9d34a949410a34d251f | |
parent | 0ccb8b74f91206fa6e778b0d3554c092fd0607a6 (diff) | |
parent | d722a3e39fbfa2438572824792ec08895832e24d (diff) |
Merge branch 'wflinfo-short-opts'
-rw-r--r-- | man/wflinfo.1.xml | 12 | ||||
-rw-r--r-- | src/utils/wflinfo.c | 56 |
2 files changed, 43 insertions, 25 deletions
diff --git a/man/wflinfo.1.xml b/man/wflinfo.1.xml index 444598c..1f81e73 100644 --- a/man/wflinfo.1.xml +++ b/man/wflinfo.1.xml @@ -64,10 +64,11 @@ <variablelist> <varlistentry> + <term><option>-p</option> <replaceable class="parameter">platform</replaceable></term> <term><option>--platform=<replaceable class="parameter">platform</replaceable></option></term> <listitem> <para> - Where platform is + Where <replaceable class="parameter">platform</replaceable> is <simplelist type="inline"> <?dbchoice choice="or"?> <member>android</member> @@ -81,10 +82,11 @@ </listitem> </varlistentry> <varlistentry> + <term><option>-a</option> <replaceable class="parameter">api</replaceable></term> <term><option>--api=<replaceable class="parameter">api</replaceable></option></term> <listitem> <para> - Where api is + Where <replaceable class="parameter">api</replaceable> is <simplelist type="inline"> <?dbchoice choice="or"?> <member>gl</member> @@ -103,6 +105,7 @@ <title>Options</title> <variablelist> <varlistentry> + <term><option>-V</option> <replaceable class="parameter">MAJOR.MINOR</replaceable></term> <term><option>--version=<replaceable class="parameter">MAJOR.MINOR</replaceable></option></term> <listitem> <para> @@ -114,11 +117,12 @@ <term><option>--profile=<replaceable class="parameter">profile</replaceable></option></term> <listitem> <para> - Where profile is core, compat or none + Where <replaceable class="parameter">profile</replaceable> is core, compat or none </para> </listitem> </varlistentry> <varlistentry> + <term><option>-v</option></term> <term><option>--verbose</option></term> <listitem> <para> @@ -153,6 +157,8 @@ <member>wflinfo --platform=glx --api=gl</member> <member>wflinfo --platform=x11_egl --api=gl --version=3.2 --profile=core</member> <member>wflinfo --platform=wayland --api=gles3</member> + <member>wflinfo --platform=gbm --api=gl --version=3.2 --verbose</member> + <member>wflinfo -p gbm -a gl -V 3.2 -v</member> </simplelist> </para> diff --git a/src/utils/wflinfo.c b/src/utils/wflinfo.c index 1257666..1a458ed 100644 --- a/src/utils/wflinfo.c +++ b/src/utils/wflinfo.c @@ -54,25 +54,27 @@ removeXcodeArgs(int *argc, char **argv); #include "waffle.h" static const char *usage_message = - "usage:\n" - " wflinfo --platform=android|cgl|gbm|glx|wayland|x11_egl\n" - " --api=gl|gles1|gles2|gles3\n" - " [--version=MAJOR.MINOR]\n" - " [--profile=core|compat|none]\n" - " [--forward-compatible]\n" - " [--debug-context]\n" - " [--verbose]\n" + "Usage:\n" + " wflinfo <Required Parameters> [Options]\n" "\n" - "examples:\n" - " wflinfo --platform=glx --api=gl\n" - " wflinfo --platform=x11_egl --api=gl --version=3.2 --profile=core\n" - " wflinfo --platform=wayland --api=gles3\n" - "\n" - "description:\n" + "Description:\n" " Create an OpenGL or OpenGL ES context and print information about it.\n" "\n" - "options:\n" - " --verbose\n" + "Required Parameters:\n" + " -p, --platform\n" + " One of: android, cgl, gbm, glx, wayland or x11_egl\n" + "\n" + " -a, --api\n" + " One of: gl, gles1, gles2 or gles3\n" + "\n" + "Options:\n" + " -V, --version\n" + " For example --api=gl --version=3.2 would request OpenGL 3.2.\n" + "\n" + " --profile\n" + " One of: core, compat or none\n" + "\n" + " -v, --verbose\n" " Print more information.\n" "\n" " --forward-compatible\n" @@ -80,14 +82,21 @@ static const char *usage_message = "\n" " --debug-context\n" " Create a debug context.\n" + "\n" + "Examples:\n" + " wflinfo --platform=glx --api=gl\n" + " wflinfo --platform=x11_egl --api=gl --version=3.2 --profile=core\n" + " wflinfo --platform=wayland --api=gles3\n" + " wflinfo --platform=gbm --api=gl --version=3.2 --verbose\n" + " wflinfo -p gbm -a gl -V 3.2 -v\n" ; enum { - OPT_PLATFORM = 1, - OPT_API, - OPT_VERSION, + OPT_PLATFORM = 'p', + OPT_API = 'a', + OPT_VERSION = 'V', OPT_PROFILE, - OPT_VERBOSE, + OPT_VERBOSE = 'v', OPT_DEBUG_CONTEXT, OPT_FORWARD_COMPATIBLE, }; @@ -297,7 +306,7 @@ parse_args(int argc, char *argv[], struct options *opts) opts->context_version = -1; while (loop_get_opt) { - int opt = getopt_long(argc, argv, "", get_opts, NULL); + int opt = getopt_long(argc, argv, "a:p:vV:", get_opts, NULL); switch (opt) { case -1: loop_get_opt = false; @@ -387,7 +396,10 @@ parse_args(int argc, char *argv[], struct options *opts) return true; error_unrecognized_arg: - usage_error_printf("unrecognized option '%s'", optarg); + if (optarg) + usage_error_printf("unrecognized option '%s'", optarg); + else + usage_error_printf("parameter error"); } /// @} |