From 1bd44d156294855ec72f69eb6721f48685880802 Mon Sep 17 00:00:00 2001 From: Jan-Piet Mens Date: Thu, 10 Sep 2015 12:17:14 +0200 Subject: [PATCH] storage default directory from config.mk --- Makefile | 5 ++++- config.mk.in | 2 ++ ocat.c | 2 +- ot-recorder.c | 2 +- storage.c | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index c14a549..c1fe4b2 100644 --- a/Makefile +++ b/Makefile @@ -27,6 +27,9 @@ ifeq ($(HAVE_HTTP),yes) LIBS += -lssl endif +CFLAGS += -DSTORAGEDEFAULT=\"$(STORAGEDEFAULT)\" + + TARGETS += ot-recorder ocat ghashfind @@ -59,7 +62,7 @@ http.o: http.c mongoose.h util.h http.h storage.h util.o: util.c util.h Makefile config.mk ghashfind.o: ghashfind.c util.h mongoose.o: mongoose.c mongoose.h -ocat.o: ocat.c storage.h util.h +ocat.o: ocat.c storage.h util.h config.mk storage.o: storage.c storage.h config.h util.h gcache.h ghash2lmdb.o: ghash2lmdb.c gcache.h diff --git a/config.mk.in b/config.mk.in index eca3c42..f01b834 100644 --- a/config.mk.in +++ b/config.mk.in @@ -2,6 +2,8 @@ HAVE_HTTP ?= yes HAVE_LMDB ?= yes +STORAGEDEFAULT = "./store" + # Optionally specify the path to the Mosquitto libs, include here MOSQUITTO_INC = -I/usr/include MOSQUITTO_LIB = -L/usr/lib diff --git a/ocat.c b/ocat.c index 8a5784b..2c73e89 100644 --- a/ocat.c +++ b/ocat.c @@ -140,7 +140,7 @@ void usage(char *prog) printf(" --fields tst,lat,lon,... Choose fields for CSV. (dflt: ALL)\n"); printf(" --last -L JSON object with last users\n"); printf(" --killdata requires -u and -d\n"); - printf(" --storage -S storage dir (./store)\n"); + printf(" --storage -S storage dir (%s)\n", STORAGEDEFAULT); printf(" --norevgeo -G disable ghash to reverge-geo lookups\n"); printf(" --precision ghash precision (dflt: %d)\n", GEOHASH_PREC); printf("\n"); diff --git a/ot-recorder.c b/ot-recorder.c index 82d8e5c..1cf1967 100644 --- a/ot-recorder.c +++ b/ot-recorder.c @@ -685,7 +685,7 @@ void usage(char *prog) { printf("Usage: %s [options..] topic [topic ...]\n", prog); printf(" --help -h this message\n"); - printf(" --storage -S storage dir (./store)\n"); + printf(" --storage -S storage dir (%s)\n", STORAGEDEFAULT); printf(" --norevgeo -G disable ghash to reverge-geo lookups\n"); printf(" --skipdemo -D do not handle objects with _demo\n"); printf(" --useretained -R process retained messages (default: no)\n"); diff --git a/storage.c b/storage.c index 4b714cd..e2064a2 100644 --- a/storage.c +++ b/storage.c @@ -38,7 +38,7 @@ #include "util.h" #include "udata.h" -char STORAGEDIR[BUFSIZ] = "./store"; +char STORAGEDIR[BUFSIZ] = STORAGEDEFAULT; #define LINESIZE 8192