diff options
Diffstat (limited to 'TAO/orbsvcs/ImplRepo_Service/ImR_Locator.cpp')
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/ImR_Locator.cpp | 57 |
1 files changed, 27 insertions, 30 deletions
diff --git a/TAO/orbsvcs/ImplRepo_Service/ImR_Locator.cpp b/TAO/orbsvcs/ImplRepo_Service/ImR_Locator.cpp index 12be58dd8cd..91c69c9b312 100644 --- a/TAO/orbsvcs/ImplRepo_Service/ImR_Locator.cpp +++ b/TAO/orbsvcs/ImplRepo_Service/ImR_Locator.cpp @@ -8,7 +8,7 @@ class ImR_Locator_Shutdown : public Shutdown_Functor { public: - ImR_Locator_Shutdown (ImR_Locator_i& imr); + ImR_Locator_Shutdown(ImR_Locator_i& imr); void operator() (int which_signal); private: @@ -21,18 +21,18 @@ ImR_Locator_Shutdown::ImR_Locator_Shutdown (ImR_Locator_i &imr) } void -ImR_Locator_Shutdown::operator () (int /*which_signal*/) +ImR_Locator_Shutdown::operator() (int /*which_signal*/) { ACE_DECLARE_NEW_CORBA_ENV; ACE_TRY - { - this->imr_.shutdown (true ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } + { + this->imr_.shutdown(true ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "ImR: "); - } + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "ImR: "); + } ACE_ENDTRY; } @@ -116,18 +116,18 @@ run_service (void) static int run_service_command (Options& opts) { - if (opts.service_command () == Options::SC_NONE) + if (opts.service_command() == Options::SC_NONE) return 0; #if defined (ACE_WIN32) SERVICE::instance()->name (IMR_LOCATOR_SERVICE_NAME, IMR_LOCATOR_DISPLAY_NAME); - if (opts.service_command () == Options::SC_INSTALL) + if (opts.service_command() == Options::SC_INSTALL) { const DWORD MAX_PATH_LENGTH = 4096; - char pathname[MAX_PATH_LENGTH]; + ACE_TCHAR pathname[MAX_PATH_LENGTH]; - DWORD length = ACE_TEXT_GetModuleFileName (NULL, pathname, MAX_PATH_LENGTH); + DWORD length = ACE_TEXT_GetModuleFileName(NULL, pathname, MAX_PATH_LENGTH); if (length == 0 || length >= MAX_PATH_LENGTH - sizeof(" -s")) { ACE_ERROR ((LM_ERROR, "Error: Could not get module file name\n")); @@ -140,19 +140,16 @@ run_service_command (Options& opts) int ret = SERVICE::instance ()->insert (SERVICE_DEMAND_START, SERVICE_ERROR_NORMAL, pathname); - if (ret != -1) - { - ACE_DEBUG ((LM_DEBUG, "ImR: Service installed.\n")); - opts.save_registry_options (); - } - else - { - ACE_ERROR ((LM_ERROR, "Error: Failed to install service. error:%d\n", errno)); - } + if (ret != -1) { + ACE_DEBUG ((LM_DEBUG, "ImR: Service installed.\n")); + opts.save_registry_options(); + } else { + ACE_ERROR((LM_ERROR, "Error: Failed to install service. error:%d\n", errno)); + } if (ret == 0) return 1; } - else if (opts.service_command () == Options::SC_REMOVE) + else if (opts.service_command() == Options::SC_REMOVE) { int ret = SERVICE::instance ()->remove (); ACE_DEBUG ((LM_DEBUG, "ImR: Service removed.\n")); @@ -160,11 +157,11 @@ run_service_command (Options& opts) return 1; // If successfull, then we don't want to continue. } else - { - ACE_ERROR ((LM_ERROR, "Error: Unknown service command :%d \n", - opts.service_command ())); - return -1; - } + { + ACE_ERROR ((LM_ERROR, "Error: Unknown service command :%d \n", + opts.service_command())); + return -1; + } return -1; @@ -175,7 +172,7 @@ run_service_command (Options& opts) } int -main (int argc, char *argv[]) +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { Options opts; @@ -191,7 +188,7 @@ main (int argc, char *argv[]) else if (result > 0) return 0; // No error, but we should exit anyway. - if (opts.service ()) + if (opts.service()) { return run_service (); } |