From 887adb6b495ee8284ded77829b1c32c5f682fde5 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Sun, 5 May 2024 01:25:50 -0500 Subject: [PATCH] Update allsky_common.cpp: add argument to getCommandLineArguments() that specifies if the config file should be read or not. --- src/allsky_common.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/allsky_common.cpp b/src/allsky_common.cpp index c5aab9685..8f0295686 100644 --- a/src/allsky_common.cpp +++ b/src/allsky_common.cpp @@ -1411,7 +1411,7 @@ char *getLine(char *buffer) // Get settings from a configuration file. bool called_from_getConfigFileArguments = false; -static bool getConfigFileArguments(config *cg) +bool getConfigFileArguments(config *cg) { if (called_from_getConfigFileArguments) { @@ -1490,7 +1490,6 @@ static bool getConfigFileArguments(config *cg) equal++; } // "equal" is pointing at equal sign or end of argumment -// TODO: if line doesn't start with "-", add it argv[argc++] = line; if (*equal == '=') { @@ -1507,14 +1506,14 @@ static bool getConfigFileArguments(config *cg) // Let's hope the config file doesn't call itself! called_from_getConfigFileArguments = true; - bool ret = getCommandLineArguments(cg, argc, argv); + bool ret = getCommandLineArguments(cg, argc, argv, false); called_from_getConfigFileArguments = false; return(ret); } // Get arguments from the command line. -bool getCommandLineArguments(config *cg, int argc, char *argv[]) +bool getCommandLineArguments(config *cg, int argc, char *argv[], bool readConfigFile) { const char *b; if (called_from_getConfigFileArguments) @@ -1539,7 +1538,9 @@ bool getCommandLineArguments(config *cg, int argc, char *argv[]) // any command-line arguments after it will overwrite the config file. // A file name of "[none]" means to ignore the option. cg->configFile = argv[++i]; - if (strcmp(cg->configFile, "[none]") != 0 && ! getConfigFileArguments(cg)) + if (readConfigFile && + strcmp(cg->configFile, "[none]") != 0 && + ! getConfigFileArguments(cg)) { return(false); }