X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;f=database%2Fdatabase.c;h=033875b55eb60aa45648f6fcfe86639ada4061ad;hb=c38b2e192d8de8ef38389cc8071881464fff99bb;hp=9079ff4e422fc09f060532e6737f76f916e201b3;hpb=7a6eb2318ad7e2c245649213780ad14ecc9a64a7;p=blerg.git diff --git a/database/database.c b/database/database.c index 9079ff4..033875b 100644 --- a/database/database.c +++ b/database/database.c @@ -13,7 +13,9 @@ #include #include #include "database.h" +#include "configuration.h" #include "subscription.h" +#include "tags.h" #include "util.h" #include "config.h" @@ -23,6 +25,13 @@ return r; \ } +int blerg_init() { + if (!blerg_configuration_init()) { + return 0; + } + return 1; +} + uint64_t blerg_get_record_count(struct blerg *blerg) { uint64_t count; flock(blerg->meta_fd, LOCK_SH); @@ -148,7 +157,7 @@ int blerg_exists(const char *name) { return 0; } - snprintf(filename, 512, "%s/%s", DATA_PATH, name); + snprintf(filename, 512, "%s/%s", blergconf.data_path, name); if (access(filename, F_OK) == -1) return 0; else @@ -179,7 +188,7 @@ struct blerg *blerg_open(const char *name) { /* Make the directory if it doesn't exist */ blerg->base_path = malloc(512); - snprintf(blerg->base_path, 512, "%s/%s", DATA_PATH, name); + snprintf(blerg->base_path, 512, "%s/%s", blergconf.data_path, name); if (access(blerg->base_path, F_OK) == -1) mkdir(blerg->base_path, 0755);