X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Finspircd.cpp;h=c0d7a1614c53168b91525ae81c70c112378b8d6c;hb=9ecea89f1251299a5431797976a7f1603f3c4bf8;hp=067b2a2f353f4296df7ce080e2c9a84e65ff2996;hpb=2f12f76ec9561a6c1d522e3e6d81723ed9a07356;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 067b2a2f3..c0d7a1614 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -3,12 +3,12 @@ * * Copyright (C) 2020 Matt Schatz * Copyright (C) 2018 Chris Novakovic - * Copyright (C) 2013, 2017-2020 Sadie Powell + * Copyright (C) 2013, 2018-2021 Sadie Powell * Copyright (C) 2013 Adam * Copyright (C) 2012-2014, 2016, 2018 Attila Molnar - * Copyright (C) 2012 William Pitcock * Copyright (C) 2012 Robby * Copyright (C) 2012 ChrisTX + * Copyright (C) 2012 Ariadne Conill * Copyright (C) 2009-2010 Daniel De Graaf * Copyright (C) 2009 Uli Schlachter * Copyright (C) 2008 Thomas Stagner @@ -322,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 ] [--debug] [--nofork] [--nolog]" << std::endl << std::string(strlen(argv[0]) + 8, ' ') << "[--nopid] [--runasroot] [--version]" << std::endl; ServerInstance->Exit(EXIT_STATUS_ARGV); @@ -332,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); } @@ -445,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()) { @@ -490,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 @@ -521,10 +522,10 @@ 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); + FILE* newstdout = fdopen(dup(STDOUT_FILENO), "w"); + FileWriter* fw = new FileWriter(newstdout, 1); FileLogStream* fls = new FileLogStream(LOG_RAWIO, fw); Logs->AddLogTypes("*", fls, true); }