diff options
author | lloyd <[email protected]> | 2014-01-10 23:07:16 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2014-01-10 23:07:16 +0000 |
commit | ad6555f522ae16f6284e8dafa02f630b88bcf289 (patch) | |
tree | bd63c51dbeab75eb0f90c72589bc922141237056 /src/cmd/main.cpp | |
parent | 6894dca64c04936d07048c0e8cbf7e25858548c3 (diff) |
Split up docs into the reference manual, the website, and everything else.
Add `website` target to makefile.
Some progress towards fixing minimized builds.
TLS now hard requires ECDSA and GCM since otherwise a minimized build
has only insecure options.
Remove boost_thread dependency in command line tool
Diffstat (limited to 'src/cmd/main.cpp')
-rw-r--r-- | src/cmd/main.cpp | 82 |
1 files changed, 56 insertions, 26 deletions
diff --git a/src/cmd/main.cpp b/src/cmd/main.cpp index 2d675d546..5f6a0042f 100644 --- a/src/cmd/main.cpp +++ b/src/cmd/main.cpp @@ -37,24 +37,21 @@ int help(int , char* argv[]) return 1; } +int config_main(int argc, char* argv[]) + { + return 1; + } + } -int main(int argc, char* argv[]) +int unimplemented(int , char* argv[], const char* what) { - if(BOTAN_VERSION_MAJOR != version_major() || - BOTAN_VERSION_MINOR != version_minor() || - BOTAN_VERSION_PATCH != version_patch()) - { - std::cout << "Warning: linked version (" - << version_major() << '.' - << version_minor() << '.' - << version_patch() - << ") does not match version built against (" - << BOTAN_VERSION_MAJOR << '.' - << BOTAN_VERSION_MINOR << '.' - << BOTAN_VERSION_PATCH << ")\n"; - } + std::cout << argv[0] << " command not implemented - library missing " << what << "\n"; + return 1; + } +int main(int argc, char* argv[]) + { try { Botan::LibraryInitializer init; @@ -67,9 +64,29 @@ int main(int argc, char* argv[]) if(cmd == "help") return help(argc, argv); + if(cmd == "config") + { + return config_main(argc - 1, argv + 1); + } + if(cmd == "version") { std::cout << Botan::version_string() << "\n"; + + if(BOTAN_VERSION_MAJOR != version_major() || + BOTAN_VERSION_MINOR != version_minor() || + BOTAN_VERSION_PATCH != version_patch()) + { + std::cout << "Warning: linked version (" + << version_major() << '.' + << version_minor() << '.' + << version_patch() + << ") does not match version built against (" + << BOTAN_VERSION_MAJOR << '.' + << BOTAN_VERSION_MINOR << '.' + << BOTAN_VERSION_PATCH << ")\n"; + } + return 0; } @@ -79,24 +96,37 @@ int main(int argc, char* argv[]) return 0; } - if(cmd == "speed") - return speed_main(argc - 1, argv + 1); - if(cmd == "http_get") { auto resp = HTTP::GET_sync(argv[2]); std::cout << resp << "\n"; } - int e = apps_main(cmd, argc - 1, argv + 1); - - if(e == -1) - { - std::cout << "Unknown command " << cmd << "\n"; - return help(argc, argv); - } - - return e; +#define CALL_APP(cmdsym) \ + do { if(cmd == #cmdsym) { return cmdsym ##_main (argc - 1, argv + 1); } } while(0) + + CALL_APP(asn1); + CALL_APP(base64); + CALL_APP(bcrypt); + CALL_APP(bzip); + CALL_APP(ca); + CALL_APP(factor); + CALL_APP(fpe); + CALL_APP(hash); + CALL_APP(keygen); + CALL_APP(dsa_sign); + CALL_APP(dsa_verify); + CALL_APP(pkcs10); + CALL_APP(read_ssh); + CALL_APP(self_sig); + CALL_APP(tls_client); + CALL_APP(tls_server); + CALL_APP(tls_server_asio); + CALL_APP(x509); + CALL_APP(speed); + + std::cout << "Unknown command " << cmd << "\n"; + return help(argc, argv); } catch(std::exception& e) { |