diff options
| author | Ben Winston | 2024-05-26 21:04:58 -0400 |
|---|---|---|
| committer | Ben Winston | 2024-05-26 21:04:58 -0400 |
| commit | 139dae9ae1e1d86cb24d313a4b38c980cb915f29 (patch) | |
| tree | cfc3735f38217f14c75bafbd5dce44b9c3274da1 | |
| parent | ea977ce9907814cad0aa6986a539d29d56fe2bf7 (diff) | |
use an environment variable for the file
| -rw-r--r-- | booki.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -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) { |
