diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2014-05-24 10:34:23 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2014-05-24 10:36:15 -0700 |
commit | 4b5048012f1197400c98d58f2234ba674099174b (patch) | |
tree | b840791ffdfa1d7e3383bcdf2f83cc7e0f4cf1c3 | |
parent | 5a4e873be460f96629f574c7e127ad3868f7c7e4 (diff) |
Add -version option to print program version
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | man/xgamma.man | 6 | ||||
-rw-r--r-- | xgamma.c | 8 |
2 files changed, 13 insertions, 1 deletions
diff --git a/man/xgamma.man b/man/xgamma.man index d6662f7..1cb33d1 100644 --- a/man/xgamma.man +++ b/man/xgamma.man @@ -23,7 +23,7 @@ xgamma - Alter a monitor's gamma correction through the X server .SH SYNOPSIS .B "xgamma" -[-display \fIdisplay\fP] [-screen \fIscreen\fP] [-quiet] +[-display \fIdisplay\fP] [-screen \fIscreen\fP] [-quiet] [-version] [-gamma f.f | [[-rgamma f.f] [-ggamma f.f] [-bgamma f.f]]] .SH DESCRIPTION .PP @@ -62,6 +62,10 @@ Silence the normal output of Print out the `Usage:' command syntax summary. .PP .TP 8 +.B "-version" +Print out the program version and exit. +.PP +.TP 8 .B "-gamma f.f" The gamma correction can either be defined as a single value, or separately for the red, green and blue components. This argument @@ -22,6 +22,10 @@ * Written by David Bateman */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include <stdio.h> #include <errno.h> #include <X11/Xos.h> @@ -54,6 +58,7 @@ Syntax(const char *errmsg) " -display host:dpy or -d\n" " -quiet or -q\n" " -screen or -s\n" + " -version or -v\n" " -gamma f.f Gamma Value\n" " -rgamma f.f Red Gamma Value\n" " -ggamma f.f Green Gamma Value\n" @@ -113,6 +118,9 @@ main(int argc, char *argv[]) } else if (isabbreviation ("-quiet", arg, 1)) { quiet = True; continue; + } else if (isabbreviation ("-version", arg, 1)) { + puts(PACKAGE_STRING); + exit(0); } else if (isabbreviation ("-screen", arg, 1)) { if (++i >= argc) Syntax ("-screen requires an argument"); screen = atoi(argv[i]); |