]> mj.ucw.cz Git - arexx.git/commitdiff
Added "--version" switch
authorMartin Mares <mj@ucw.cz>
Sat, 3 Mar 2012 17:42:12 +0000 (18:42 +0100)
committerMartin Mares <mj@ucw.cz>
Sat, 3 Mar 2012 17:42:12 +0000 (18:42 +0100)
Makefile
arexxd.c

index 823a8c600e017d585b4d96a9ecd32e67cba2bd7d..e6b3d4c73a311d5d55e1f8917dc33799cba7cbc5 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@ ARCHIVE=arexxd-$(VERSION).tar.gz
 
 CC=gcc
 LD=gcc
-CFLAGS=-O2 -Wall -W -Wno-parentheses -Wstrict-prototypes -Wmissing-prototypes -Wundef -Wredundant-decls -std=gnu99
+CFLAGS=-O2 -Wall -W -Wno-parentheses -Wstrict-prototypes -Wmissing-prototypes -Wundef -Wredundant-decls -std=gnu99 -DAREXXD_VERSION='"$(VERSION)"'
 LDLIBS=-lusb-1.0 -lm -lrrd
 
 all: arexxd
index 9fcae6e0806963534892ffded8fdcea55befd227..76cbc3fd5b81028e2c169c9d3079788c4ef4a3e0 100644 (file)
--- a/arexxd.c
+++ b/arexxd.c
@@ -571,6 +571,7 @@ static const struct option long_options[] = {
        { "log-dir",            1, NULL, 'l' },
        { "debug-packets",      0, NULL, 'p' },
        { "debug-raw",          0, NULL, 'r' },
+       { "version",            0, NULL, 'V' },
        { NULL,                 0, NULL, 0 },
 };
 
@@ -585,6 +586,7 @@ Options:\n\
 -p, --debug-packets    Log all packets sent and received\n\
 -r, --debug-raw                Log conversion from raw values\n\
 -u, --debug-usb                Enable libusb debug messages (to stdout/stderr)\n\
+-V, --version          Show daemon version\n\
 ");
        exit(1);
 }
@@ -592,7 +594,7 @@ Options:\n\
 int main(int argc, char **argv)
 {
        int opt;
-       while ((opt = getopt_long(argc, argv, "dl:pru", long_options, NULL)) >= 0)
+       while ((opt = getopt_long(argc, argv, "dl:pruV", long_options, NULL)) >= 0)
                switch (opt) {
                        case 'd':
                                debug_mode++;
@@ -609,6 +611,10 @@ int main(int argc, char **argv)
                        case 'u':
                                debug_usb++;
                                break;
+                       case 'V':
+                               printf("arexxd " AREXXD_VERSION "\n");
+                               printf("(c) 2011-2012 Martin Mares <mj@ucw.cz>\n");
+                               return 0;
                        default:
                                usage();
                }