From c8026bc2d73344e1df526f0a80694046efa4b22a Mon Sep 17 00:00:00 2001 From: danieldg Date: Thu, 24 Sep 2009 01:44:29 +0000 Subject: Move configuration filename specification to start script, to reduce hardcoded paths in executable git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11759 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/inspircd.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/inspircd.cpp') diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 704fec475..f28324d16 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -328,6 +328,7 @@ InspIRCd::InspIRCd(int argc, char** argv) : HandleIsChannel(this), HandleIsSID(this), HandleRehash(this), + ConfigFileName("inspircd.conf"), /* Functor pointer initialisation. Must match the order of the list above * @@ -428,7 +429,6 @@ InspIRCd::InspIRCd(int argc, char** argv) : srand(this->TIME); *this->LogFileName = 0; - strlcpy(this->ConfigFileName, CONFIG_FILE, MAXBUF); struct option longopts[] = { @@ -454,7 +454,7 @@ InspIRCd::InspIRCd(int argc, char** argv) : break; case 'c': /* Config filename was set */ - strlcpy(ConfigFileName, optarg, MAXBUF); + ConfigFileName = optarg; break; case 0: /* getopt_long_only() set an int variable, just keep going */ @@ -508,7 +508,7 @@ InspIRCd::InspIRCd(int argc, char** argv) : Exit(EXIT_STATUS_LOG); } - if (!ServerConfig::FileExists(this->ConfigFileName)) + if (!ServerConfig::FileExists(ConfigFileName.c_str())) { #ifdef WIN32 /* Windows can (and defaults to) hide file extensions, so let's play a bit nice for windows users. */ @@ -517,13 +517,13 @@ InspIRCd::InspIRCd(int argc, char** argv) : if (ServerConfig::FileExists(txtconf.c_str())) { - strlcat(this->ConfigFileName, ".txt", MAXBUF); + ConfigFileName = txtconf; } else #endif { - printf("ERROR: Cannot open config file: %s\nExiting...\n", this->ConfigFileName); - this->Logs->Log("STARTUP",DEFAULT,"Unable to open config file %s", this->ConfigFileName); + printf("ERROR: Cannot open config file: %s\nExiting...\n", ConfigFileName.c_str()); + this->Logs->Log("STARTUP",DEFAULT,"Unable to open config file %s", ConfigFileName.c_str()); Exit(EXIT_STATUS_CONFIG); } } -- cgit v1.2.3