diff options
author | Jon TURNEY <jon.turney@dronecode.org.uk> | 2012-11-23 00:04:22 +0000 |
---|---|---|
committer | Jon TURNEY <jon.turney@dronecode.org.uk> | 2012-12-17 22:30:38 +0000 |
commit | 91df9deb354dd91a8a9c50a0005761658a915b65 (patch) | |
tree | b4219fa23811b5dfb0c18ed5c7e4697fb040c8ff | |
parent | 1e1379861f78299f577537b8e5ade4372be9c9c0 (diff) |
Add --version option
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | src/main.c | 14 |
2 files changed, 14 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac index 479cbdc..086b6c7 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_PREREQ(2.61) -AC_INIT([XtoW], [0.1]) +AC_INIT([XtoW], m4_esyscmd([date -u +%Y%m%d | tr -d '\n'])) AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_CONFIG_HEADER([config.h]) @@ -24,6 +24,7 @@ #include <xcwm/xcwm.h> #include <semaphore.h> +#include "config.h" #include "debug.h" #include "global.h" #include "wndproc.h" @@ -115,6 +116,13 @@ help(void) exit(0); } +static void +version(void) +{ + fprintf(stderr, PACKAGE " " PACKAGE_VERSION "\n"); + exit(0); +} + int main(int argc, char **argv) { char *screen = NULL; @@ -124,6 +132,7 @@ int main(int argc, char **argv) { static struct option long_options[] = { + { "version", no_argument, 0, 'v' }, { "display", required_argument, 0, 'd' }, { "help", no_argument, 0, 'h' }, { "blur", no_argument, 0, 'b' }, @@ -132,7 +141,7 @@ int main(int argc, char **argv) }; int option_index = 0; - int c = getopt_long_only(argc, argv, "d:h", long_options, &option_index); + int c = getopt_long_only(argc, argv, "d:hv", long_options, &option_index); if (c == -1) break; @@ -148,6 +157,9 @@ int main(int argc, char **argv) case 'n': nodwm = 1; break; + case 'v': + version(); + break; case 'h': default: help(); |