summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2014-05-31 22:43:41 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2014-05-31 22:43:41 -0700
commita58064faa6cc5488e514debd3dfc023741d6a9ea (patch)
treedc37af50d6a25c90e0e62ec91b2b291586b9cc8f
parentd684b13c7b3b8fbdda6d84dae342ad901672eb1c (diff)
Add -version option to print program version
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--man/xlsatoms.man3
-rw-r--r--xlsatoms.c14
2 files changed, 16 insertions, 1 deletions
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 <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -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",