From f8a2678debd6552864f5d059011178013f12b318 Mon Sep 17 00:00:00 2001 From: Rhizome Date: Mon, 8 Apr 2024 18:45:40 +0100 Subject: [PATCH] Allow path to config file to be specified in command args --- rotagen.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rotagen.c b/rotagen.c index c2ed791..e5c9701 100644 --- a/rotagen.c +++ b/rotagen.c @@ -22,7 +22,7 @@ static void *pool_alloc(int size) return ptr; } -int main(void) +int main(int argc, char **argv) { free_ptr = &pool[0]; @@ -38,8 +38,9 @@ int main(void) } srand(seed); + const char *config_path = argc > 1 ? argv[1] : "rotagen.conf"; memset(&conf, 0, sizeof(conf)); - read_config("rotagen.conf", &conf); + read_config(config_path, &conf); struct slot_result *rota = pool_alloc(conf.num_slots * sizeof(struct slot_result));