summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2005-01-27 22:28:20 +0000
committerMark Spruiell <mes@zeroc.com>2005-01-27 22:28:20 +0000
commit93cb5f7639f726cf9dc8faf035d1269db9d1b116 (patch)
treed972b58f6c70f2c76cb0e37fb62f82afd65570ff /cpp/src
parentdo not close stdout/stderr if redirected (diff)
downloadice-93cb5f7639f726cf9dc8faf035d1269db9d1b116.tar.bz2
ice-93cb5f7639f726cf9dc8faf035d1269db9d1b116.tar.xz
ice-93cb5f7639f726cf9dc8faf035d1269db9d1b116.zip
service cleanup
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Glacier2/Glacier2Router.cpp17
-rw-r--r--cpp/src/IcePack/IcePackNode.cpp7
-rw-r--r--cpp/src/IcePack/IcePackRegistry.cpp7
-rw-r--r--cpp/src/IcePatch2/Server.cpp32
4 files changed, 27 insertions, 36 deletions
diff --git a/cpp/src/Glacier2/Glacier2Router.cpp b/cpp/src/Glacier2/Glacier2Router.cpp
index dc289b9bb94..d36982df955 100644
--- a/cpp/src/Glacier2/Glacier2Router.cpp
+++ b/cpp/src/Glacier2/Glacier2Router.cpp
@@ -81,7 +81,7 @@ Glacier2::RouterService::start(int argc, char* argv[])
}
catch(const IceUtil::Options::BadOpt& e)
{
- cerr << e.reason << endl;
+ error(e.reason);
usage(argv[0]);
return false;
}
@@ -93,7 +93,7 @@ Glacier2::RouterService::start(int argc, char* argv[])
}
if(opts.isSet("v") || opts.isSet("version"))
{
- cout << ICE_STRING_VERSION << endl;
+ print(ICE_STRING_VERSION);
return false;
}
@@ -108,10 +108,10 @@ Glacier2::RouterService::start(int argc, char* argv[])
//
// Initialize the client object adapter.
//
- const char* clientEndpointsProperty = "Glacier2.Client.Endpoints";
+ const string clientEndpointsProperty = "Glacier2.Client.Endpoints";
if(properties->getProperty(clientEndpointsProperty).empty())
{
- cerr << argv[0] << ": property `" << clientEndpointsProperty << "' is not set" << endl;
+ error("property `" + clientEndpointsProperty + "' is not set");
return false;
}
ObjectAdapterPtr clientAdapter = communicator()->createObjectAdapter("Glacier2.Client");
@@ -120,7 +120,7 @@ Glacier2::RouterService::start(int argc, char* argv[])
// Initialize the server object adapter only if server endpoints
// are defined.
//
- const char* serverEndpointsProperty = "Glacier2.Server.Endpoints";
+ const string serverEndpointsProperty = "Glacier2.Server.Endpoints";
ObjectAdapterPtr serverAdapter;
if(!properties->getProperty(serverEndpointsProperty).empty())
{
@@ -131,7 +131,7 @@ Glacier2::RouterService::start(int argc, char* argv[])
// Initialize the admin object adapter only if admin endpoints
// are defined.
//
- const char* adminEndpointsProperty = "Glacier2.Admin.Endpoints";
+ const string adminEndpointsProperty = "Glacier2.Admin.Endpoints";
ObjectAdapterPtr adminAdapter;
if(!properties->getProperty(adminEndpointsProperty).empty())
{
@@ -226,7 +226,7 @@ Glacier2::RouterService::start(int argc, char* argv[])
//
if(adminAdapter)
{
- const char* adminIdProperty = "Glacier2.AdminIdentity";
+ const string adminIdProperty = "Glacier2.AdminIdentity";
Identity adminId = stringToIdentity(properties->getPropertyWithDefault(adminIdProperty, "Glacier2/admin"));
adminAdapter->add(new AdminI(communicator()), adminId);
}
@@ -340,8 +340,7 @@ Glacier2::RouterService::usage(const string& appName)
"--nochdir Do not change the current working directory."
);
#endif
- cerr << "Usage: " << appName << " [options]" << endl;
- cerr << options << endl;
+ print("Usage: " + appName + " [options]\n" + options);
}
int
diff --git a/cpp/src/IcePack/IcePackNode.cpp b/cpp/src/IcePack/IcePackNode.cpp
index c6673a2c474..c7b7c80db16 100644
--- a/cpp/src/IcePack/IcePackNode.cpp
+++ b/cpp/src/IcePack/IcePackNode.cpp
@@ -137,7 +137,7 @@ IcePack::NodeService::start(int argc, char* argv[])
}
else if(strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0)
{
- trace(ICE_STRING_VERSION);
+ print(ICE_STRING_VERSION);
return false;
}
else if(strcmp(argv[i], "--nowarn") == 0)
@@ -442,7 +442,7 @@ IcePack::NodeService::start(int argc, char* argv[])
string bundleName = properties->getProperty("IcePack.Node.PrintServersReady");
if(!bundleName.empty())
{
- cout << bundleName << " ready" << endl;
+ print(bundleName + " ready");
}
return true;
@@ -558,8 +558,7 @@ IcePack::NodeService::usage(const string& appName)
"--nochdir Do not change the current working directory."
);
#endif
- cerr << "Usage: " << appName << " [options]" << endl;
- cerr << options << endl;
+ print("Usage: " + appName + " [options]\n" + options);
}
int
diff --git a/cpp/src/IcePack/IcePackRegistry.cpp b/cpp/src/IcePack/IcePackRegistry.cpp
index 1e51177588e..d91e1a9620a 100644
--- a/cpp/src/IcePack/IcePackRegistry.cpp
+++ b/cpp/src/IcePack/IcePackRegistry.cpp
@@ -60,7 +60,7 @@ IcePack::RegistryService::start(int argc, char* argv[])
}
catch(const IceUtil::Options::BadOpt& e)
{
- cerr << e.reason << endl;
+ error(e.reason);
usage(argv[0]);
return false;
}
@@ -72,7 +72,7 @@ IcePack::RegistryService::start(int argc, char* argv[])
}
if(opts.isSet("v") || opts.isSet("version"))
{
- cout << ICE_STRING_VERSION << endl;
+ print(ICE_STRING_VERSION);
return false;
}
nowarn = opts.isSet("nowarn");
@@ -145,8 +145,7 @@ IcePack::RegistryService::usage(const string& appName)
"--nochdir Do not change the current working directory."
);
#endif
- cerr << "Usage: " << appName << " [options]" << endl;
- cerr << options << endl;
+ print("Usage: " + appName + " [options]\n" + options);
}
int
diff --git a/cpp/src/IcePatch2/Server.cpp b/cpp/src/IcePatch2/Server.cpp
index b0696deab15..7abed80da46 100644
--- a/cpp/src/IcePatch2/Server.cpp
+++ b/cpp/src/IcePatch2/Server.cpp
@@ -58,14 +58,11 @@ protected:
private:
void usage(const std::string&);
-
- const LoggerPtr _logger;
};
};
-IcePatch2::PatcherService::PatcherService() :
- _logger(communicator()->getLogger())
+IcePatch2::PatcherService::PatcherService()
{
}
@@ -85,7 +82,7 @@ IcePatch2::PatcherService::start(int argc, char* argv[])
}
catch(const IceUtil::Options::BadOpt& e)
{
- _logger->error(e.reason);
+ error(e.reason);
usage(argv[0]);
return false;
}
@@ -97,13 +94,13 @@ IcePatch2::PatcherService::start(int argc, char* argv[])
}
if(opts.isSet("v") || opts.isSet("version"))
{
- _logger->print(ICE_STRING_VERSION);
+ print(ICE_STRING_VERSION);
return false;
}
if(args.size() > 1)
{
- _logger->error("too many arguments");
+ error("too many arguments");
usage(argv[0]);
return false;
}
@@ -119,7 +116,7 @@ IcePatch2::PatcherService::start(int argc, char* argv[])
dataDir = properties->getProperty("IcePatch2.Directory");
if(dataDir.empty())
{
- _logger->error("no data directory specified");
+ error("no data directory specified");
usage(argv[0]);
return false;
}
@@ -151,38 +148,37 @@ IcePatch2::PatcherService::start(int argc, char* argv[])
}
catch(const string& ex)
{
- _logger->error(ex);
+ error(ex);
return false;
}
catch(const char* ex)
{
- _logger->error(ex);
+ error(ex);
return false;
}
- const char* endpointsProperty = "IcePatch2.Endpoints";
+ const string endpointsProperty = "IcePatch2.Endpoints";
if(properties->getProperty(endpointsProperty).empty())
{
- Error err(_logger);
- err << "property `" << endpointsProperty << "' is not set";
+ error("property `" + endpointsProperty + "' is not set");
return false;
}
ObjectAdapterPtr adapter = communicator()->createObjectAdapter("IcePatch2");
- const char* adminEndpointsProperty = "IcePatch2.Admin.Endpoints";
+ const string adminEndpointsProperty = "IcePatch2.Admin.Endpoints";
ObjectAdapterPtr adminAdapter;
if(!properties->getProperty(adminEndpointsProperty).empty())
{
adminAdapter = communicator()->createObjectAdapter("IcePatch2.Admin");
}
- const char* idProperty = "IcePatch2.Identity";
+ const string idProperty = "IcePatch2.Identity";
Identity id = stringToIdentity(properties->getPropertyWithDefault(idProperty, "IcePatch2/server"));
adapter->add(new FileServerI(dataDir, infoSeq), id);
if(adminAdapter)
{
- const char* adminIdProperty = "IcePatch2.AdminIdentity";
+ const string adminIdProperty = "IcePatch2.AdminIdentity";
Identity adminId = stringToIdentity(properties->getPropertyWithDefault(adminIdProperty, "IcePatch2/admin"));
adminAdapter->add(new AdminI(communicator()), adminId);
}
@@ -248,9 +244,7 @@ IcePatch2::PatcherService::usage(const string& appName)
// --nochdir is intentionally not shown here. (See the comment in main().)
);
#endif
-
- Print out(_logger);
- out << "Usage: " << appName << " [options] [DIR]\n" << options;
+ print("Usage: " + appName + " [options] [DIR]\n" + options);
}
int