From: Loic Dachary Date: Wed, 17 Sep 2014 13:46:54 +0000 (+0200) Subject: tools: move po::collect_unrecognized in the try block X-Git-Tag: v0.88~91^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=29b3771698caaa484046bd343727b09a54326d17;p=ceph.git tools: move po::collect_unrecognized in the try block Signed-off-by: Loic Dachary --- diff --git a/src/tools/ceph_monstore_tool.cc b/src/tools/ceph_monstore_tool.cc index 547f86d96ac9..aa96251c182b 100644 --- a/src/tools/ceph_monstore_tool.cc +++ b/src/tools/ceph_monstore_tool.cc @@ -133,6 +133,7 @@ int main(int argc, char **argv) { p.add("command", 1); p.add("version", 1); + vector ceph_option_strings; po::variables_map vm; try { po::parsed_options parsed = @@ -141,14 +142,15 @@ int main(int argc, char **argv) { parsed, vm); po::notify(vm); + + ceph_option_strings = po::collect_unrecognized(parsed.options, + po::include_positional); } catch(po::error &e) { std::cerr << e.what() << std::endl; return 1; } vector ceph_options, def_args; - vector ceph_option_strings = po::collect_unrecognized( - parsed.options, po::include_positional); ceph_options.reserve(ceph_option_strings.size()); for (vector::iterator i = ceph_option_strings.begin(); i != ceph_option_strings.end(); diff --git a/src/tools/ceph_objectstore_tool.cc b/src/tools/ceph_objectstore_tool.cc index 3d09f6e81f39..6ec8582edfbc 100644 --- a/src/tools/ceph_objectstore_tool.cc +++ b/src/tools/ceph_objectstore_tool.cc @@ -1837,12 +1837,15 @@ int main(int argc, char **argv) po::positional_options_description pd; pd.add("object", 1).add("objcmd", 1).add("arg1", 1).add("arg2", 1); + vector ceph_option_strings; po::variables_map vm; try { po::parsed_options parsed = po::command_line_parser(argc, argv).options(all).allow_unregistered().positional(pd).run(); po::store( parsed, vm); po::notify(vm); + ceph_option_strings = po::collect_unrecognized(parsed.options, + po::include_positional); } catch(po::error &e) { std::cerr << e.what() << std::endl; return 1; @@ -1981,8 +1984,6 @@ int main(int argc, char **argv) vector ceph_options; env_to_vec(ceph_options); - vector ceph_option_strings = po::collect_unrecognized( - parsed.options, po::include_positional); ceph_options.reserve(ceph_options.size() + ceph_option_strings.size()); for (vector::iterator i = ceph_option_strings.begin(); i != ceph_option_strings.end(); diff --git a/src/tools/ceph_osdomap_tool.cc b/src/tools/ceph_osdomap_tool.cc index 191cb08983ee..f4790bb29b8c 100644 --- a/src/tools/ceph_osdomap_tool.cc +++ b/src/tools/ceph_osdomap_tool.cc @@ -41,6 +41,7 @@ int main(int argc, char **argv) { po::positional_options_description p; p.add("command", 1); + vector ceph_option_strings; po::variables_map vm; try { po::parsed_options parsed = @@ -49,14 +50,15 @@ int main(int argc, char **argv) { parsed, vm); po::notify(vm); + + ceph_option_strings = po::collect_unrecognized(parsed.options, + po::include_positional); } catch(po::error &e) { std::cerr << e.what() << std::endl; return 1; } vector ceph_options, def_args; - vector ceph_option_strings = po::collect_unrecognized( - parsed.options, po::include_positional); ceph_options.reserve(ceph_option_strings.size()); for (vector::iterator i = ceph_option_strings.begin(); i != ceph_option_strings.end();