wmframepic: Add --version command line option

This commit is contained in:
Doug Torrance 2017-08-20 10:36:33 -04:00 committed by Carlos R. Mafra
parent 5214230797
commit 93f490eee6

View file

@ -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.*/