summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-01-13 14:46:23 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2013-01-13 14:46:23 -0800
commit4f5b605fc1339a9f0a12dca89863cb553e8af6cc (patch)
tree9474f76e7329d6cb1253d754583eba32a063c2e5
parenta7db7b1385ece9c10ad1d7c13d9c842b52a39002 (diff)
Add -version option
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--man/xvinfo.man3
-rw-r--r--xvinfo.c10
2 files changed, 12 insertions, 1 deletions
diff --git a/man/xvinfo.man b/man/xvinfo.man
index 742157b..75c792c 100644
--- a/man/xvinfo.man
+++ b/man/xvinfo.man
@@ -17,6 +17,9 @@ This argument allows you to specify the server to query; see \fIX(__miscmansuffi
.TP 8
.B "-short"
Output less details, to reduce the amount of text.
+.TP 8
+.B "-version"
+Output program version, then exit.
.SH ENVIRONMENT
.PP
.TP 8
diff --git a/xvinfo.c b/xvinfo.c
index bdc69cd..8df7aa6 100644
--- a/xvinfo.c
+++ b/xvinfo.c
@@ -1,3 +1,7 @@
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/extensions/Xvlib.h>
@@ -9,7 +13,7 @@
static void _X_NORETURN
PrintUsage(void)
{
- fprintf(stderr, "Usage: xvinfo [-display host:dpy] [-short]\n");
+ fprintf(stderr, "Usage: xvinfo [-display host:dpy] [-short] [-version]\n");
exit(0);
}
@@ -40,6 +44,10 @@ main(int argc, char *argv[])
}
else if (!strcmp(argv[i], "-short"))
shortmode = 1;
+ else if (!strcmp(argv[i], "-version")) {
+ printf("%s\n", PACKAGE_STRING);
+ exit(0);
+ }
else {
PrintUsage();
}