From 82f549d1c8780538fb115ee2768d2f4024d302b2 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 31 May 2014 23:49:27 -0700 Subject: Add -version option to print program version Signed-off-by: Alan Coopersmith --- man/xmodmap.man | 5 +++++ xmodmap.c | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/man/xmodmap.man b/man/xmodmap.man index 1ed1ca1..5d38fa5 100644 --- a/man/xmodmap.man +++ b/man/xmodmap.man @@ -86,6 +86,11 @@ unhandled argument is given to This option indicates that a help message describing the expression grammar used in files and with \-e expressions should be printed on the standard error. .TP 8 +.B \-version +This option indicates that +.I xmodmap +should print its version information and exit. +.TP 8 .B \-verbose This option indicates that .I xmodmap diff --git a/xmodmap.c b/xmodmap.c index 2a10976..ffa6cea 100644 --- a/xmodmap.c +++ b/xmodmap.c @@ -116,6 +116,7 @@ static const char help_message[] = " -pp print pointer map\n" " -help print this usage message\n" " -grammar print out short help on allowable input\n" +" -version print program version\n" " - read standard input\n" "\n"; @@ -195,6 +196,11 @@ main(int argc, char *argv[]) case 'h': /* -help */ case '?': usage(0); + case 'v': + if (strcmp(arg, "-version") == 0) { + puts(PACKAGE_STRING); + exit(0); + } } } } -- cgit v1.2.3