From 70c75b22f4dee883941495e8dbc6dfa58c1991dd Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Tue, 26 Nov 2013 23:15:30 -0800 Subject: 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 --- man/xdriinfo.man | 10 +++++++++- xdriinfo.c | 9 ++++++++- 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 #include @@ -44,7 +48,7 @@ void printUsage (void); void printUsage (void) { fprintf (stderr, -"Usage: xdriinfo [-display ] [command]\n" +"Usage: xdriinfo [-display ] [-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]); -- cgit v1.2.3