Skip to content

Commit 6838bf1

Browse files
authored
Merge pull request #28 from music-assistant/15-eliminate-requirement-for-configuration-file
Default to no config file
2 parents 0722bf9 + dcb2b6f commit 6838bf1

File tree

2 files changed

+26
-25
lines changed

2 files changed

+26
-25
lines changed

src/cliap2.c

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -148,17 +148,17 @@ usage(char *program)
148148
printf(" --logfile <filename> Log filename. Not supplying this argument will result in logging to stderr only.\n");
149149
printf(" --logdomains <dom,dom..> Log domains\n");
150150
printf(" --config <file> Use <file> as the configuration file\n");
151-
printf(" --name <name> Name of the airplay 2 device\n");
152-
printf(" --hostname <hostname> Hostname of AirPlay 2 device\n");
153-
printf(" --address <address> IP address to bind to for AirPlay 2 service\n");
154-
printf(" --port <port> Port number to bind to for AirPlay 2 service\n");
155-
printf(" --txt <txt> txt keyvals returned in mDNS for AirPlay 2 service\n");
156-
printf(" --pipe filename of named pipe to read streamed audio\n");
157-
printf(" --ntp Print current NTP time and exit\n");
151+
printf(" --name <name> Name of the airplay 2 device. Mandatory in absence of --ntpstart.\n");
152+
printf(" --hostname <hostname> Hostname of AirPlay 2 device. Mandatory in absence of --ntpstart.\n");
153+
printf(" --address <address> IP address to bind to for AirPlay 2 service. Mandatory in absence of --ntpstart.\n");
154+
printf(" --port <port> Port number to bind to for AirPlay 2 service. Mandatory in absence of --ntpstart.\n");
155+
printf(" --txt <txt> txt keyvals returned in mDNS for AirPlay 2 service. Mandatory in absence of --ntpstart.\n");
156+
printf(" --pipe filename of named pipe to read streamed audio. Mandatory in absence of --ntpstart.\n");
157+
printf(" --ntp Print current NTP time and exit.\n");
158158
printf(" --wait Start playback after <wait> milliseconds\n");
159-
printf(" --ntpstart Start playback at NTP <start> + <wait>\n");
159+
printf(" --ntpstart Start playback at NTP <start> + <wait>. Mandatory in absence of --ntpstart.\n");
160160
printf(" --latency Latency to apply in frames\n");
161-
printf(" --volume Initial volume (0-100)\n");
161+
printf(" --volume Initial volume (0-100). Mandatory in absence of --ntpstart.\n");
162162
printf(" -v, --version Display version information and exit\n");
163163
printf("\n\n");
164164
printf("Available log domains:\n");
@@ -488,7 +488,7 @@ int
488488
main(int argc, char **argv)
489489
{
490490
int option;
491-
char *configfile = CONFFILE;
491+
char *configfile = NULL; // default to no config file
492492
bool background = false;
493493
bool testrun = false;
494494
bool mdns_no_rsp = true;
@@ -670,7 +670,6 @@ main(int argc, char **argv)
670670

671671
return EXIT_FAILURE;
672672
}
673-
// logger_detach(); // Eliminate logging to stderr
674673

675674
ret = conffile_load(configfile);
676675
if (ret != 0) {

src/conffile.c

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -396,20 +396,22 @@ conffile_load(char *file)
396396

397397
cfg_set_error_function(cfg, logger_confuse);
398398

399-
ret = cfg_parse(cfg, file);
400-
401-
if (ret == CFG_FILE_ERROR)
402-
{
403-
DPRINTF(E_FATAL, L_CONF, "Could not open config file %s\n", file);
404-
405-
goto out_fail;
406-
}
407-
else if (ret == CFG_PARSE_ERROR)
408-
{
409-
DPRINTF(E_FATAL, L_CONF, "Parse error in config file %s\n", file);
410-
411-
goto out_fail;
412-
}
399+
if (file) { // makes config file optional
400+
ret = cfg_parse(cfg, file);
401+
402+
if (ret == CFG_FILE_ERROR)
403+
{
404+
DPRINTF(E_FATAL, L_CONF, "Could not open config file %s\n", file);
405+
406+
goto out_fail;
407+
}
408+
else if (ret == CFG_PARSE_ERROR)
409+
{
410+
DPRINTF(E_FATAL, L_CONF, "Parse error in config file %s\n", file);
411+
412+
goto out_fail;
413+
}
414+
}
413415

414416
return 0;
415417

0 commit comments

Comments
 (0)