[PATCH 10/11] wmframepic: Add --version command line option

Doug Torrance <[email protected]> Sun, 20 Aug 2017 10:36:33 -0400
Newsgroups gmane.compw.window-managers.windowmaker.devel
Message-ID <[email protected]>
---
 wmframepic/src/arg_parser.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/wmframepic/src/arg_parser.c b/wmframepic/src/arg_parser.c
index 2080427..566a8be 100644
--- a/wmframepic/src/arg_parser.c
+++ b/wmframepic/src/arg_parser.c
@@ -16,9 +16,10 @@ int get_values_from_command_line(int argc, char **argv,
 	struct arg_int 	*day		= arg_int1("d", "day", "int", "the day of birth");
 	struct arg_int 	*month		= arg_int1("m", "month", "int", "the month of birth");
 	struct arg_int 	*year		= arg_int1("y", "year", "int", "the year of birth");
+	struct arg_lit  *version        = arg_lit0("v", "version", "print the version and exit");
     struct arg_lit  *help    	= arg_lit0(NULL, "help", "print this help and exit");
     struct arg_end  *end     	= arg_end(20);
-    void* argtable[] = {name, xpm_file, day, month, year, help, end};
+    void* argtable[] = {name, xpm_file, day, month, year, help, version, end};
     const char* progname = "wmframepic";
     int nerrors;
     int exitcode = COMMAND_LINE_SUCCESS;
@@ -54,6 +55,12 @@ I'm sure you will enjoy!\n\n");
 		goto exit;
 	}
 
+    if (version->count > 0) {
+	    printf("%s\n", PACKAGE_STRING);
+	    exitcode = COMMAND_LINE_HELP;
+	    goto exit;
+    }
+
     /* If the parser returned any errors then display them and exit */
     if (nerrors > 0) {
 		/* Display the error details contained in the arg_end struct.*/
-- 
2.11.0


-- 
To unsubscribe, send mail to [email protected].