diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2013-11-25 22:40:43 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2013-11-25 22:41:12 -0800 |
commit | b2a08484343f0ae9b50309d3f69eeb0931223f14 (patch) | |
tree | dca1596fa4691b65ba7e2762d55a85207d25a612 | |
parent | 4080fb788adba0a851aff29b4dc4f5c71bf4b279 (diff) |
Add -version option to print program version
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | man/xbacklight.man | 2 | ||||
-rw-r--r-- | xbacklight.c | 11 |
2 files changed, 13 insertions, 0 deletions
diff --git a/man/xbacklight.man b/man/xbacklight.man index c3aa48e..5a10d6a 100644 --- a/man/xbacklight.man +++ b/man/xbacklight.man @@ -46,6 +46,8 @@ Increases brightness by the specified amount. Decreases brightness by the specified amount. .IP \-help Print out a summary of the usage and exit. +.IP \-version +Print out the program version and exit. .IP "\-time \fImilliseconds\fP" Length of time to spend fading the backlight between old and new value. Default is 200. diff --git a/xbacklight.c b/xbacklight.c index 4f384cc..21cca72 100644 --- a/xbacklight.c +++ b/xbacklight.c @@ -19,6 +19,11 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include <stdio.h> #include <stdlib.h> @@ -44,6 +49,7 @@ usage (int exitcode) " where options are:\n" " -display <display> or -d <display>\n" " -help\n" + " -version\n" " -set <percentage> or = <percentage>\n" " -inc <percentage> or + <percentage>\n" " -dec <percentage> or - <percentage>\n" @@ -200,6 +206,11 @@ main (int argc, char **argv) { usage (0); } + if (!strcmp (argv[i], "-version")) + { + puts (PACKAGE_STRING); + exit (0); + } fprintf(stderr, "%s: unrecognized argument '%s'\n", program_name, argv[i]); usage (1); |