diff options
Diffstat (limited to 'cpp/src/IceBox/Service.cpp')
-rw-r--r-- | cpp/src/IceBox/Service.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/cpp/src/IceBox/Service.cpp b/cpp/src/IceBox/Service.cpp index a66254e128d..83f2bda2bfe 100644 --- a/cpp/src/IceBox/Service.cpp +++ b/cpp/src/IceBox/Service.cpp @@ -45,14 +45,34 @@ IceBox::IceBoxService::IceBoxService() bool IceBox::IceBoxService::start(int argc, char* argv[]) { + // Run through the command line arguments removing all the service + // properties. + vector<string> args = Ice::argsToStringSeq(argc, argv); + PropertiesPtr properties = communicator()->getProperties(); + const string prefix = "IceBox.Service."; + PropertyDict services = properties->getPropertiesForPrefix(prefix); + for(PropertyDict::const_iterator p = services.begin(); p != services.end(); ++p) + { + string name = p->first.substr(prefix.size()); + StringSeq::iterator q = args.begin(); + while(q != args.end()) + { + if(q->find("--" + name + ".") == 0) + { + q = args.erase(q); + continue; + } + ++q; + } + } + IceUtilInternal::Options opts; opts.addOpt("h", "help"); opts.addOpt("v", "version"); - vector<string> args; try { - args = opts.parse(argc, (const char**)argv); + args = opts.parse(args); } catch(const IceUtilInternal::BadOptException& e) { |