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

Alexandre Julliard julliard at winehq.org
Thu Jul 2 14:57:09 CDT 2020


Module: vkd3d
Branch: master
Commit: 7df61873d089965f718bbc978c46dd6f4074044d
URL:    https://source.winehq.org/git/vkd3d.git/?a=commit;h=7df61873d089965f718bbc978c46dd6f4074044d

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Thu Jul  2 18:31:14 2020 +0430

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

Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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)




More information about the wine-cvs mailing list