]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/inspircd.cpp
Fix showing the start header when using --version.
[user/henk/code/inspircd.git] / src / inspircd.cpp
index c503da9d0fe01e869c069a895717db728cb3139e..ba7e08eff39187f25b96362d9f3da598b4c7a6e7 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * InspIRCd -- Internet Relay Chat Daemon
  *
+ *   Copyright (C) 2020 Matt Schatz <genius3000@g3k.solutions>
  *   Copyright (C) 2018 Chris Novakovic <chrisnovakovic@users.noreply.github.com>
  *   Copyright (C) 2013, 2017-2020 Sadie Powell <sadie@witchery.services>
  *   Copyright (C) 2013 Adam <Adam@anope.org>
@@ -321,7 +322,7 @@ namespace
 
                                default:
                                        // An unknown option was specified.
-                                       std::cout << con_red << "Error:" <<  con_reset << " unknown option '" << argv[optind - 1] << "'." << std::endl
+                                       std::cout << con_red << "Error:" <<  con_reset << " unknown option '" << argv[optind] << "'." << std::endl
                                                << con_bright << "Usage: " << con_reset << argv[0] << " [--config <file>] [--debug] [--nofork] [--nolog]" << std::endl
                                                << std::string(strlen(argv[0]) + 8, ' ') << "[--nopid] [--runasroot] [--version]" << std::endl;
                                        ServerInstance->Exit(EXIT_STATUS_ARGV);
@@ -331,7 +332,7 @@ namespace
 
                if (do_version)
                {
-                       std::cout << std::endl << INSPIRCD_VERSION << std::endl;
+                       std::cout << INSPIRCD_VERSION << std::endl;
                        ServerInstance->Exit(EXIT_STATUS_NOERROR);
                }
 
@@ -444,7 +445,7 @@ void InspIRCd::WritePID(const std::string& filename, bool exitonfail)
                return;
        }
 
-       std::string fname = ServerInstance->Config->Paths.PrependData(filename.empty() ? "inspircd.pid" : filename);
+       std::string fname = ServerInstance->Config->Paths.PrependRuntime(filename.empty() ? "inspircd.pid" : filename);
        std::ofstream outfile(fname.c_str());
        if (outfile.is_open())
        {
@@ -489,6 +490,7 @@ InspIRCd::InspIRCd(int argc, char** argv)
 
        this->Config->cmdline.argv = argv;
        this->Config->cmdline.argc = argc;
+       ParseOptions();
 
 #ifdef _WIN32
        // Initialize the console values
@@ -520,7 +522,6 @@ InspIRCd::InspIRCd(int argc, char** argv)
                << "See " << con_green << "/INFO" << con_reset << " for contributors & authors" << std::endl
                << std::endl;
 
-       ParseOptions();
        if (Config->cmdline.forcedebug)
        {
                FileWriter* fw = new FileWriter(stdout, 1);