Don't accept extra arguments to znc as a config file name

It's much wiser to specify a whole --datadir because two znc instances running
on the same datadir but different configs just calls for problems.

Patch by DarthGandalf, some messing by me, idea by various.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2037 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2010-06-22 14:35:10 +00:00
parent 26396b1b06
commit 3cb25965e1
+4 -4
View File
@@ -27,7 +27,7 @@ static const struct option g_LongOpts[] = {
};
static void GenerateHelp(const char *appname) {
CUtils::PrintMessage("USAGE: " + CString(appname) + " [options] [config]");
CUtils::PrintMessage("USAGE: " + CString(appname) + " [options]");
CUtils::PrintMessage("Options are:");
CUtils::PrintMessage("\t-h, --help List available command line options (this page)");
CUtils::PrintMessage("\t-v, --version Output version information and exit");
@@ -160,7 +160,9 @@ int main(int argc, char** argv) {
}
if (optind < argc) {
sConfig = argv[optind];
CUtils::PrintError("Specifying a config file as an argument isn't supported anymore.");
CUtils::PrintError("Use --datadir instead.");
return 1;
}
CZNC* pZNC = &CZNC::Get();
@@ -303,7 +305,6 @@ int main(int argc, char** argv) {
NULL,
NULL,
NULL,
NULL,
NULL
};
int pos = 3;
@@ -315,7 +316,6 @@ int main(int argc, char** argv) {
args[pos++] = strdup("--no-color");
if (bAllowRoot)
args[pos++] = strdup("--allow-root");
args[pos++] = strdup(pZNC->GetConfigFile().c_str());
// The above code adds 4 entries to args tops
// which means the array should be big enough