summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-11-26 21:26:54 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2013-11-26 21:26:57 -0800
commit93fcd59757e87cb79db8a98e0379c0a90eddae4c (patch)
tree4c4f55fe8a6c52b1db5bc95d3a5d434476b1476d
parentdfd9fa8720cb8001d6569cd8b4d65819ff9d5ba5 (diff)
Add -version option to print program version
Adds both -version and previously undocumented -help to man page Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--man/xcmsdb.man7
-rw-r--r--xcmsdb.c8
2 files changed, 15 insertions, 0 deletions
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);