From 4f30890daa5f982a43bbe41e89129e27578cae81 Mon Sep 17 00:00:00 2001 From: Alex Dowad Date: Wed, 16 Apr 2014 21:59:58 +0200 Subject: squark-filter, squark-auth-ip: config file path can be set using -c option --- src/config.c | 2 +- src/config.h | 2 +- src/squark-auth-ip.c | 5 ++++- src/squark-filter.c | 5 ++++- 4 files changed, 10 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/config.c b/src/config.c index 4ed3f4a..aea8fee 100644 --- a/src/config.c +++ b/src/config.c @@ -9,5 +9,5 @@ */ const char *squark_version = SQUARK_VERSION; -const char *squark_config = CONFDIR "/squark.conf"; +char *squark_config = CONFDIR "/squark.conf"; const char *squark_dbname = LIBDIR "/squark.db"; diff --git a/src/config.h b/src/config.h index 933a663..de633f5 100644 --- a/src/config.h +++ b/src/config.h @@ -4,7 +4,7 @@ #define DEFAULT_LOGOUT_TIMEOUT (15*60) /* seconds */ extern const char *squark_version; -extern const char *squark_config; +extern char *squark_config; extern const char *squark_dbname; #endif diff --git a/src/squark-auth-ip.c b/src/squark-auth-ip.c index 20c7d35..22e8fc0 100644 --- a/src/squark-auth-ip.c +++ b/src/squark-auth-ip.c @@ -126,11 +126,14 @@ int main(int argc, char **argv) reporting_init("squark-auth-ip"); - while ((opt = getopt(argc, argv, "Vi:u:olpLrsqv::")) != -1) { + while ((opt = getopt(argc, argv, "Vc:i:u:olpLrsqv::")) != -1) { switch (opt) { case 'V': fprintf(stderr, "squark-auth-ip %s\n", squark_version); return 0; + case 'c': + squark_config = optarg; + break; case 'i': ip = BLOB_STRLEN(optarg); if (!addr_parse(ip, &ipaddr)) { diff --git a/src/squark-filter.c b/src/squark-filter.c index 50bd798..7aaaca5 100644 --- a/src/squark-filter.c +++ b/src/squark-filter.c @@ -462,11 +462,14 @@ int main(int argc, char **argv) reporting_init("squark-filter"); - while ((opt = getopt(argc, argv, "Vsqv::")) != -1) { + while ((opt = getopt(argc, argv, "Vc:sqv::")) != -1) { switch (opt) { case 'V': fprintf(stderr, "squark-filter %s\n", squark_version); return 0; + case 'c': + squark_config = optarg; + break; case 's': reporting_use_syslog(1); break; -- cgit v1.2.3