diff options
author | lloyd <[email protected]> | 2006-12-09 09:00:08 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2006-12-09 09:00:08 +0000 |
commit | 9526081c45b0947912db8911fa1cb948921811ba (patch) | |
tree | 94f871b780d372450c814a63d9aeb018575dbf8d /checks | |
parent | 989534a10b4fd6eba210a22467c2bb314b174f51 (diff) |
Use OptionParser::init_if_set
Inline the print_help function
Diffstat (limited to 'checks')
-rw-r--r-- | checks/check.cpp | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/checks/check.cpp b/checks/check.cpp index ac4e75fa3..7446da9df 100644 --- a/checks/check.cpp +++ b/checks/check.cpp @@ -27,7 +27,6 @@ void benchmark(const std::string&, bool html, double seconds); void bench_pk(const std::string&, bool html, double seconds); u32bit bench_algo(const std::string&, double); int validate(); -void print_help(); int main(int argc, char* argv[]) { @@ -37,13 +36,23 @@ int main(int argc, char* argv[]) "benchmark|bench-type=|bench-algo=|seconds="); opts.parse(argv); - std::string init_flags = (opts.is_set("init") ? opts.value("init") : ""); - - Botan::InitializerOptions init_options(init_flags); + Botan::InitializerOptions init_options(opts.value_if_set("init")); Botan::LibraryInitializer init(init_options); if(opts.is_set("help") || argc <= 1) - { print_help(); return 1; } + { + std::cerr << Botan::version_string() << " test driver\n" + << "Options:\n" + << " --validate: Check test vectors\n" + << " --benchmark: Benchmark everything\n" + << " --bench-type={block,mode,stream,hash,mac,rng,pk}:\n" + << " Benchmark only algorithms of a particular type\n" + << " --html: Produce HTML output for benchmarks\n" + << " --seconds=n: Benchmark for n seconds\n" + << " --help: Print this message\n"; + return 1; + } + if(opts.is_set("validate")) return validate(); @@ -117,19 +126,6 @@ int main(int argc, char* argv[]) return 0; } -void print_help() - { - std::cout << Botan::version_string() << " test driver" << std::endl - << "Usage:\n" - << " --validate: Check test vectors\n" - << " --benchmark: Benchmark everything\n" - << " --bench-type={block,mode,stream,hash,mac,rng,pk}:\n" - << " Benchmark only algorithms of a particular type\n" - << " --html: Produce HTML output for benchmarks\n" - << " --seconds=n: Benchmark for n seconds\n" - << " --help: Print this message\n"; - } - int validate() { void test_types(); |