From 545db04829433b7d30de75ea03dc4495a91a8ab6 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 31 May 2014 20:16:42 -0700 Subject: Add -version option to print program version Signed-off-by: Alan Coopersmith --- man/xkbprint.man | 3 +++ xkbprint.c | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/man/xkbprint.man b/man/xkbprint.man index 97fe5c9..c19732c 100644 --- a/man/xkbprint.man +++ b/man/xkbprint.man @@ -100,6 +100,9 @@ Controls use of pictographs instead of keysym names where available. .B -synch Forces synchronization for X requests. .TP 8 +.B -version +Print out the program version and exit. +.TP 8 .B -w\ \fIlevel\fP Sets warning level (0 for no warning, 10 for all warnings). .SH "SEE ALSO" diff --git a/xkbprint.c b/xkbprint.c index b800381..c7f4310 100644 --- a/xkbprint.c +++ b/xkbprint.c @@ -119,6 +119,7 @@ Usage(int argc, char *argv[]) " keysym names where available, can\n" " be \"all\", \"none\" or \"common\" (default)\n" "-synch Force synchronization\n" + "-version Print program version\n" "-w Set warning level (0=none, 10=all)\n" ); } @@ -387,6 +388,10 @@ parseArgs(int argc, char *argv[]) (strcmp(argv[i], "-s") == 0)) { synch = True; } + else if (strcmp(argv[i], "-version") == 0) { + puts(PACKAGE_STRING); + exit(0); + } else if (strcmp(argv[i], "-w") == 0) { if ((i >= (argc - 1)) || (!isdigit(argv[i + 1][0]))) { warningLevel = 0; -- cgit v1.2.3