From 93f490eee675d78d43dc459b7f3a01b3b06327a3 Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Sun, 20 Aug 2017 10:36:33 -0400 Subject: [PATCH] wmframepic: Add --version command line option --- 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.4.GIT