From 7c6f0c4a04267d37e43d3c45b5043907b71b34a8 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Sat, 3 Mar 2012 18:42:12 +0100 Subject: [PATCH] Added "--version" switch --- Makefile | 2 +- arexxd.c | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 823a8c6..e6b3d4c 100644 --- 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 diff --git a/arexxd.c b/arexxd.c index 9fcae6e..76cbc3f 100644 --- 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 \n"); + return 0; default: usage(); } -- 2.39.2