[PATCH vkd3d 3/5] vkd3d-compiler: Add an explicit --help option.

Henri Verbeet hverbeet at codeweavers.com
Thu Jul 2 08:43:14 CDT 2020


Signed-off-by: Henri Verbeet <hverbeet at 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




More information about the wine-devel mailing list