From e20a23b370e64c6f09a57b4ddefd6f650e89ba13 Mon Sep 17 00:00:00 2001 From: "Charles E. Rolke" Date: Thu, 20 Sep 2012 13:48:40 +0000 Subject: QPID-3500 C++ qpidd broker --help should work despite parse errors This patch finds and processes --version before anything else. Then it finds --help before fully parsing command line options. In the event of a parse error, help usage may be shown as requested. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1388032 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/windows/QpiddBroker.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'qpid/cpp/src/windows/QpiddBroker.cpp') diff --git a/qpid/cpp/src/windows/QpiddBroker.cpp b/qpid/cpp/src/windows/QpiddBroker.cpp index 4ca3f3059c..de2e41dd4d 100644 --- a/qpid/cpp/src/windows/QpiddBroker.cpp +++ b/qpid/cpp/src/windows/QpiddBroker.cpp @@ -53,6 +53,10 @@ BootstrapOptions::BootstrapOptions(const char* argv0) add(log); } +void BootstrapOptions::usage() const { + std::cout << "Usage: qpidd [OPTIONS]" << std::endl << std::endl << *this << std::endl; +} + // Local functions to set and get the pid via a LockFile. namespace { @@ -225,10 +229,10 @@ VOID WINAPI SvcCtrlHandler(DWORD control) ::SetServiceStatus(svcStatusHandle, &svcStatus); CtrlHandler(CTRL_C_EVENT); break; - + case SERVICE_CONTROL_INTERROGATE: break; - + default: break; } @@ -306,7 +310,7 @@ struct ServiceOptions : public qpid::Options { std::string password; std::string depends; - ServiceOptions() + ServiceOptions() : qpid::Options("Service options"), install(false), start(false), @@ -423,7 +427,7 @@ int QpiddBroker::execute (QpiddOptions *options) { // Relies on port number being set via --port or QPID_PORT env variable. NamedSharedMemory info(brokerInfoName(options->broker.port)); int pid = info.get().pid; - if (pid < 0) + if (pid < 0) return 1; if (myOptions->control.check) std::cout << pid << std::endl; -- cgit v1.2.1