From 2b3f07e9b0efcdca8e4c83075280a6755f6c2b94 Mon Sep 17 00:00:00 2001 From: Philipp Schafft Date: Sat, 16 Jun 2018 17:33:14 +0000 Subject: [PATCH] Feature: Allow using default config filename. This uses the new configure option --with-default-config=PATH. --- src/main.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 91cf406d..1218aabf 100644 --- a/src/main.c +++ b/src/main.c @@ -168,7 +168,13 @@ static int _parse_config_opts(int argc, char **argv, char *filename, size_t size int config_ok = 0; background = 0; - if (argc < 2) return -1; + if (argc < 2) { + if (filename[0] != 0) { + return 1; + } else { + return -1; + } + } while (i < argc) { if (strcmp(argv[i], "-b") == 0) { @@ -493,7 +499,11 @@ int main(int argc, char **argv) #endif { int res, ret; - char filename[512]; +#ifdef ICECAST_DEFAULT_CONFIG + char filename[512] = ICECAST_DEFAULT_CONFIG; +#else + char filename[512] = ""; +#endif char pbuf[1024]; /* parse the '-c icecast.xml' option