From a58064faa6cc5488e514debd3dfc023741d6a9ea Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 31 May 2014 22:43:41 -0700 Subject: Add -version option to print program version Signed-off-by: Alan Coopersmith --- man/xlsatoms.man | 3 +++ xlsatoms.c | 14 +++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/man/xlsatoms.man b/man/xlsatoms.man index b149c2b..afa89bf 100644 --- a/man/xlsatoms.man +++ b/man/xlsatoms.man @@ -54,6 +54,9 @@ stop at the first undefined atom at or above \fIlow\fP. .B \-name \fIstring\fP This option specifies the name of an atom to list. If the atom does not exist, a message will be printed on the standard error. +.TP 8 +.B "-version" +Print out the program version and exit. .PP .SH "SEE ALSO" X(__miscmansuffix__), Xserver(__appmansuffix__), xprop(__appmansuffix__) diff --git a/xlsatoms.c b/xlsatoms.c index 717b42b..d3e0883 100644 --- a/xlsatoms.c +++ b/xlsatoms.c @@ -27,6 +27,10 @@ in this Software without prior written authorization from The Open Group. * Author: Peter Harris, Open Text Corporation */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include #include #include @@ -57,7 +61,9 @@ usage(const char *errmsg) " -display dpy X server to which to connect\n" " -format string printf-style format to use\n" " -range [num]-[num] atom values to list\n" - " -name string name of single atom to print\n"); + " -name string name of single atom to print\n" + " -version print program version\n" + ); exit (1); } @@ -100,6 +106,12 @@ main(int argc, char *argv[]) didit = 1; } continue; + case 'v': + if (strcmp(arg, "-version") == 0) { + puts(PACKAGE_STRING); + exit(0); + } + /* else FALLTHROUGH to unrecognized arg case below */ } } fprintf (stderr, "%s: unrecognized argument %s\n\n", -- cgit v1.2.3