CCgiApplication::CCgiApplication(void) : m_RequestFlags(0), m_HostIP(0), m_Iteration(0), m_ArgContextSync(false), m_OutputBroken(false), m_IsResultReady(true), m_ShouldExit(false), m_RequestStartPrinted(false), m_ErrorStatus(false) { // CGI applications should use /log for logging by default CDiagContext::SetUseRootLog(); // Disable system popup messages SuppressSystemMessageBox(); // Turn on iteration number SetDiagPostFlag(eDPF_RequestId); SetDiagTraceFlag(eDPF_RequestId); SetStdioFlags(fBinaryCin | fBinaryCout); DisableArgDescriptions(); RegisterDiagFactory("stderr", new CStderrDiagFactory); RegisterDiagFactory("asbody", new CAsBodyDiagFactory(this)); cerr.tie(0); }
void CTest::Init(void) { const size_t kUsageWidth = 90; SetDiagPostLevel(eDiag_Error); // To see all output, uncomment next line: //SetDiagPostLevel(eDiag_Trace); DisableArgDescriptions(fDisableStdArgs); // Create command-line arguments unique_ptr<CCommandArgDescriptions> cmd(new CCommandArgDescriptions(true, 0, CCommandArgDescriptions::eCommandMandatory | CCommandArgDescriptions::eNoSortCommands)); cmd->SetUsageContext(GetArguments().GetProgramBasename(), "Test compression library (CArchive class)"); // test {{ unique_ptr<CArgDescriptions> arg(new CArgDescriptions(false)); arg->SetUsageContext(kEmptyStr, "Run standard internal test.", false, kUsageWidth); arg->AddDefaultPositional("fmt", "Compression format to test", CArgDescriptions::eString, "all"); arg->SetConstraint("fmt", &(*new CArgAllow_Strings, "all", "zip")); cmd->AddCommand("test", arg.release()); }} SetupArgDescriptions(cmd.release()); // Set base directory for file tests m_TestDir = CDir::GetCwd(); }