summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-11-26 23:15:30 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2013-11-26 23:16:02 -0800
commit70c75b22f4dee883941495e8dbc6dfa58c1991dd (patch)
tree13057168f7babfeb33a0fa0a3f2d9170a553448d
parent3bac938bf49e6e543ffeaf7bbc0e6c17f5b30416 (diff)
Add -version option to print program version
Add both -version & -display to man page, since options were not previously documented. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--man/xdriinfo.man10
-rw-r--r--xdriinfo.c9
2 files changed, 17 insertions, 2 deletions
diff --git a/man/xdriinfo.man b/man/xdriinfo.man
index 75b9fc0..ec63d1d 100644
--- a/man/xdriinfo.man
+++ b/man/xdriinfo.man
@@ -4,12 +4,20 @@
xdriinfo \- query configuration information of DRI drivers
.SH SYNOPSIS
.B xdriinfo
-[\-display \fIdisplayname\fP] [command]
+[\-display \fIdisplayname\fP] [-version] [command]
.SH DESCRIPTION
\fIxdriinfo\fP can be used to query configuration information of
direct rendering drivers. If no command argument is specified it lists
the names of the direct rendering drivers for all screens.
.PP
+Valid options are:
+.TP
+.B -display
+Specifies X server to connect to.
+.TP
+.B -version
+Print the program version and exit.
+.PP
Valid commands are:
.TP
.B nscreens
diff --git a/xdriinfo.c b/xdriinfo.c
index 9118ea9..c23cfa1 100644
--- a/xdriinfo.c
+++ b/xdriinfo.c
@@ -22,6 +22,10 @@
*
*/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#define GLX_GLXEXT_PROTOTYPES
#include <GL/glx.h>
#include <GL/glxext.h>
@@ -44,7 +48,7 @@ void printUsage (void);
void printUsage (void) {
fprintf (stderr,
-"Usage: xdriinfo [-display <dpy>] [command]\n"
+"Usage: xdriinfo [-display <dpy>] [-version] [command]\n"
"Commands:\n"
" nscreens print the number of screens on display\n"
" driver screen print the DRI driver name of screen\n"
@@ -79,6 +83,9 @@ int main (int argc, char *argv[]) {
} else if (!strcmp (argv[i], "options")) {
func = OPTIONS;
argPtr = &funcArg;
+ } else if (!strcmp (argv[i], "-version")) {
+ puts(PACKAGE_STRING);
+ return 0;
} else {
fprintf (stderr, "%s: unrecognized argument '%s'\n",
argv[0], argv[i]);