diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1999-06-07 04:13:44 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1999-06-07 04:13:44 +0000 |
commit | bd3a5e20e335a01ed66170dd2d1e67090a288839 (patch) | |
tree | 5859974b2c581e814c037d0022b9fa92a2f44729 /netsvcs | |
parent | 88130ddce8e30f654772c3a53c45ee065aaf4766 (diff) | |
download | ATCD-bd3a5e20e335a01ed66170dd2d1e67090a288839.tar.gz |
.
Diffstat (limited to 'netsvcs')
-rw-r--r-- | netsvcs/clients/Naming/Client/Client_Test.cpp | 56 | ||||
-rw-r--r-- | netsvcs/clients/Naming/Client/main.cpp | 3 | ||||
-rw-r--r-- | netsvcs/clients/Naming/Dump_Restore/Dump_Restore.cpp | 205 | ||||
-rw-r--r-- | netsvcs/clients/Naming/Dump_Restore/Dump_Restore.h | 19 | ||||
-rw-r--r-- | netsvcs/clients/Tokens/collection/collection.cpp | 2 | ||||
-rw-r--r-- | netsvcs/clients/Tokens/deadlock/deadlock_detection_test.cpp | 2 | ||||
-rw-r--r-- | netsvcs/clients/Tokens/invariant/invariant.cpp | 4 | ||||
-rw-r--r-- | netsvcs/clients/Tokens/mutex/test_mutex.cpp | 2 | ||||
-rw-r--r-- | netsvcs/clients/Tokens/rw_lock/rw_locks.cpp | 2 | ||||
-rw-r--r-- | netsvcs/lib/Name_Handler.h | 2 | ||||
-rw-r--r-- | netsvcs/servers/main.cpp | 29 |
11 files changed, 213 insertions, 113 deletions
diff --git a/netsvcs/clients/Naming/Client/Client_Test.cpp b/netsvcs/clients/Naming/Client/Client_Test.cpp index c7f14ea7afd..90a7b33d8bc 100644 --- a/netsvcs/clients/Naming/Client/Client_Test.cpp +++ b/netsvcs/clients/Naming/Client/Client_Test.cpp @@ -34,34 +34,38 @@ public: void list_options (void); // Print name options - int bind (char *key, char *value, char *type = ""); + int bind (const char *key, + const char *value, + const char *type = ""); // Bind a key to a value - int unbind (char *key); + int unbind (const char *key); // Unbind a name binding - int rebind (char *key, char *value, char *type = ""); + int rebind (const char *key, + const char *value, + const char *type = ""); // Rebind a name binding - int find (char *key); + int find (const char *key); // Find the value associated with a key - int list_names (char *pattern); + int list_names (const char *pattern); // Find all names that match pattern - int list_values (char *pattern); + int list_values (const char *pattern); // Find all values that match pattern - int list_types (char *pattern); + int list_types (const char *pattern); // Find all types that match pattern - int list_name_entries (char *pattern); + int list_name_entries (const char *pattern); // Find all names that match pattern - int list_value_entries (char *pattern); + int list_value_entries (const char *pattern); // Find all values that match pattern - int list_type_entries (char *pattern); + int list_type_entries (const char *pattern); // Find all types that match pattern private: @@ -77,9 +81,9 @@ private: int set_node_local (void); // Set options to use NODE_LOCAL naming context - int set_host (char *hostname, int port); - // Set options to use NET_LOCAL naming context - // specifying host name and port number + int set_host (const char *hostname, int port); + // Set options to use NET_LOCAL naming context specifying host name + // and port number int quit (void); // Gracefully exit @@ -386,7 +390,7 @@ Client_Test::set_node_local (void) } int -Client_Test::set_host (char* hostname, int port) +Client_Test::set_host (const char *hostname, int port) { // Close down original name space NAMING_CONTEXT ()->close (); @@ -407,7 +411,9 @@ Client_Test::quit (void) } int -Client_Test::bind (char* key, char* value, char* type) +Client_Test::bind (const char *key, + const char *value, + const char *type) { if (NAMING_CONTEXT ()->bind (key, value, type) != 0) ACE_ERROR_RETURN ((LM_ERROR, @@ -419,7 +425,7 @@ Client_Test::bind (char* key, char* value, char* type) } int -Client_Test::unbind (char* key) +Client_Test::unbind (const char *key) { if (NAMING_CONTEXT ()->unbind (key) != 0) ACE_ERROR_RETURN ((LM_ERROR, @@ -431,14 +437,16 @@ Client_Test::unbind (char* key) } int -Client_Test::rebind (char* key, char* value, char* type) +Client_Test::rebind (const char *key, + const char *value, + const char *type) { int result = NAMING_CONTEXT ()->rebind (key, value, type ); return result == 1 ? 0 : result; } int -Client_Test::list_names (char *pattern) +Client_Test::list_names (const char *pattern) { ACE_PWSTRING_SET set; @@ -462,7 +470,7 @@ Client_Test::list_names (char *pattern) } int -Client_Test::list_values (char *pattern) +Client_Test::list_values (const char *pattern) { ACE_PWSTRING_SET set; @@ -486,7 +494,7 @@ Client_Test::list_values (char *pattern) } int -Client_Test::list_types (char *pattern) +Client_Test::list_types (const char *pattern) { ACE_PWSTRING_SET set; @@ -510,7 +518,7 @@ Client_Test::list_types (char *pattern) } int -Client_Test::list_name_entries (char *pattern) +Client_Test::list_name_entries (const char *pattern) { ACE_BINDING_SET set; @@ -543,7 +551,7 @@ Client_Test::list_name_entries (char *pattern) } int -Client_Test::list_value_entries (char *pattern) +Client_Test::list_value_entries (const char *pattern) { ACE_BINDING_SET set; @@ -575,7 +583,7 @@ Client_Test::list_value_entries (char *pattern) } int -Client_Test::list_type_entries (char *pattern) +Client_Test::list_type_entries (const char *pattern) { ACE_BINDING_SET set; @@ -607,7 +615,7 @@ Client_Test::list_type_entries (char *pattern) } int -Client_Test::find (char *key) +Client_Test::find (const char *key) { char *value = 0; char *type = 0; diff --git a/netsvcs/clients/Naming/Client/main.cpp b/netsvcs/clients/Naming/Client/main.cpp index 7dedde59b5f..75918c46378 100644 --- a/netsvcs/clients/Naming/Client/main.cpp +++ b/netsvcs/clients/Naming/Client/main.cpp @@ -23,8 +23,9 @@ main (int argc, char *argv[]) else // Use static binding. { char *l_argv[3]; + char port[] = "-p 10011"; l_argv[0] = argv[0]; - l_argv[1] = "-p 10011"; + l_argv[1] = port; l_argv[2] = 0; ACE_Service_Object *so = ACE_SVC_INVOKE (ACE_Naming_Context); diff --git a/netsvcs/clients/Naming/Dump_Restore/Dump_Restore.cpp b/netsvcs/clients/Naming/Dump_Restore/Dump_Restore.cpp index c747f012011..fec5e9967f0 100644 --- a/netsvcs/clients/Naming/Dump_Restore/Dump_Restore.cpp +++ b/netsvcs/clients/Naming/Dump_Restore/Dump_Restore.cpp @@ -11,28 +11,35 @@ ACE_RCSID(Dump_Restore, Dump_Restore, "$Id$") Dump_Restore::Dump_Restore (int argc, char *argv[]) : infile_ (0) { - ACE_NEW (this->ns_context_, ACE_Naming_Context); + ACE_NEW (this->ns_context_, + ACE_Naming_Context); // Cache the name options this->name_options_ = this->ns_context_->name_options (); this->name_options_->parse_args (argc, argv); //determine name context - if (ACE_OS::strcmp (this->name_options_->nameserver_host (), "localhost") == 0) + if (ACE_OS::strcmp (this->name_options_->nameserver_host (), + "localhost") == 0) { if (ns_context_->open (ACE_Naming_Context::PROC_LOCAL) == -1) - ACE_ERROR ( (LM_ERROR, "%p\n", "ns_context_->open")); + ACE_ERROR ((LM_ERROR, + "%p\n", + "ns_context_->open")); } else { - // Don't really need to do this but it's a hack to fix - // the problme of Display () not printing the right hostname + // Don't really need to do this but it's a hack to fix the + // problme of Display () not printing the right hostname ACE_OS::strcpy (this->hostname_, this->name_options_->nameserver_host ()); - this->port_ = this->name_options_->nameserver_port (); + this->port_ = + this->name_options_->nameserver_port (); if (this->ns_context_->open (ACE_Naming_Context::NET_LOCAL) == -1) - ACE_ERROR ((LM_ERROR, "%p\n", "ns_context_->open")); + ACE_ERROR ((LM_ERROR, + "%p\n", + "ns_context_->open")); } this->display_menu (); @@ -40,7 +47,9 @@ Dump_Restore::Dump_Restore (int argc, char *argv[]) if (ACE_Event_Handler::register_stdin_handler (this, ACE_Reactor::instance (), ACE_Thread_Manager::instance ()) == -1) - ACE_ERROR ((LM_ERROR, "%p\n", "register_stdin_handler")); + ACE_ERROR ((LM_ERROR, + "%p\n", + "register_stdin_handler")); } Dump_Restore::~Dump_Restore (void) @@ -62,7 +71,8 @@ Dump_Restore::handle_input (ACE_HANDLE) if (::scanf ("%s", option) <= 0) { - ACE_DEBUG ((LM_ERROR, "try again\n")); + ACE_DEBUG ((LM_ERROR, + "try again\n")); return 0; } @@ -123,38 +133,60 @@ Dump_Restore::handle_input (ACE_HANDLE) void Dump_Restore::display_menu (void) { - ACE_DEBUG ((LM_DEBUG, "\n")); - ACE_DEBUG ((LM_DEBUG, "Name Service Main Menu\n")); - ACE_DEBUG ((LM_DEBUG, "----------------------\n")); + ACE_DEBUG ((LM_DEBUG, + "\n")); + ACE_DEBUG ((LM_DEBUG, + "Name Service Main Menu\n")); + ACE_DEBUG ((LM_DEBUG, + "----------------------\n")); // Check if using local name space or remote name space - if (ACE_OS::strcmp (this->name_options_->nameserver_host (), "localhost") == 0) + if (ACE_OS::strcmp (this->name_options_->nameserver_host (), + "localhost") == 0) { if (this->ns_scope_ == ACE_Naming_Context::PROC_LOCAL) - ACE_DEBUG ((LM_DEBUG, " *** Using Process Local Database ***\n\n")); + ACE_DEBUG ((LM_DEBUG, + " *** Using Process Local Database ***\n\n")); else - ACE_DEBUG ((LM_DEBUG, " *** Using Node Local Database ***\n\n")); + ACE_DEBUG ((LM_DEBUG, + " *** Using Node Local Database ***\n\n")); } else { - ACE_DEBUG ((LM_DEBUG, " Hostname: %s\n", this->hostname_)); - ACE_DEBUG ((LM_DEBUG, " Port Number: %d\n", this->port_)); + ACE_DEBUG ((LM_DEBUG, + " Hostname: %s\n", + this->hostname_)); + ACE_DEBUG ((LM_DEBUG, + " Port Number: %d\n", + this->port_)); } if (this->infile_) - ACE_DEBUG ((LM_DEBUG, "Input File: %s\n", this->filename_)); + ACE_DEBUG ((LM_DEBUG, + "Input File: %s\n", + this->filename_)); else - ACE_DEBUG ((LM_DEBUG, "** No Input File Specified **\n")); - - ACE_DEBUG ((LM_DEBUG, "<P> Use Process Local Database\n")); - ACE_DEBUG ((LM_DEBUG, "<N> Use Node Local Database\n")); - ACE_DEBUG ((LM_DEBUG, "<H> Set Remote Name server <host> and <port>\n")); - ACE_DEBUG ((LM_DEBUG, "<F> Set Input File <file name>\n")); - ACE_DEBUG ((LM_DEBUG, "<B> Bind\n")); - ACE_DEBUG ((LM_DEBUG, "<U> Unbind\n")); - ACE_DEBUG ((LM_DEBUG, "<R> Rebind\n")); - ACE_DEBUG ((LM_DEBUG, "<D> Dump <file name>\n")); - ACE_DEBUG ((LM_DEBUG, "<Q> or ^C (exit) \n")); + ACE_DEBUG ((LM_DEBUG, + "** No Input File Specified **\n")); + + ACE_DEBUG ((LM_DEBUG, + "<P> Use Process Local Database\n")); + ACE_DEBUG ((LM_DEBUG, + "<N> Use Node Local Database\n")); + ACE_DEBUG ((LM_DEBUG, + "<H> Set Remote Name server <host> and <port>\n")); + ACE_DEBUG ((LM_DEBUG, + "<F> Set Input File <file name>\n")); + ACE_DEBUG ((LM_DEBUG, + "<B> Bind\n")); + ACE_DEBUG ((LM_DEBUG, + "<U> Unbind\n")); + ACE_DEBUG ((LM_DEBUG, + "<R> Rebind\n")); + ACE_DEBUG ((LM_DEBUG, + "<D> Dump <file name>\n")); + ACE_DEBUG ((LM_DEBUG, + "<Q> or ^C (exit) \n")); } @@ -166,16 +198,22 @@ Dump_Restore::set_proc_local (void) this->name_options_->nameserver_port (0); // Set Naming Context scope - this->ns_scope_ = ACE_Naming_Context::PROC_LOCAL; + this->ns_scope_ = + ACE_Naming_Context::PROC_LOCAL; // Remove old naming context delete this->ns_context_; // Create new Naming Context - ACE_NEW_RETURN (this->ns_context_, ACE_Naming_Context, -1); + ACE_NEW_RETURN (this->ns_context_, + ACE_Naming_Context, + -1); if (this->ns_context_->open (ACE_Naming_Context::PROC_LOCAL) == -1) - ACE_ERROR_RETURN ( (LM_ERROR, "%p\n", "ns_context_->open"), -1); + ACE_ERROR_RETURN ((LM_ERROR, + "%p\n", + "ns_context_->open"), + -1); return 0; } @@ -194,44 +232,56 @@ Dump_Restore::set_node_local (void) delete this->ns_context_; // Create new Naming Context - ACE_NEW_RETURN (this->ns_context_, ACE_Naming_Context, -1); + ACE_NEW_RETURN (this->ns_context_, + ACE_Naming_Context, + -1); if (ns_context_->open (ACE_Naming_Context::NODE_LOCAL) == -1) - ACE_ERROR_RETURN ( (LM_ERROR, "%p\n", "ns_context_->open"), -1); + ACE_ERROR_RETURN ((LM_ERROR, + "%p\n", + "ns_context_->open"), + -1); return 0; } int -Dump_Restore::set_host (char* hostname, int port) +Dump_Restore::set_host (const char *hostname, + int port) { // Set Name Options this->name_options_->nameserver_host (hostname); this->name_options_->nameserver_port (port); - // don't really need to do this but it's a hack to fix - // the problme of Display () not printing the right hostname - ACE_OS::strcpy (this->hostname_, hostname); + // Don't really need to do this but it's a hack to fix the problme + // of Display () not printing the right hostname + ACE_OS::strcpy (this->hostname_, + hostname); this->port_ = port; - this->ns_scope_ = ACE_Naming_Context::NET_LOCAL; + this->ns_scope_ = + ACE_Naming_Context::NET_LOCAL; // remove old naming context delete this->ns_context_; // Create new Naming Context - ACE_NEW_RETURN (this->ns_context_, ACE_Naming_Context, -1); + ACE_NEW_RETURN (this->ns_context_, + ACE_Naming_Context, + -1); // assume net_local context if (ns_context_->open (ACE_Naming_Context::NET_LOCAL) == -1) - ACE_ERROR_RETURN ( (LM_ERROR, "%p\n", "ns_context_->open"), -1); - + ACE_ERROR_RETURN ((LM_ERROR, + "%p\n", + "ns_context_->open"), + -1); return 0; } int Dump_Restore::doit (Dump_Restore::Operation_Type op, - char *name, - char* value, - char* type) + const char *name, + const char *value, + const char *type) { int result = -1; @@ -269,17 +319,22 @@ Dump_Restore::populate (Dump_Restore::Operation_Type op) // reset file pointer ACE_OS::rewind (this->infile_); - ACE_Allocator *allocator = ACE_Allocator::instance (); - ACE_Read_Buffer read_buffer (this->infile_, 0, allocator); + ACE_Allocator *allocator = + ACE_Allocator::instance (); + ACE_Read_Buffer read_buffer (this->infile_, + 0, + allocator); - for (char *temp; (temp = read_buffer.read ('\n')) != 0; ) + for (char *temp; + (temp = read_buffer.read ('\n')) != 0; + ) { char *name = 0; - char *actual_name = 0; + const char *actual_name = 0; char *value = 0; - char *actual_value = 0; + const char *actual_value = 0; char *type = 0; - char *actual_type = 0; + const char *actual_type = 0; switch (state) { @@ -318,7 +373,10 @@ Dump_Restore::populate (Dump_Restore::Operation_Type op) state = NAME; break; default: - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "populate"), -1); + ACE_ERROR_RETURN ((LM_ERROR, + "%p\n", + "populate"), + -1); /* NOTREACHED */ } } @@ -330,34 +388,53 @@ Dump_Restore::populate (Dump_Restore::Operation_Type op) } int -Dump_Restore::bind (char* key, char* value, char* type) +Dump_Restore::bind (const char *key, + const char *value, + const char *type) { - int result = ns_context_->bind (key, value, type); - + int result = ns_context_->bind (key, + value, + type); if (result == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ns_context_->bind"), -1); + ACE_ERROR_RETURN ((LM_ERROR, + "%p\n", + "ns_context_->bind"), + -1); else if (result == 1) - ACE_ERROR_RETURN ((LM_ERROR, "%s%s%s\n", "key <", key, "> already bound"), 1); + ACE_ERROR_RETURN ((LM_ERROR, + "%s%s%s\n", + "key <", + key, + "> already bound"), + 1); return 0; } int -Dump_Restore::unbind (char* key) +Dump_Restore::unbind (const char *key) { int result = ns_context_->unbind (key); if (result == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ns_context_->unbind"), -1); - + ACE_ERROR_RETURN ((LM_ERROR, + "%p\n", + "ns_context_->unbind"), + -1); return 0; } int -Dump_Restore::rebind (char* key, char* value, char* type) +Dump_Restore::rebind (const char *key, + const char *value, + const char *type) { - if (ns_context_->rebind (key, value, type) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ns_context_->rebind"), -1); - + if (ns_context_->rebind (key, + value, + type) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + "%p\n", + "ns_context_->rebind"), + -1); return 0; } diff --git a/netsvcs/clients/Naming/Dump_Restore/Dump_Restore.h b/netsvcs/clients/Naming/Dump_Restore/Dump_Restore.h index c2702ba04c9..741d7ec2f3a 100644 --- a/netsvcs/clients/Naming/Dump_Restore/Dump_Restore.h +++ b/netsvcs/clients/Naming/Dump_Restore/Dump_Restore.h @@ -42,7 +42,8 @@ private: int set_node_local (void); // Set options to use NODE_LOCAL naming context. - int set_host (char* hostname, int port); + int set_host (const char *hostname, + int port); // Set options to use NET_LOCAL naming context specifying host name // and port number. @@ -52,12 +53,16 @@ private: int populate (Dump_Restore::Operation_Type op); int doit (Dump_Restore::Operation_Type op, - char *name, - char *value, - char *type = ""); - int bind (char* key, char* value, char* type = ""); - int unbind (char* key); - int rebind (char* key, char* value, char* type = ""); + const char *name, + const char *value, + const char *type = ""); + int bind (const char *key, + const char *value, + const char *type = ""); + int unbind (const char *key); + int rebind (const char *key, + const char *value, + const char *type = ""); char filename_[MAXPATHLEN + 1]; char dump_filename_[MAXPATHLEN + 1]; diff --git a/netsvcs/clients/Tokens/collection/collection.cpp b/netsvcs/clients/Tokens/collection/collection.cpp index 3dcd8fdf455..1e7ac2d8823 100644 --- a/netsvcs/clients/Tokens/collection/collection.cpp +++ b/netsvcs/clients/Tokens/collection/collection.cpp @@ -31,7 +31,7 @@ ACE_RCSID(collection, collection, "$Id$") #if defined (ACE_HAS_THREADS) -static char *server_host = ACE_DEFAULT_SERVER_HOST; +static const char *server_host = ACE_DEFAULT_SERVER_HOST; static int server_port = ACE_DEFAULT_SERVER_PORT; // unused: static int threads = 2; static int iterations = 50; diff --git a/netsvcs/clients/Tokens/deadlock/deadlock_detection_test.cpp b/netsvcs/clients/Tokens/deadlock/deadlock_detection_test.cpp index 5fa6a0dde11..4a7b1bc5a39 100644 --- a/netsvcs/clients/Tokens/deadlock/deadlock_detection_test.cpp +++ b/netsvcs/clients/Tokens/deadlock/deadlock_detection_test.cpp @@ -53,7 +53,7 @@ public: static int ignore_deadlock = 0; static int remote_mutexes = 0; -static char *server_host = ACE_DEFAULT_SERVER_HOST; +static const char *server_host = ACE_DEFAULT_SERVER_HOST; static int server_port = ACE_DEFAULT_SERVER_PORT; static int iterations = 100; static int rwlocks = 0; diff --git a/netsvcs/clients/Tokens/invariant/invariant.cpp b/netsvcs/clients/Tokens/invariant/invariant.cpp index f7d417a1094..b2b55df3605 100644 --- a/netsvcs/clients/Tokens/invariant/invariant.cpp +++ b/netsvcs/clients/Tokens/invariant/invariant.cpp @@ -27,8 +27,8 @@ ACE_RCSID(invariant, invariant, "$Id$") typedef ACE_Token_Invariant_Manager ACE_TOKEN_INVARIANTS; -static char * rwname = "reader/writer"; -static char * mutexname = "mutex"; +static const char *rwname = "reader/writer"; +static const char *mutexname = "mutex"; static void * run_reader_writer (void *) diff --git a/netsvcs/clients/Tokens/mutex/test_mutex.cpp b/netsvcs/clients/Tokens/mutex/test_mutex.cpp index d51b8c6dbf1..a6a29a9bed3 100644 --- a/netsvcs/clients/Tokens/mutex/test_mutex.cpp +++ b/netsvcs/clients/Tokens/mutex/test_mutex.cpp @@ -28,7 +28,7 @@ ACE_RCSID(mutex, test_mutex, "$Id$") static ACE_Token_Proxy *mutex; static int remote_mutexes = 0; -static char *server_host = ACE_DEFAULT_SERVER_HOST; +static const char *server_host = ACE_DEFAULT_SERVER_HOST; static int server_port = ACE_DEFAULT_SERVER_PORT; static int iterations = 100; static int spawn_count = 2; diff --git a/netsvcs/clients/Tokens/rw_lock/rw_locks.cpp b/netsvcs/clients/Tokens/rw_lock/rw_locks.cpp index 6354f2fc6c9..37e9d0e3886 100644 --- a/netsvcs/clients/Tokens/rw_lock/rw_locks.cpp +++ b/netsvcs/clients/Tokens/rw_lock/rw_locks.cpp @@ -33,7 +33,7 @@ typedef ACE_Token_Invariant_Manager ACE_TOKEN_INVARIANTS; static ACE_Token_Proxy *global_rlock; static ACE_Token_Proxy *global_wlock; -static char *server_host = ACE_DEFAULT_SERVER_HOST; +static const char *server_host = ACE_DEFAULT_SERVER_HOST; static int server_port = ACE_DEFAULT_SERVER_PORT; static int ignore_deadlock = 0; static int threads = 2; diff --git a/netsvcs/lib/Name_Handler.h b/netsvcs/lib/Name_Handler.h index 9b47952890a..600e66075c8 100644 --- a/netsvcs/lib/Name_Handler.h +++ b/netsvcs/lib/Name_Handler.h @@ -125,7 +125,7 @@ private: // A member function pointer that serves as a factory to create a // request that is passed back to the client. - char *description_; + const char *description_; // Name of the operation we're dispatching (used for debugging). }; diff --git a/netsvcs/servers/main.cpp b/netsvcs/servers/main.cpp index dd21ed1cf58..c0881b3b0aa 100644 --- a/netsvcs/servers/main.cpp +++ b/netsvcs/servers/main.cpp @@ -39,14 +39,15 @@ main (int argc, char *argv[]) 1); else // Use static linking. { - char *l_argv[3]; - // Calling ACE_SVC_INVOKE to create a new Service_Object. // Stash the newly created Service_Object into an // ACE_Service_Object_Ptr which is an <auto_ptr> specialized // for ACE_Service_Object. - l_argv[0] = "-p " ACE_DEFAULT_NAME_SERVER_PORT_STR; + char *l_argv[3]; + char name_port[] = "-p " ACE_DEFAULT_NAME_SERVER_PORT_STR; + + l_argv[0] = name_port; l_argv[1] = 0; ACE_Service_Object_Ptr sp_1 = ACE_SVC_INVOKE (ACE_Name_Acceptor); @@ -56,7 +57,8 @@ main (int argc, char *argv[]) "Name Service", 1)); - l_argv[0] = "-p " ACE_DEFAULT_TIME_SERVER_PORT_STR; + char time_port[] = "-p " ACE_DEFAULT_TIME_SERVER_PORT_STR; + l_argv[0] = time_port; l_argv[1] = 0; ACE_Service_Object_Ptr sp_2 = ACE_SVC_INVOKE (ACE_TS_Server_Acceptor); @@ -65,15 +67,20 @@ main (int argc, char *argv[]) "%p\n%a", "TS Server Acceptor", 1)); + char clerk_port[] = "-p 10011"; l_argv[0] = argv[0]; - l_argv[1] = "-p 10011"; + l_argv[1] = clerk_port; l_argv[2] = 0; ACE_Service_Object_Ptr sp_3 = ACE_SVC_INVOKE (ACE_TS_Clerk_Processor); if (sp_3->init (2, l_argv) == -1) - ACE_ERROR ((LM_ERROR, "%p\n%a", "TS Clerk Processor", 1)); + ACE_ERROR ((LM_ERROR, + "%p\n%a", + "TS Clerk Processor", + 1)); - l_argv[0] = "-p " ACE_DEFAULT_TOKEN_SERVER_PORT_STR; + char token_port[] = "-p " ACE_DEFAULT_TOKEN_SERVER_PORT_STR; + l_argv[0] = token_port; l_argv[1] = 0; ACE_Service_Object_Ptr sp_4 = ACE_SVC_INVOKE (ACE_Token_Acceptor); @@ -83,7 +90,8 @@ main (int argc, char *argv[]) "Token Service", 1)); - l_argv[0] = "-p " ACE_DEFAULT_THR_LOGGING_SERVER_PORT_STR; + char thr_logging_port[] = "-p " ACE_DEFAULT_THR_LOGGING_SERVER_PORT_STR; + l_argv[0] = thr_logging_port; l_argv[1] = 0; ACE_Service_Object_Ptr sp_5 = ACE_SVC_INVOKE (ACE_Thr_Server_Logging_Acceptor); @@ -93,7 +101,8 @@ main (int argc, char *argv[]) "Threaded Logging Server", 1)); - l_argv[0] = "-p " ACE_DEFAULT_LOGGING_SERVER_PORT_STR; + char logging_port[] = "-p " ACE_DEFAULT_LOGGING_SERVER_PORT_STR; + l_argv[0] = logging_port; l_argv[1] = 0; ACE_Service_Object_Ptr sp_6 = ACE_SVC_INVOKE (ACE_Server_Logging_Acceptor); @@ -102,7 +111,7 @@ main (int argc, char *argv[]) "%p\n%a", "Logging Server", 1)); - l_argv[0] = "-p " ACE_DEFAULT_LOGGING_SERVER_PORT_STR; + l_argv[0] = logging_port; l_argv[1] = 0; ACE_Service_Object_Ptr sp_7 = ACE_SVC_INVOKE (ACE_Client_Logging_Acceptor); |