diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-04-15 12:15:39 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-04-15 12:15:39 +0000 |
commit | df34a888b6992723b02cfabdd60ab99cf5bc73b2 (patch) | |
tree | 7bfacf1145f57a724670f7dd41c90b9edde5b8c6 | |
parent | 84b7dc1bf77a2420c323ba5c8627aa00a70e2f6a (diff) |
Add --version parameter to the binary bin/inspircd, i remember someone requesting this
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6800 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/inspircd.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp index aff62d092..e5a00145f 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -286,7 +286,7 @@ InspIRCd::InspIRCd(int argc, char** argv) { int found_ports = 0; FailedPortList pl; - int do_nofork = 0, do_debug = 0, do_nolog = 0, do_restart = 0, do_root = 0; /* flag variables */ + int do_version, do_nofork = 0, do_debug = 0, do_nolog = 0, do_restart = 0, do_root = 0; /* flag variables */ char c = 0; modules.resize(255); @@ -305,7 +305,6 @@ InspIRCd::InspIRCd(int argc, char** argv) this->Config->opertypes.clear(); this->Config->operclass.clear(); this->SNO = new SnomaskManager(this); - this->Start(); this->TIME = this->OLDTIME = this->startup_time = time(NULL); this->time_delta = 0; this->next_call = this->TIME + 3; @@ -323,6 +322,7 @@ InspIRCd::InspIRCd(int argc, char** argv) { "nolog", no_argument, &do_nolog, 1 }, { "restart", no_argument, &do_restart, 1 }, { "runasroot", no_argument, &do_root, 1 }, + { "version", no_argument, &do_version, 1 }, { 0, 0, 0, 0 } }; @@ -345,12 +345,18 @@ InspIRCd::InspIRCd(int argc, char** argv) break; default: /* Unknown parameter! DANGER, INTRUDER.... err.... yeah. */ - printf("Usage: %s [--nofork] [--nolog] [--debug] [--logfile <filename>] [--restart]\n", argv[0]); + printf("Usage: %s [--nofork] [--nolog] [--debug] [--logfile <filename>] [--runasroot] [--version] [--config <config>]\n", argv[0]); Exit(EXIT_STATUS_ARGV); break; } } + if (do_version) + { + printf("\n%s r%s\n", VERSION, REVISION); + Exit(EXIT_STATUS_NOERROR); + } + if (!ServerConfig::FileExists(this->ConfigFileName)) { printf("ERROR: Cannot open config file: %s\nExiting...\n", this->ConfigFileName); @@ -358,6 +364,8 @@ InspIRCd::InspIRCd(int argc, char** argv) Exit(EXIT_STATUS_CONFIG); } + this->Start(); + /* Set the finished argument values */ Config->nofork = do_nofork; Config->forcedebug = do_debug; @@ -479,6 +487,7 @@ std::string InspIRCd::GetVersionString() { char versiondata[MAXBUF]; char dnsengine[] = "singlethread-object"; + if (*Config->CustomVersion) { snprintf(versiondata,MAXBUF,"%s %s :%s",VERSION,Config->ServerName,Config->CustomVersion); |