[PATCH vkd3d 3/5] vkd3d-compiler: Add an explicit --help option.
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> --- programs/vkd3d-compiler/main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/programs/vkd3d-compiler/main.c b/programs/vkd3d-compiler/main.c index 8fa4d4f..e975572 100644 --- a/programs/vkd3d-compiler/main.c +++ b/programs/vkd3d-compiler/main.c @@ -31,7 +31,8 @@ enum { - OPTION_STRIP_DEBUG = CHAR_MAX + 1, + OPTION_HELP = CHAR_MAX + 1, + OPTION_STRIP_DEBUG, }; static bool read_shader(struct vkd3d_shader_code *shader, const char *filename) @@ -97,6 +98,7 @@ static void print_usage(const char *program_name) static const char usage[] = "[options...] file\n" "Options:\n" + " -h, --help Display this information and exit.\n" " -o <file> Write the output to <file>.\n" " --strip-debug Strip debug information from the output.\n" " -- Stop option processing. Any subsequent argument is\n" @@ -109,6 +111,7 @@ struct options { const char *filename; const char *output_filename; + struct vkd3d_shader_compile_option compile_options[MAX_COMPILE_OPTIONS]; unsigned int compile_option_count; }; @@ -147,6 +150,7 @@ static bool parse_command_line(int argc, char **argv, struct options *options) static struct option long_options[] = { + {"help", no_argument, NULL, OPTION_HELP}, {"strip-debug", no_argument, NULL, OPTION_STRIP_DEBUG}, {NULL, 0, NULL, 0}, }; @@ -155,7 +159,7 @@ static bool parse_command_line(int argc, char **argv, struct options *options) for (;;) { - if ((option = getopt_long(argc, argv, "o:", long_options, NULL)) == -1) + if ((option = getopt_long(argc, argv, "ho:", long_options, NULL)) == -1) break; switch (option) -- 2.11.0
Hi, While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=74666 Your paranoid android. === debiant (build log) === Task: Patch failed to apply === debiant (build log) === Task: Patch failed to apply
July 2, 2020 8:43 AM, "Henri Verbeet" <hverbeet(a)codeweavers.com> wrote:
diff --git a/programs/vkd3d-compiler/main.c b/programs/vkd3d-compiler/main.c index 8fa4d4f..e975572 100644 --- a/programs/vkd3d-compiler/main.c +++ b/programs/vkd3d-compiler/main.c @@ -147,6 +150,7 @@ static bool parse_command_line(int argc, char **argv, struct options *options)
static struct option long_options[] = { + {"help", no_argument, NULL, OPTION_HELP},
You know that if you have a long option that aliases a short option, you can just use the short option char as the code for the long option, right?
{"strip-debug", no_argument, NULL, OPTION_STRIP_DEBUG}, {NULL, 0, NULL, 0}, };
Chip
participants (3)
-
Chip Davis -
Henri Verbeet -
Marvin