[PATCH:xrdb 2/2] Add -version flag to print package version string from autoconf

Alan Coopersmith alan.coopersmith at oracle.com
Fri Jul 19 19:52:18 PDT 2013


Also adds missing entry for -help flag to usage message.

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 man/xrdb.man |    4 ++++
 xrdb.c       |    5 +++++
 2 files changed, 9 insertions(+)

diff --git a/man/xrdb.man b/man/xrdb.man
index 7f0ccf1..211c0a2 100644
--- a/man/xrdb.man
+++ b/man/xrdb.man
@@ -168,6 +168,10 @@ program accepts the following options:
 This option (or any unsupported option) will cause a brief description of
 the allowable options and parameters to be printed.
 .TP 8
+.B \-version
+This option will cause the xrdb version to be printed and the program to exit
+without performing any other operations.
+.TP 8
 .B \-display \fIdisplay\fP
 This option specifies the X server to be used; see \fIX(__miscmansuffix__)\fP.
 It also specifies the screen to use for the \fI-screen\fP option,
diff --git a/xrdb.c b/xrdb.c
index 58dd049..24a6aa5 100644
--- a/xrdb.c
+++ b/xrdb.c
@@ -738,6 +738,8 @@ Syntax (void)
     fprintf (stderr,
 	     "usage:  %s [-options ...] [filename]\n\n"
 	     "where options include:\n"
+	     " -help               print this help message\n"
+	     " -version            print the program version\n"
 	     " -display host:dpy   display to use\n"
 	     " -all                do all resources [default]\n"
 	     " -global             do screen-independent resources\n"
@@ -898,6 +900,9 @@ main(int argc, char *argv[])
 	    } else if (isabbreviation ("-help", arg, 2)) {
 		Syntax ();
 		/* doesn't return */
+	    } else if (isabbreviation ("-version", arg, 2)) {
+		printf("%s\n", PACKAGE_STRING);
+		exit(0);
 	    } else if (isabbreviation ("-display", arg, 2)) {
 		if (++i >= argc) Syntax ();
 		displayname = argv[i];
-- 
1.7.9.2



More information about the xorg-devel mailing list