aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Winston2024-05-26 21:04:58 -0400
committerBen Winston2024-05-26 21:04:58 -0400
commit139dae9ae1e1d86cb24d313a4b38c980cb915f29 (patch)
treecfc3735f38217f14c75bafbd5dce44b9c3274da1
parentea977ce9907814cad0aa6986a539d29d56fe2bf7 (diff)
use an environment variable for the file
-rw-r--r--booki.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/booki.c b/booki.c
index fc6468f..7a1e41d 100644
--- a/booki.c
+++ b/booki.c
@@ -7,7 +7,6 @@
#include <sys/wait.h>
#include <unistd.h>
-#define BOOKI_FILE_REL ".local/share/booki/books.toml"
#define EDIT_FILE "tmp.toml"
#define MAX_SEARCH_OPTS 5
@@ -555,9 +554,12 @@ void help(bool err) {
int main(int argc, char* argv[]) {
- char* home = getenv("HOME");
- char booki_file[strlen(home) + strlen(BOOKI_FILE_REL) + 1];
- sprintf(booki_file, "%s/%s", home, BOOKI_FILE_REL);
+ char* booki_file = getenv("BOOKI_FILE");
+ if (!booki_file) {
+ printf("expecting BOOKI_FILE variable\n");
+ return 1;
+ }
+
char** remaining = NULL;
if (argc == 1) {