[PATCH:xcmsdb 3/6] Add -version option to print program version

Alan Coopersmith alan.coopersmith at oracle.com
Tue Nov 26 21:45:15 PST 2013


Adds both -version and previously undocumented -help to man page

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 man/xcmsdb.man |    7 +++++++
 xcmsdb.c       |    8 ++++++++
 2 files changed, 15 insertions(+)

diff --git a/man/xcmsdb.man b/man/xcmsdb.man
index f08604f..48ce6e1 100644
--- a/man/xcmsdb.man
+++ b/man/xcmsdb.man
@@ -33,6 +33,7 @@ xcmsdb \- Device Color Characterization utility for X Color Management System
 .B xcmsdb
 [ \fB\-query\fP ] [ \fB\-remove\fP ]
 [ \fB\-format\032\fP|\fB16\fP|\fB8\fP ]
+[ \fB\-help\fP ] [ \fB\-version\fP ]
 [ \fIfilename\fP ]
 .SH DESCRIPTION
 .I xcmsdb
@@ -85,6 +86,12 @@ XDCCC_LINEAR_RGB_CORRECTION property.
 Precision of encoded floating point values increases with the increase
 in bits per entry.
 The default is 32 bits per entry.
+.TP 8
+.B \-help
+This option prints a summary of the available options and exits.
+.TP 8
+.B \-version
+This option prints the program version and exits.
 .SH "SEE ALSO"
 xprop(__appmansuffix__), Xlib documentation
 .SH ENVIRONMENT
diff --git a/xcmsdb.c b/xcmsdb.c
index 21255e2..973c6ab 100644
--- a/xcmsdb.c
+++ b/xcmsdb.c
@@ -35,6 +35,10 @@
  *      INCLUDES
  */
 
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <X11/Xlib.h>
@@ -70,6 +74,7 @@ Syntax (int exitcode)
 	     "    -color                       use color as default\n");
 	     "    -gray                        use gray-scale as default\n");
 #endif /* GRAY */
+	     "    -version                     print program version\n"
 	     "\n");
     exit (exitcode);
 }
@@ -154,6 +159,9 @@ main(int argc, char *argv[])
 		color = 0;
 		continue;
 #endif /* GRAY */
+	    } else if (optionmatch ("-version", arg, 1)) {
+		puts (PACKAGE_STRING);
+		exit (0);
 	    }
 	    fprintf (stderr, "%s: unrecognized option '%s'\n",
 		     ProgramName, arg);
-- 
1.7.9.2



More information about the xorg-devel mailing list