vkd3d-compiler: Add an explicit --help option.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2020-07-02 18:13:14 +04:30 committed by Alexandre Julliard
parent f658190794
commit 7df61873d0

View File

@ -31,7 +31,8 @@
enum 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) 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[] = static const char usage[] =
"[options...] file\n" "[options...] file\n"
"Options:\n" "Options:\n"
" -h, --help Display this information and exit.\n"
" -o <file> Write the output to <file>.\n" " -o <file> Write the output to <file>.\n"
" --strip-debug Strip debug information from the output.\n" " --strip-debug Strip debug information from the output.\n"
" -- Stop option processing. Any subsequent argument is\n" " -- Stop option processing. Any subsequent argument is\n"
@ -109,6 +111,7 @@ struct options
{ {
const char *filename; const char *filename;
const char *output_filename; const char *output_filename;
struct vkd3d_shader_compile_option compile_options[MAX_COMPILE_OPTIONS]; struct vkd3d_shader_compile_option compile_options[MAX_COMPILE_OPTIONS];
unsigned int compile_option_count; 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[] = static struct option long_options[] =
{ {
{"help", no_argument, NULL, OPTION_HELP},
{"strip-debug", no_argument, NULL, OPTION_STRIP_DEBUG}, {"strip-debug", no_argument, NULL, OPTION_STRIP_DEBUG},
{NULL, 0, NULL, 0}, {NULL, 0, NULL, 0},
}; };
@ -155,7 +159,7 @@ static bool parse_command_line(int argc, char **argv, struct options *options)
for (;;) for (;;)
{ {
if ((option = getopt_long(argc, argv, "o:", long_options, NULL)) == -1) if ((option = getopt_long(argc, argv, "ho:", long_options, NULL)) == -1)
break; break;
switch (option) switch (option)