# # # patch "app_state.cc" # from [71d8f1fa305acdc8ff49db838a681da748c2d5b3] # to [e4fb02a8f19d796ac56f6a71c970795cc38ca5ec] # # patch "app_state.hh" # from [aa3e19208f8489eb3798a841ece7b81e5c6317c9] # to [5bc56ca3900e76e54caff2c3bbcea7bc2def2d95] # # patch "cmd_automate.cc" # from [5773ba4d46ba539b11fe708acd925f92565828d1] # to [29294691a83649d5d618d84852a68c4c570e9fb1] # # patch "cmd_db.cc" # from [0bbafdda7786ad77dae9e6027b299c8293e9a95c] # to [a1c22f05a3f5ee8b4a4669606a0ca28718d015dd] # # patch "cmd_diff_log.cc" # from [645e937e6c7ea0dfb7bd061f6644a34aeaa7ce32] # to [0b3b6640b02148e33843f175d78e503d039a887b] # # patch "cmd_files.cc" # from [536e5d798fa7327c512e7059bdbf77f9060885f2] # to [2b02d86f5d17375dc71a639c44b2de2471be6a4f] # # patch "cmd_key_cert.cc" # from [cad240267bef523859577d162bd719f6fa27ba46] # to [92378b2ad7b10d2c5c2fb432a52c14bc88bf322f] # # patch "cmd_list.cc" # from [1ab1b4e595b63b58732e5ea9478f105010a93965] # to [c2bd912e10c6518eb435a765d6085c6433006ffc] # # patch "cmd_merging.cc" # from [a76a66f5d2facc8be195faefc2d9b69336e4f4ef] # to [09aeeda6808b4a9585ed3deba54f10f614971eac] # # patch "cmd_netsync.cc" # from [06fd5819e0cd160b6a045d6bc022b3d408e92a8b] # to [15d5c9b709562f438cd8cde781f1bd4727953121] # # patch "cmd_othervcs.cc" # from [9a8de176dcbfff487b10a1a1de6ac95cbafea61d] # to [0ea15c34e85e85d97d15c74f0e8d10749e9a60aa] # # patch "cmd_packet.cc" # from [8b90e9112bed3dd0aaeed955d4ef88c3845a3af8] # to [4e1f5a875df2278072c6f2ebcf3b4b4bccb2867f] # # patch "cmd_ws_commit.cc" # from [64ff3e0d5fc2b1ffe0be8e435f9d44d9c038bbcd] # to [812083b7054c02abb252f535ecce089b0a17bdfb] # # patch "commands.cc" # from [6613df8206ea1da9f46089eb65f68d4c16bd2042] # to [a7bbc30a64a0bd915a544a8ad7acd8a5f836dd91] # # patch "lua_hooks.cc" # from [ef71d9f8bf14e2a80314eb736438fb794ae64547] # to [91dddfeeb524fedf4368e8a528681d75a201a97d] # # patch "monotone.cc" # from [54762c67817af2a5c66cfcb996573a5bae18af9d] # to [64a1f474469ca88b966469988115b6b5791f2a2d] # # patch "netsync.cc" # from [2e81dcbccb07f21bd38a4a139a05d5c9271f3c83] # to [e90bd2aeb5deabd6e153bd9921ab8154fb7af8d3] # # patch "option.cc" # from [8d0a0bdde963824d7748b1e0f9512c56987a89c9] # to [f9bcfadfb5ea6629f70cb0a3cc106b000abf3800] # # patch "option.hh" # from [b5709532cf7e0302e9a81a3d89ed3e5bd332f696] # to [2bdce8881c879e3c45bfe5873454d53a5eb6362f] # # patch "option_list.hh" # from [4f70f8afe3afba5be0aee26fc44a13d2a0ba51e5] # to [15ae68787ffb067dd009a23b1e1b6ca502f01949] # # patch "sha1.cc" # from [378b34e73cbf9117f4966540c7099e63f7efbf69] # to [f81e2a20ae2fb90e962f570303f71b6401ccf00e] # ============================================================ --- app_state.cc 71d8f1fa305acdc8ff49db838a681da748c2d5b3 +++ app_state.cc e4fb02a8f19d796ac56f6a71c970795cc38ca5ec @@ -38,38 +38,25 @@ app_state::app_state() app_state::app_state() : db(system_path()), keys(this), work(db, lua), - search_root(current_root_path()), - diff_format(unified_diff), - bind_address(""), bind_port(""), - confdir(get_default_confdir()), +// search_root(current_root_path()), +// diff_format(unified_diff), branch_is_sticky(false) { db.set_app(this); lua.set_app(this); - keys.set_key_dir(confdir / "keys"); + keys.set_key_dir(opts.conf_dir / "keys"); } app_state::~app_state() { } -void -app_state::set_is_explicit_option (std::string o) -{ - explicit_options.insert(o); -} -bool -app_state::is_explicit_option(std::string o) const -{ - return explicit_options.find(o) != explicit_options.end(); -} - void app_state::allow_workspace() { L(FL("initializing from directory %s") % fs::initial_path().string()); - found_workspace = find_and_go_to_workspace(search_root); + found_workspace = find_and_go_to_workspace(opts.root); if (found_workspace) { @@ -213,30 +200,10 @@ app_state::set_root(system_path const & (path, F("search root '%s' does not exist") % path, F("search root '%s' is not a directory\n") % path); - search_root = path; - L(FL("set search root to %s") % search_root); + opts.root = path; + L(FL("set search root to %s") % opts.root); } -void -app_state::set_diff_format(diff_type dtype) -{ - diff_format = dtype; -} - -void -app_state::set_confdir(system_path const & cd) -{ - confdir = cd; - if (!opts.key_dir_given) - keys.set_key_dir(cd / "keys"); -} - -system_path -app_state::get_confdir() -{ - return confdir; -} - // rc files are loaded after we've changed to the workspace so that // _MTN/monotonerc can be loaded between ~/.monotone/monotonerc and other // rcfiles. ============================================================ --- app_state.hh aa3e19208f8489eb3798a841ece7b81e5c6317c9 +++ app_state.hh 5bc56ca3900e76e54caff2c3bbcea7bc2def2d95 @@ -49,20 +49,11 @@ public: key_store keys; workspace work; - option opts; + option::options opts; - system_path search_root; bool found_workspace; - diff_type diff_format; - utf8 bind_address; - utf8 bind_port; - system_path confdir; bool branch_is_sticky; - std::set explicit_options; // in set if the value of the flag was explicitly given on the command line - void set_is_explicit_option (std::string o); - bool is_explicit_option(std::string o) const; - // These are used to cache signers/verifiers (if the hook allows). // They can't be function-static variables in key.cc, since they // must be destroyed before the Botan deinitialize() function is @@ -94,9 +85,6 @@ public: void set_root(system_path const & root); void set_diff_format(diff_type dtype); - void set_confdir(system_path const & cd); - system_path get_confdir(); - explicit app_state(); ~app_state(); ============================================================ --- cmd_automate.cc 5773ba4d46ba539b11fe708acd925f92565828d1 +++ cmd_automate.cc 29294691a83649d5d618d84852a68c4c570e9fb1 @@ -302,7 +302,7 @@ CMD_PARAMS_FN(automate, N_("automation") CMD_PARAMS_FN(automate, N_("automation"), N_("automation interface"), - &option::automate_stdio_size) + option::automate_stdio_size) { if (args.size() == 0) throw usage(name); ============================================================ --- cmd_db.cc 0bbafdda7786ad77dae9e6027b299c8293e9a95c +++ cmd_db.cc a1c22f05a3f5ee8b4a4669606a0ca28718d015dd @@ -60,7 +60,7 @@ CMD(db, N_("database"), "regenerate_rosters\n" "set_epoch BRANCH EPOCH\n"), N_("manipulate database state"), - &option::drop_attr) + option::drop_attr) { if (args.size() == 1) { @@ -121,7 +121,7 @@ CMD(set, N_("vars"), N_("DOMAIN NAME VAL CMD(set, N_("vars"), N_("DOMAIN NAME VALUE"), N_("set the database variable NAME to VALUE, in domain DOMAIN"), - &option::none) + option::none) { if (args.size() != 3) throw usage(name); @@ -137,7 +137,7 @@ CMD(unset, N_("vars"), N_("DOMAIN NAME") CMD(unset, N_("vars"), N_("DOMAIN NAME"), N_("remove the database variable NAME in domain DOMAIN"), - &option::none) + option::none) { if (args.size() != 2) throw usage(name); @@ -154,7 +154,7 @@ CMD(complete, N_("informative"), N_("(re CMD(complete, N_("informative"), N_("(revision|file|key) PARTIAL-ID"), N_("complete partial id"), - &option::verbose) + option::verbose) { if (args.size() != 2) throw usage(name); ============================================================ --- cmd_diff_log.cc 645e937e6c7ea0dfb7bd061f6644a34aeaa7ce32 +++ cmd_diff_log.cc 0b3b6640b02148e33843f175d78e503d039a887b @@ -259,7 +259,7 @@ dump_diffs(cset const & cs, i->second, i->second, data(), unpacked, - cout, app.diff_format, pattern); + cout, app.opts.diff_format, pattern); } map reverse_rename_map; @@ -315,7 +315,7 @@ dump_diffs(cset const & cs, delta_entry_src(i), delta_entry_dst(i), data_old, data_new, - cout, app.diff_format, pattern); + cout, app.opts.diff_format, pattern); } } @@ -333,16 +333,16 @@ CMD(diff, N_("informative"), N_("[PATH]. "If one revision is given, the diff between the workspace and\n" "that revision is shown. If two revisions are given, the diff between\n" "them is given. If no format is specified, unified is used by default."), - &option::revision % &option::depth % &option::exclude - % &option::unified_diff % &option::context_diff % &option::external_diff - % &option::external_diff_args) + option::revision % option::depth % option::exclude + % option::diff_format % option::no_show_encloser + % option::external_diff_args) { bool new_is_archived; ostringstream header; temp_node_id_source nis; if (app.opts.external_diff_args_given) - N(app.diff_format == external_diff, + N(app.opts.diff_format == external_diff, F("--diff-args requires --external\n" "try adding --external or removing --diff-args?")); @@ -479,7 +479,7 @@ CMD(diff, N_("informative"), N_("[PATH]. } cout << "# " << "\n"; - if (app.diff_format == external_diff) { + if (app.opts.diff_format == external_diff) { do_external_diff(included, app, new_is_archived); } else dump_diffs(included, app, new_is_archived); @@ -542,8 +542,8 @@ CMD(log, N_("informative"), N_("[FILE] . CMD(log, N_("informative"), N_("[FILE] ..."), N_("print history in reverse order (filtering by 'FILE'). If one or more\n" "revisions are given, use them as a starting point."), - &option::last % &option::next % &option::revision % &option::brief - % &option::diffs % &option::no_merges % &option::no_files) + option::last % option::next % option::revision % option::brief + % option::diffs % option::no_merges % option::no_files) { if (app.opts.revision.size() == 0) app.require_workspace("try passing a --revision to start at"); ============================================================ --- cmd_files.cc 536e5d798fa7327c512e7059bdbf77f9060885f2 +++ cmd_files.cc 2b02d86f5d17375dc71a639c44b2de2471be6a4f @@ -25,7 +25,7 @@ using std::vector; // fload, fmerge, and fdiff are simple commands for debugging the line // merger. -CMD(fload, N_("debug"), "", N_("load file contents into db"), &option::none) +CMD(fload, N_("debug"), "", N_("load file contents into db"), option::none) { string s = get_stdin(); @@ -40,7 +40,7 @@ CMD(fmerge, N_("debug"), N_(" "), N_("merge 3 files and output result"), - &option::none) + option::none) { if (args.size() != 3) throw usage(name); @@ -77,7 +77,8 @@ CMD(fdiff, N_("debug"), N_("SRCNAME DEST CMD(fdiff, N_("debug"), N_("SRCNAME DESTNAME SRCID DESTID"), N_("diff 2 files and output result"), - &option::context_diff % &option::unified_diff % &option::no_show_encloser) + option::diff_format % option::no_show_encloser + % option::external_diff_args) { if (args.size() != 4) throw usage(name); @@ -108,12 +109,12 @@ CMD(fdiff, N_("debug"), N_("SRCNAME DEST make_diff(src_name, dst_name, src_id, dst_id, src.inner(), dst.inner(), - cout, app.diff_format, pattern); + cout, app.opts.diff_format, pattern); } CMD(annotate, N_("informative"), N_("PATH"), N_("print annotated copy of the file from REVISION"), - &option::revision % &option::brief) + option::revision % option::brief) { revision_id rid; @@ -156,7 +157,7 @@ CMD(identify, N_("debug"), N_("[PATH]"), CMD(identify, N_("debug"), N_("[PATH]"), N_("calculate identity of PATH or stdin"), - &option::none) + option::none) { if (!(args.size() == 0 || args.size() == 1)) throw usage(name); @@ -181,7 +182,7 @@ CMD(cat, N_("informative"), CMD(cat, N_("informative"), N_("FILENAME"), N_("write file from database to stdout"), - &option::revision) + option::revision) { if (args.size() != 1) throw usage(name); ============================================================ --- cmd_key_cert.cc cad240267bef523859577d162bd719f6fa27ba46 +++ cmd_key_cert.cc 92378b2ad7b10d2c5c2fb432a52c14bc88bf322f @@ -24,7 +24,7 @@ CMD(genkey, N_("key and cert"), N_("KEYI using std::string; CMD(genkey, N_("key and cert"), N_("KEYID"), N_("generate an RSA key-pair"), - &option::none) + option::none) { if (args.size() != 1) throw usage(name); @@ -50,7 +50,7 @@ CMD(dropkey, N_("key and cert"), N_("KEY } CMD(dropkey, N_("key and cert"), N_("KEYID"), - N_("drop a public and private key"), &option::none) + N_("drop a public and private key"), option::none) { bool key_deleted = false; @@ -91,7 +91,7 @@ CMD(chkeypass, N_("key and cert"), N_("K CMD(chkeypass, N_("key and cert"), N_("KEYID"), N_("change passphrase of a private RSA key"), - &option::none) + option::none) { if (args.size() != 1) throw usage(name); @@ -111,7 +111,7 @@ CMD(cert, N_("key and cert"), N_("REVISI } CMD(cert, N_("key and cert"), N_("REVISION CERTNAME [CERTVAL]"), - N_("create a cert for a revision"), &option::none) + N_("create a cert for a revision"), option::none) { if ((args.size() != 3) && (args.size() != 2)) throw usage(name); @@ -150,7 +150,7 @@ CMD(trusted, N_("key and cert"), N_("REVISION NAME VALUE SIGNER1 [SIGNER2 [...]]"), N_("test whether a hypothetical cert would be trusted\n" "by current settings"), - &option::none) + option::none) { if (args.size() < 4) throw usage(name); @@ -194,7 +194,7 @@ CMD(tag, N_("review"), N_("REVISION TAGN } CMD(tag, N_("review"), N_("REVISION TAGNAME"), - N_("put a symbolic tag cert on a revision"), &option::none) + N_("put a symbolic tag cert on a revision"), option::none) { if (args.size() != 2) throw usage(name); @@ -207,7 +207,7 @@ CMD(testresult, N_("review"), N_("ID (pa CMD(testresult, N_("review"), N_("ID (pass|fail|true|false|yes|no|1|0)"), - N_("note the results of running a test on a revision"), &option::none) + N_("note the results of running a test on a revision"), option::none) { if (args.size() != 2) throw usage(name); @@ -221,7 +221,7 @@ CMD(approve, N_("review"), N_("REVISION" CMD(approve, N_("review"), N_("REVISION"), N_("approve of a particular revision"), - &option::branch_name) + option::branch_name) { if (args.size() != 1) throw usage(name); @@ -236,7 +236,7 @@ CMD(comment, N_("review"), N_("REVISION } CMD(comment, N_("review"), N_("REVISION [COMMENT]"), - N_("comment on a particular revision"), &option::none) + N_("comment on a particular revision"), option::none) { if (args.size() != 1 && args.size() != 2) throw usage(name); ============================================================ --- cmd_list.cc 1ab1b4e595b63b58732e5ea9478f105010a93965 +++ cmd_list.cc c2bd912e10c6518eb435a765d6085c6433006ffc @@ -470,7 +470,7 @@ CMD(list, N_("informative"), N_("show database objects, or the current workspace manifest, \n" "or known, unknown, intentionally ignored, missing, or \n" "changed-state files"), - &option::depth % &option::exclude) + option::depth % option::exclude) { if (args.size() == 0) throw usage(name); ============================================================ --- cmd_merging.cc a76a66f5d2facc8be195faefc2d9b69336e4f4ef +++ cmd_merging.cc 09aeeda6808b4a9585ed3deba54f10f614971eac @@ -76,7 +76,7 @@ CMD(update, N_("workspace"), "", "different revision, preserving uncommitted changes as it does so.\n" "If a revision is given, update the workspace to that revision.\n" "If not, update the workspace to the head of the branch."), - &option::branch_name % &option::revision) + option::branch_name % option::revision) { if (args.size() > 0) throw usage(name); @@ -318,7 +318,7 @@ CMD(merge, N_("tree"), "", N_("merge unm // (Possibility: append the --message/--message-file text to the synthetic // log message constructed in merge_two().) CMD(merge, N_("tree"), "", N_("merge unmerged heads of branch"), - &option::branch_name % &option::date % &option::author) + option::branch_name % option::date % option::author) { typedef std::pair revpair; typedef set::const_iterator rid_set_iter; @@ -418,7 +418,7 @@ CMD(propagate, N_("tree"), N_("SOURCE-BR CMD(propagate, N_("tree"), N_("SOURCE-BRANCH DEST-BRANCH"), N_("merge from one branch to another asymmetrically"), - &option::date % &option::author % &option::message % &option::msgfile) + option::date % option::author % option::message % option::msgfile) { if (args.size() != 2) throw usage(name); @@ -429,7 +429,7 @@ CMD(merge_into_dir, N_("tree"), N_("SOUR CMD(merge_into_dir, N_("tree"), N_("SOURCE-BRANCH DEST-BRANCH DIR"), N_("merge one branch into a subdirectory in another branch"), - &option::date % &option::author % &option::message % &option::msgfile) + option::date % option::author % option::message % option::msgfile) { // This is a special merge operator, but very useful for people // maintaining "slightly disparate but related" trees. It does a one-way @@ -589,7 +589,7 @@ CMD(explicit_merge, N_("tree"), N_("LEFT-REVISION RIGHT-REVISION DEST-BRANCH"), N_("merge two explicitly given revisions, " "placing result in given branch"), - &option::date % &option::author) + option::date % option::author) { revision_id left, right; string branch; @@ -614,7 +614,7 @@ CMD(show_conflicts, N_("informative"), N CMD(show_conflicts, N_("informative"), N_("REV REV"), N_("Show what conflicts would need to be resolved " "to merge the given revisions."), - &option::branch_name % &option::date % &option::author) + option::branch_name % option::date % option::author) { if (args.size() != 2) throw usage(name); @@ -665,7 +665,7 @@ CMD(pluck, N_("workspace"), N_("[-r FROM "\n" "If two revisions are given, applies the changes made to get from the\n" "first revision to the second."), - &option::revision % &option::depth % &option::exclude) + option::revision % option::depth % option::exclude) { // Work out our arguments revision_id from_rid, to_rid; @@ -819,7 +819,7 @@ CMD(heads, N_("tree"), "", N_("show unme } CMD(heads, N_("tree"), "", N_("show unmerged head revisions of branch"), - &option::branch_name) + option::branch_name) { set heads; if (args.size() != 0) @@ -844,7 +844,7 @@ CMD(get_roster, N_("debug"), N_("REVID") CMD(get_roster, N_("debug"), N_("REVID"), N_("dump the roster associated with the given REVID"), - &option::none) + option::none) { revision_id rid; if (args.size() == 0) ============================================================ --- cmd_netsync.cc 06fd5819e0cd160b6a045d6bc022b3d408e92a8b +++ cmd_netsync.cc 15d5c9b709562f438cd8cde781f1bd4727953121 @@ -99,7 +99,7 @@ CMD(push, N_("network"), N_("[ADDRESS[:P CMD(push, N_("network"), N_("[ADDRESS[:PORTNUMBER] [PATTERN]]"), N_("push branches matching PATTERN to netsync server at ADDRESS"), - &option::set_default % &option::exclude % &option::key_to_push) + option::set_default % option::exclude % option::key_to_push) { utf8 addr, include_pattern, exclude_pattern; process_netsync_args(name, args, addr, include_pattern, exclude_pattern, true, false, app); @@ -114,7 +114,7 @@ CMD(pull, N_("network"), N_("[ADDRESS[:P CMD(pull, N_("network"), N_("[ADDRESS[:PORTNUMBER] [PATTERN]]"), N_("pull branches matching PATTERN from netsync server at ADDRESS"), - &option::set_default % &option::exclude) + option::set_default % option::exclude) { utf8 addr, include_pattern, exclude_pattern; process_netsync_args(name, args, addr, include_pattern, exclude_pattern, true, false, app); @@ -128,7 +128,7 @@ CMD(sync, N_("network"), N_("[ADDRESS[:P CMD(sync, N_("network"), N_("[ADDRESS[:PORTNUMBER] [PATTERN]]"), N_("sync branches matching PATTERN with netsync server at ADDRESS"), - &option::set_default % &option::exclude % &option::key_to_push) + option::set_default % option::exclude % option::key_to_push) { utf8 addr, include_pattern, exclude_pattern; process_netsync_args(name, args, addr, include_pattern, exclude_pattern, true, false, app); @@ -175,8 +175,8 @@ CMD_NO_WORKSPACE(serve, N_("network"), N CMD_NO_WORKSPACE(serve, N_("network"), N_("PATTERN ..."), N_("serve the branches specified by PATTERNs to connecting clients"), - &option::bind % &option::pidfile % &option::exclude % - &option::bind_stdio % &option::no_transport_auth) + option::bind % option::pidfile % option::exclude % + option::bind_stdio % option::no_transport_auth) { if (args.size() < 1) throw usage(name); @@ -195,7 +195,7 @@ CMD_NO_WORKSPACE(serve, N_("network"), N } else { - E(app.opts.bind_stdio, + E(app.opts.bind.stdio, F("The --no-transport-auth option is only permitted in combination with --stdio")); } @@ -203,7 +203,7 @@ CMD_NO_WORKSPACE(serve, N_("network"), N utf8 dummy_addr, include_pattern, exclude_pattern; process_netsync_args(name, args, dummy_addr, include_pattern, exclude_pattern, false, true, app); - run_netsync_protocol(server_voice, source_and_sink_role, app.bind_address, + run_netsync_protocol(server_voice, source_and_sink_role, app.opts.bind.address, include_pattern, exclude_pattern, app); } ============================================================ --- cmd_othervcs.cc 9a8de176dcbfff487b10a1a1de6ac95cbafea61d +++ cmd_othervcs.cc 0ea15c34e85e85d97d15c74f0e8d10749e9a60aa @@ -16,7 +16,7 @@ CMD(rcs_import, N_("debug"), N_("RCSFILE N_("parse versions in RCS files\n" "this command doesn't reconstruct or import revisions." "you probably want cvs_import"), - &option::branch_name) + option::branch_name) { if (args.size() < 1) throw usage(name); @@ -31,7 +31,7 @@ CMD(cvs_import, N_("rcs"), N_("CVSROOT") CMD(cvs_import, N_("rcs"), N_("CVSROOT"), N_("import all versions in CVS repository"), - &option::branch_name) + option::branch_name) { if (args.size() != 1) throw usage(name); ============================================================ --- cmd_packet.cc 8b90e9112bed3dd0aaeed955d4ef88c3845a3af8 +++ cmd_packet.cc 4e1f5a875df2278072c6f2ebcf3b4b4bccb2867f @@ -20,7 +20,7 @@ CMD(pubkey, N_("packet i/o"), N_("ID"), CMD(pubkey, N_("packet i/o"), N_("ID"), N_("write public key packet to stdout"), - &option::none) + option::none) { if (args.size() != 1) throw usage(name); @@ -49,7 +49,7 @@ CMD(privkey, N_("packet i/o"), N_("ID"), CMD(privkey, N_("packet i/o"), N_("ID"), N_("write private key packet to stdout"), - &option::none) + option::none) { if (args.size() != 1) throw usage(name); @@ -68,7 +68,7 @@ CMD(read, N_("packet i/o"), "[FILE1 [FIL CMD(read, N_("packet i/o"), "[FILE1 [FILE2 [...]]]", N_("read packets from files or stdin"), - &option::none) + option::none) { packet_db_writer dbw(app); size_t count = 0; ============================================================ --- cmd_ws_commit.cc 64ff3e0d5fc2b1ffe0be8e435f9d44d9c038bbcd +++ cmd_ws_commit.cc 812083b7054c02abb252f535ecce089b0a17bdfb @@ -65,7 +65,7 @@ CMD(revert, N_("workspace"), N_("[PATH]. CMD(revert, N_("workspace"), N_("[PATH]..."), N_("revert file(s), dir(s) or entire workspace (\".\")"), - &option::depth % &option::exclude % &option::missing) + option::depth % option::exclude % option::missing) { temp_node_id_source nis; roster_t old_roster, new_roster; @@ -188,7 +188,7 @@ CMD(disapprove, N_("review"), N_("REVISI CMD(disapprove, N_("review"), N_("REVISION"), N_("disapprove of a particular revision"), - &option::branch_name) + option::branch_name) { if (args.size() != 1) throw usage(name); @@ -240,7 +240,7 @@ CMD(add, N_("workspace"), N_("[PATH]..." CMD(add, N_("workspace"), N_("[PATH]..."), - N_("add files to workspace"), &option::unknown) + N_("add files to workspace"), option::unknown) { if (!app.opts.unknown && (args.size() < 1)) throw usage(name); @@ -275,7 +275,7 @@ CMD(drop, N_("workspace"), N_("[PATH]... CMD(drop, N_("workspace"), N_("[PATH]..."), N_("drop files from workspace"), - &option::execute % &option::missing % &option::recursive) + option::execute % option::missing % option::recursive) { if (!app.opts.missing && (args.size() < 1)) throw usage(name); @@ -313,7 +313,7 @@ CMD(rename, N_("workspace"), N_("SRC DEST\n" "SRC1 [SRC2 [...]] DEST_DIR"), N_("rename entries in the workspace"), - &option::execute) + option::execute) { if (args.size() < 2) throw usage(name); @@ -342,7 +342,7 @@ ALIAS(mv, rename) "that is currently the root\n" "directory will have name PUT_OLD.\n" "Using --execute is strongly recommended."), - &option::execute) + option::execute) { if (args.size() != 2) throw usage(name); @@ -354,7 +354,7 @@ CMD(status, N_("informative"), N_("[PATH } CMD(status, N_("informative"), N_("[PATH]..."), N_("show status of workspace"), - &option::depth % &option::exclude) + option::depth % option::exclude) { roster_t old_roster, new_roster; cset included, excluded; @@ -422,7 +422,7 @@ CMD(checkout, N_("tree"), N_("[DIRECTORY "If a revision is given, that's the one that will be checked out.\n" "Otherwise, it will be the head of the branch (given or implicit).\n" "If no directory is given, the branch name will be used as directory"), - &option::branch_name % &option::revision) + option::branch_name % option::revision) { revision_id ident; system_path dir; @@ -559,7 +559,7 @@ CMD(attr, N_("workspace"), N_("set PATH CMD(attr, N_("workspace"), N_("set PATH ATTR VALUE\nget PATH [ATTR]\ndrop PATH [ATTR]"), N_("set, get or drop file attributes"), - &option::none) + option::none) { if (args.size() < 2 || args.size() > 4) throw usage(name); @@ -659,8 +659,8 @@ CMD(commit, N_("workspace"), N_("[PATH]. CMD(commit, N_("workspace"), N_("[PATH]..."), N_("commit workspace to database"), - &option::branch_name % &option::message % &option::msgfile % &option::date - % &option::author % &option::depth % &option::exclude) + option::branch_name % option::message % option::msgfile % option::date + % option::author % option::depth % option::exclude) { utf8 log_message(""); bool log_message_given; @@ -899,7 +899,7 @@ CMD_NO_WORKSPACE(setup, N_("tree"), N_(" CMD_NO_WORKSPACE(setup, N_("tree"), N_("[DIRECTORY]"), N_("setup a new workspace directory, default to current"), - &option::branch_name) + option::branch_name) { if (args.size() > 1) throw usage(name); @@ -923,7 +923,7 @@ CMD_NO_WORKSPACE(migrate_workspace, N_(" CMD_NO_WORKSPACE(migrate_workspace, N_("tree"), N_("[DIRECTORY]"), N_("migrate a workspace directory's metadata to the latest format; " "defaults to the current workspace"), - &option::none) + option::none) { if (args.size() > 1) throw usage(name); @@ -935,7 +935,7 @@ CMD(refresh_inodeprints, N_("tree"), "", } CMD(refresh_inodeprints, N_("tree"), "", N_("refresh the inodeprint cache"), - &option::none) + option::none) { app.require_workspace(); app.work.enable_inodeprints(); ============================================================ --- commands.cc 6613df8206ea1da9f46089eb65f68d4c16bd2042 +++ commands.cc a7bbc30a64a0bd915a544a8ad7acd8a5f836dd91 @@ -251,7 +251,7 @@ namespace commands } //////////////////////////////////////////////////////////////////////// -CMD(help, N_("informative"), N_("command [ARGS...]"), N_("display command help"), &option::none) +CMD(help, N_("informative"), N_("command [ARGS...]"), N_("display command help"), option::none) { if (args.size() < 1) { @@ -267,7 +267,7 @@ CMD(help, N_("informative"), N_("command throw usage(full_cmd); } -CMD(crash, hidden_group(), "{ N | E | I | exception | signal }", "trigger the specified kind of crash", &option::none) +CMD(crash, hidden_group(), "{ N | E | I | exception | signal }", "trigger the specified kind of crash", option::none) { if (args.size() != 1) throw usage(name); ============================================================ --- lua_hooks.cc ef71d9f8bf14e2a80314eb736438fb794ae64547 +++ lua_hooks.cc 91dddfeeb524fedf4368e8a528681d75a201a97d @@ -67,7 +67,7 @@ extern "C" map::iterator i = map_of_lua_to_app.find(L); if (i != map_of_lua_to_app.end()) { - system_path dir = i->second->get_confdir(); + system_path dir = i->second->opts.conf_dir; string confdir = dir.as_external(); lua_pushstring(L, confdir.c_str()); } @@ -136,7 +136,7 @@ lua_hooks::default_rcfilename(system_pat { map::iterator i = map_of_lua_to_app.find(st); I(i != map_of_lua_to_app.end()); - file = i->second->get_confdir() / "monotonerc"; + file = i->second->opts.conf_dir / "monotonerc"; } void ============================================================ --- monotone.cc 54762c67817af2a5c66cfcb996573a5bae18af9d +++ monotone.cc 64a1f474469ca88b966469988115b6b5791f2a2d @@ -125,7 +125,7 @@ void localize_monotone() } // read command-line options and return the command name -string read_options(option & opts, vector args) +string read_options(option::options & opts, vector args) { opts.from_cmdline(args); @@ -226,45 +226,6 @@ cpp_main(int argc, char ** argv) app.keys.set_key_dir(app.opts.key_dir); } - if (app.opts.bind_given) - { - { - string arg = app.opts.bind; - string addr_part, port_part; - size_t l_colon = arg.find(':'); - size_t r_colon = arg.rfind(':'); - - // not an ipv6 address, as that would have at least two colons - if (l_colon == r_colon) - { - addr_part = (r_colon == string::npos ? arg : arg.substr(0, r_colon)); - port_part = (r_colon == string::npos ? "" : arg.substr(r_colon+1, arg.size() - r_colon)); - } - else - { - // IPv6 addresses have a port specified in the style: [2001:388:0:13::]:80 - size_t squareb = arg.rfind(']'); - if ((arg.find('[') == 0) && (squareb != string::npos)) - { - if (squareb < r_colon) - port_part = (r_colon == string::npos ? "" : arg.substr(r_colon+1, arg.size() - r_colon)); - else - port_part = ""; - addr_part = (squareb == string::npos ? arg.substr(1, arg.size()) : arg.substr(1, squareb-1)); - } - else - { - addr_part = arg; - port_part = ""; - } - } - app.opts.bind_stdio = false; - app.bind_address = utf8(addr_part); - app.bind_port = utf8(port_part); - } - app.set_is_explicit_option(app.opts.bind); - } - // stop here if they asked for help if (app.opts.help) { @@ -280,7 +241,7 @@ cpp_main(int argc, char ** argv) app.allow_workspace(); if (!app.found_workspace && global_sanity.filename.empty()) - global_sanity.filename = (app.get_confdir() / "dump").as_external(); + global_sanity.filename = (app.opts.conf_dir / "dump").as_external(); // main options processed, now invoke the // sub-command w/ remaining args ============================================================ --- netsync.cc 2e81dcbccb07f21bd38a4a139a05d5c9271f3c83 +++ netsync.cc e90bd2aeb5deabd6e153bd9921ab8154fb7af8d3 @@ -2667,8 +2667,8 @@ serve_connections(protocol_role role, timeout(static_cast(timeout_seconds)), instant(0,1); - if (!app.bind_port().empty()) - default_port = std::atoi(app.bind_port().c_str()); + if (!app.opts.bind.port().empty()) + default_port = std::atoi(app.opts.bind.port().c_str()); #ifdef USE_IPV6 bool use_ipv6=true; #else @@ -2686,8 +2686,8 @@ serve_connections(protocol_role role, Netxx::Address addr(use_ipv6); - if (!app.bind_address().empty()) - addr.add_address(app.bind_address().c_str(), default_port); + if (!app.opts.bind.address().empty()) + addr.add_address(app.opts.bind.address().c_str(), default_port); else addr.add_all_addresses (default_port); @@ -3136,7 +3136,7 @@ run_netsync_protocol(protocol_voice voic { if (voice == server_voice) { - if (app.opts.bind_stdio) + if (app.opts.bind.stdio) { shared_ptr str(new Netxx::PipeStream(0,1)); shared_ptr sess(new session(role, server_voice, ============================================================ --- option.cc 8d0a0bdde963824d7748b1e0f9512c56987a89c9 +++ option.cc f9bcfadfb5ea6629f70cb0a3cc106b000abf3800 @@ -1,9 +1,10 @@ #include #include #include "charset.hh" #include "file_io.hh" #include "option.hh" +#include "platform.hh" #include "sanity.hh" #include "ui.hh" @@ -12,7 +13,6 @@ using std::vector; using std::string; using std::vector; -option::nothing option::none; option_error::option_error(std::string const & str) : std::invalid_argument((F("option error: %s") % str).str()) @@ -41,6 +41,41 @@ struct bad_arg_internal bad_arg_internal(string const & str = "") : reason(str) {} }; +void bind_opt::set(string const & arg) +{ + string addr_part, port_part; + size_t l_colon = arg.find(':'); + size_t r_colon = arg.rfind(':'); + + // not an ipv6 address, as that would have at least two colons + if (l_colon == r_colon) + { + addr_part = (r_colon == string::npos ? arg : arg.substr(0, r_colon)); + port_part = (r_colon == string::npos ? "" : arg.substr(r_colon+1, arg.size() - r_colon)); + } + else + { + // IPv6 addresses have a port specified in the style: [2001:388:0:13::]:80 + size_t squareb = arg.rfind(']'); + if ((arg.find('[') == 0) && (squareb != string::npos)) + { + if (squareb < r_colon) + port_part = (r_colon == string::npos ? "" : arg.substr(r_colon+1, arg.size() - r_colon)); + else + port_part = ""; + addr_part = (squareb == string::npos ? arg.substr(1, arg.size()) : arg.substr(1, squareb-1)); + } + else + { + addr_part = arg; + port_part = ""; + } + } + stdio = false; + address = utf8(addr_part); + port = utf8(port_part); +} + static void splitname(string const & from, string & name, string & n) { // from looks like "foo" or "foo,f" @@ -57,17 +92,18 @@ bool has_arg() { return false; } template<> bool has_arg() { return false; } -template -void option::map_opt(void (option::*setter)(string const &), - string const & optname, - T option::* ptr, - string const & description) + +void option::options::map_opt(void (option::options::*setter)(string const &), + string const & optname, + option::optid id, + bool has_arg, + string const & description) { - option::opt o; + opt o; o.setter = setter; - o.has_arg = has_arg(); + o.has_arg = has_arg; o.desc = gettext(description.c_str()); - o.id = optset::conv(ptr); + o.id = id; string name, n; splitname(/*gettext*/(optname.c_str()), name, n); opt_map.insert(make_pair(name, o)); @@ -75,24 +111,26 @@ void option::map_opt(void (option::*sett opt_map.insert(make_pair(n, o)); } -option::option() +option::options::options() { # define GOPT(varname, optname, type, default_, description) \ - map_opt(&option::set_ ## varname, optname, \ - &option:: varname, description); \ - global_option.add( &option:: varname ); \ + map_opt(&options::set_ ## varname, optname, \ + option:: varname, has_arg(), description); \ + global_option.add( option:: varname ); \ + varname = type ( default_ ); \ varname ## _given = false; # define COPT(varname, optname, type, default_, description) \ - map_opt(&option::set_ ## varname, optname, \ - &option:: varname, description); \ - all_cmd_option.add( &option:: varname ); \ + map_opt(&options::set_ ## varname, optname, \ + option:: varname, has_arg(), description); \ + all_cmd_option.add( option:: varname ); \ + varname = type ( default_ ); \ varname ## _given = false; # include "option_list.hh" # undef GOPT # undef COPT } -void option::clear_cmd_options() +void option::options::clear_cmd_options() { # define GOPT(varname, optname, type, default_, description) # define COPT(varname, optname, type, default_, description) \ @@ -103,7 +141,7 @@ void option::clear_cmd_options() # undef COPT } -void option::clear_global_options() +void option::options::clear_global_options() { # define GOPT(varname, optname, type, default_, description) \ varname = type ( default_ ); \ @@ -115,7 +153,7 @@ void option::clear_global_options() } #define GOPT(varname, optname, type, default_, description) \ - void option::set_ ## varname (std::string const & arg) \ + void option::options::set_ ## varname (std::string const & arg) \ { \ varname ## _given = true; \ try {set_ ## varname ## _helper (arg); } \ @@ -129,9 +167,9 @@ void option::clear_global_options() throw bad_arg( #varname, arg, e.reason); \ } \ } \ - void option::set_ ## varname ## _helper (string const & arg) + void option::options::set_ ## varname ## _helper (string const & arg) #define COPT(varname, optname, type, default_, description) \ - void option::set_ ## varname (std::string const & arg) \ + void option::options::set_ ## varname (std::string const & arg) \ { \ varname ## _given = true; \ try {set_ ## varname ## _helper (arg); } \ @@ -145,14 +183,15 @@ void option::clear_global_options() throw bad_arg( #varname, arg, e.reason); \ } \ } \ - void option::set_ ## varname ## _helper (string const & arg) + void option::options::set_ ## varname ## _helper (string const & arg) #define option_bodies #include "option_list.hh" #undef GOPT #undef COPT #undef option_bodies -option::opt const & option::getopt(string const & name, optset const & allowed) +option::options::opt const & +option::options::getopt(string const & name, optset const & allowed) { map::iterator i = opt_map.find(name); if (i == opt_map.end()) @@ -164,8 +203,8 @@ option::opt const & option::getopt(strin return i->second; } -void option::set(string const & name, string const & given, - optset const & allowed) +void option::options::set(string const & name, string const & given, + optset const & allowed) { (this->*getopt(name, allowed).setter)(given); } @@ -239,9 +278,9 @@ tokenize_for_command_line(string const & to.push_back(cur); } -void option::from_cmdline_restricted(std::vector & args, - optset allowed, - bool allow_xargs) +void option::options::from_cmdline_restricted(std::vector & args, + optset allowed, + bool allow_xargs) { for (unsigned int i = 0; i < args.size(); ++i) { @@ -322,7 +361,7 @@ void option::from_cmdline_restricted(std } } -void option::from_cmdline(vector & args, bool allow_xargs) +void option::options::from_cmdline(vector & args, bool allow_xargs) { from_cmdline_restricted(args, all_cmd_option, allow_xargs); } @@ -354,11 +393,11 @@ struct optstrings string shortname; string desc; }; -std::string option::get_usage_str(optset const & opts) const +std::string option::options::get_usage_str(optset const & opts) const { // collect the options we want to show (opt_map has separate // entries for the short and long versions of each option) - map option_strings; + map option_strings; for (map::const_iterator i = opt_map.begin(); i != opt_map.end(); ++i) { @@ -377,7 +416,7 @@ std::string option::get_usage_str(optset // combind the name strings like "--long [ -s ]" map to_display; unsigned int namelen = 0; // the longest option name string - for (map::iterator i = option_strings.begin(); + for (map::iterator i = option_strings.begin(); i != option_strings.end(); ++i) { optstrings const & strings = i->second; @@ -431,3 +470,11 @@ std::string option::get_usage_str(optset } return result; } + +// Local Variables: +// mode: C++ +// fill-column: 76 +// c-file-style: "gnu" +// indent-tabs-mode: nil +// End: +// vim: et:sw=2:sts=2:ts=2:cino=>2s,{s,\:s,+s,t0,g0,^-2,e-2,n-2,p2s,(0,=s: ============================================================ --- option.hh b5709532cf7e0302e9a81a3d89ed3e5bd332f696 +++ option.hh 2bdce8881c879e3c45bfe5873454d53a5eb6362f @@ -37,107 +37,105 @@ struct bad_arg : public option_error std::string const & reason); }; -struct option +struct bind_opt { - struct nothing {}; - static nothing none; + utf8 address; + utf8 port; + bool stdio; + bind_opt() : stdio(false) {} + void set(std::string const & arg); +}; + +namespace option { + enum optid { +# define GOPT(varname, optname, type, default_, description) \ + varname, +# define COPT(varname, optname, type, default_, description) \ + GOPT(varname, optname, type, default_, description) +# include "option_list.hh" +# undef GOPT +# undef COPT + none + }; class optset { + std::set items; public: - // This has to convert pointer-to-arbitrary-member-of-option into - // something uniform that can be put in a set (ie, has '<' and '=='). - typedef void * opt_id; - template - static opt_id conv(T option::* item) + void add(option::optid item) { - return reinterpret_cast(&((*((option*)0)).*item)); + items.insert(item); } - private: - std::set items; - public: - template - void add(T option::* item) + optset & operator%(option::optid item) { - items.insert(conv(item)); - } - template - optset & operator%(T option::* item) - { add(item); return *this; } - optset & operator%(nothing*) + bool contains(option::optid id) const { - return *this; - } - bool contains(opt_id id) const - { return items.find(id) != items.end(); } - template - bool contains(T option::* item) const - { - return contains(conv(item)); - } bool empty() const { return items.empty(); } }; - option(); - void clear_cmd_options(); - void clear_global_options(); - void set(std::string const & name, std::string const & given) - { set(name, given, all_cmd_option); } - // if allow_xargs is true, then any instances of --xargs (or -@) in - // args will be replaced with the parsed contents of the referenced file - void from_cmdline(std::vector & args, bool allow_xargs = true); - void from_cmdline_restricted(std::vector & args, - optset allowed, - bool allow_xargs = true); - optset const & global_opts() const { return global_option; } - optset const & specific_opts() const { return all_cmd_option; } - std::string get_usage_str(optset const & opts) const; + struct options + { + options(); + void clear_cmd_options(); + void clear_global_options(); + void set(std::string const & name, std::string const & given) + { set(name, given, all_cmd_option); } + // if allow_xargs is true, then any instances of --xargs (or -@) in + // args will be replaced with the parsed contents of the referenced file + void from_cmdline(std::vector & args, bool allow_xargs = true); + void from_cmdline_restricted(std::vector & args, + optset allowed, + bool allow_xargs = true); + optset const & global_opts() const { return global_option; } + optset const & specific_opts() const { return all_cmd_option; } -# define GOPT(varname, optname, type, default_, description) \ - type varname; \ - bool varname ## _given; -# define COPT(varname, optname, type, default_, description) \ - type varname; \ - bool varname ## _given; -# include "option_list.hh" -# undef GOPT -# undef COPT -private: -# define GOPT(varname, optname, type, default_, description) \ - void set_ ## varname (std::string const & arg); \ - void set_ ## varname ## _helper (std::string const & arg); -# define COPT(varname, optname, type, default_, description) \ - void set_ ## varname (std::string const & arg); \ - void set_ ## varname ## _helper (std::string const & arg); -# include "option_list.hh" -# undef GOPT -# undef COPT + std::string get_usage_str(optset const & opts) const; - struct opt - { - void (option::*setter)(std::string const &); - std::string desc; - bool has_arg; - option::optset::opt_id id; +# define GOPT(varname, optname, type, default_, description) \ + type varname; \ + bool varname ## _given; +# define COPT(varname, optname, type, default_, description) \ + GOPT(varname, optname, type, default_, description) +# include "option_list.hh" +# undef GOPT +# undef COPT + private: +# define GOPT(varname, optname, type, default_, description) \ + void set_ ## varname (std::string const & arg); \ + void set_ ## varname ## _helper (std::string const & arg); +# define COPT(varname, optname, type, default_, description) \ + void set_ ## varname (std::string const & arg); \ + void set_ ## varname ## _helper (std::string const & arg); +# include "option_list.hh" +# undef GOPT +# undef COPT + + struct opt + { + void (options::*setter)(std::string const &); + std::string desc; + bool has_arg; + option::optid id; + }; + std::map opt_map; + optset global_option, all_cmd_option; + opt const & getopt(std::string const & name, optset const & allowed); + void set(std::string const & name, std::string const & given, + optset const & allowed); + void map_opt(void (options::*setter)(std::string const &), + std::string const & optname, + optid id, + bool has_arg, + std::string const & description); }; - std::map opt_map; - optset global_option, all_cmd_option; - opt const & getopt(std::string const & name, optset const & allowed); - void set(std::string const & name, std::string const & given, - optset const & allowed); - template - void map_opt(void (option::*setter)(std::string const &), - std::string const & optname, - T option::* ptr, - std::string const & description); -}; +} #endif ============================================================ --- option_list.hh 4f70f8afe3afba5be0aee26fc44a13d2a0ba51e5 +++ option_list.hh 15ae68787ffb067dd009a23b1e1b6ca502f01949 @@ -23,11 +23,11 @@ COPT(automate_stdio_size, "automate-stdi } #endif -COPT(bind, "bind", std::string, , +COPT(bind, "bind", bind_opt, , gettext_noop("address:port to listen on (default :4691)")) #ifdef option_bodies { - bind = arg; + bind.set(arg); } #endif @@ -47,7 +47,7 @@ COPT(brief, "brief", bool, false, } #endif -GOPT(conf_dir, "confdir", system_path, , +GOPT(conf_dir, "confdir", system_path, get_default_confdir(), gettext_noop("set location of configuration directory")) #ifdef option_bodies { @@ -57,14 +57,6 @@ GOPT(conf_dir, "confdir", system_path, , } #endif -COPT(context_diff, "context", bool, false, - gettext_noop("use context diff format")) -#ifdef option_bodies -{ - context_diff = true; -} -#endif - COPT(date, "date", boost::posix_time::ptime, , gettext_noop("override date/time for commit")) #ifdef option_bodies @@ -121,6 +113,21 @@ COPT(external_diff_args, "diff-args", st } #endif +COPT(diff_format, "diff-type", diff_type, unified_diff, + gettext_noop("argument to pass external diff hook")) +#ifdef option_bodies +{ + if (arg == _("context")) + diff_format = context_diff; + else if (arg == _("external")) + diff_format = external_diff; + else if (arg == _("unified")) + diff_format = unified_diff; + else + throw bad_arg_internal(F("unknown diff type").str()); +} +#endif + COPT(diffs, "diffs", bool, false, gettext_noop("print diffs along with logs")) #ifdef option_bodies { @@ -161,14 +168,6 @@ COPT(execute, "execute,e", bool, false, } #endif -COPT(external_diff, "external", bool, false, - gettext_noop("use external diff hook for generating diffs")) -#ifdef option_bodies -{ - external_diff = true; -} -#endif - GOPT(full_version, "full-version", bool, false, gettext_noop("print detailed version number, then exit")) #ifdef option_bodies @@ -364,11 +363,11 @@ COPT(revision, "revision,r", std::vector } #endif -GOPT(root, "root", std::string, , +GOPT(root, "root", system_path, current_root_path(), gettext_noop("limit search for workspace to specified root")) #ifdef option_bodies { - root = arg; + root = system_path(arg); } #endif @@ -383,7 +382,8 @@ COPT(bind_stdio, "stdio", bool, false, g COPT(bind_stdio, "stdio", bool, false, gettext_noop("serve netsync on stdio")) #ifdef option_bodies { - bind_stdio = true; + // Yes, this sets a field in the structure belonging to the "bind" option. + bind.stdio = true; } #endif @@ -403,14 +403,6 @@ GOPT(ticker, "ticker", std::string, , } #endif -COPT(unified_diff, "unified", bool, false, - gettext_noop("use unified diff format")) -#ifdef option_bodies -{ - unified_diff = true; -} -#endif - COPT(unknown, "unknown", bool, false, gettext_noop("perform the operations for unknown files from workspace")) #ifdef option_bodies ============================================================ --- sha1.cc 378b34e73cbf9117f4966540c7099e63f7efbf69 +++ sha1.cc f81e2a20ae2fb90e962f570303f71b6401ccf00e @@ -92,7 +92,7 @@ void hook_botan_sha1() Botan::Engine_Core::add_engine(new Monotone_SHA1_Engine); } -CMD(benchmark_sha1, hidden_group(), "", "benchmark SHA-1 cores", &option::none) +CMD(benchmark_sha1, hidden_group(), "", "benchmark SHA-1 cores", option::none) { P(F("Benchmarking %s SHA-1 cores") % registry().size()); int mebibytes = 100;