diff options
27 files changed, 27 insertions, 24 deletions
diff --git a/src/apps/apps.h b/src/apps/apps.h index ae4f884b6..cf77923fe 100644 --- a/src/apps/apps.h +++ b/src/apps/apps.h @@ -6,7 +6,7 @@ using namespace Botan; -#define DEFINE_EXAMPLE(cmd) int cmd (int argc, char* argv[]); +#define DEFINE_EXAMPLE(cmd) int cmd ## _main(int argc, char* argv[]); DEFINE_EXAMPLE(asn1); DEFINE_EXAMPLE(bcrypt); @@ -28,3 +28,5 @@ DEFINE_EXAMPLE(tls_client); DEFINE_EXAMPLE(tls_server); DEFINE_EXAMPLE(tls_server_asio); DEFINE_EXAMPLE(x509); + +int speed_main(int argc, char* argv[]); diff --git a/src/apps/asn1.cpp b/src/apps/asn1.cpp index 447462ae0..79d52d485 100644 --- a/src/apps/asn1.cpp +++ b/src/apps/asn1.cpp @@ -47,7 +47,7 @@ std::string url_encode(const std::vector<byte>& in) } -int asn1(int argc, char* argv[]) +int asn1_main(int argc, char* argv[]) { if(argc != 2) { diff --git a/src/apps/base64.cpp b/src/apps/base64.cpp index 697fcb42c..34711857c 100644 --- a/src/apps/base64.cpp +++ b/src/apps/base64.cpp @@ -15,7 +15,7 @@ #include <botan/b64_filt.h> #include <botan/pipe.h> -int base64(int argc, char* argv[]) +int base64_main(int argc, char* argv[]) { if(argc < 2) { diff --git a/src/apps/bcrypt.cpp b/src/apps/bcrypt.cpp index 497111363..2b0bfa132 100644 --- a/src/apps/bcrypt.cpp +++ b/src/apps/bcrypt.cpp @@ -1,7 +1,7 @@ #include "apps.h" #include <botan/bcrypt.h> -int bcrypt(int argc, char* argv[]) +int bcrypt_main(int argc, char* argv[]) { if(argc == 2) { diff --git a/src/apps/bzip.cpp b/src/apps/bzip.cpp index 94a8bdff7..3b8c7cdc2 100644 --- a/src/apps/bzip.cpp +++ b/src/apps/bzip.cpp @@ -28,7 +28,7 @@ const std::string SUFFIX = ".bz2"; -int bzip(int argc, char* argv[]) +int bzip_main(int argc, char* argv[]) { if(argc < 2) { diff --git a/src/apps/ca.cpp b/src/apps/ca.cpp index 881036fc8..17d930358 100644 --- a/src/apps/ca.cpp +++ b/src/apps/ca.cpp @@ -7,7 +7,7 @@ using namespace Botan; #include <memory> #include <chrono> -int ca(int argc, char* argv[]) +int ca_main(int argc, char* argv[]) { if(argc != 5) { diff --git a/src/apps/cert_verify.cpp b/src/apps/cert_verify.cpp index 78d82e9a5..154267fe1 100644 --- a/src/apps/cert_verify.cpp +++ b/src/apps/cert_verify.cpp @@ -12,7 +12,7 @@ using namespace Botan; -int cert_verify(int argc, char* argv[]) +int cert_verify_main(int argc, char* argv[]) { if(argc <= 2) { diff --git a/src/apps/dsa_sign.cpp b/src/apps/dsa_sign.cpp index 31aaf7aeb..308e68814 100644 --- a/src/apps/dsa_sign.cpp +++ b/src/apps/dsa_sign.cpp @@ -12,7 +12,7 @@ using namespace Botan; const std::string SUFFIX = ".sig"; -int dsa_sign(int argc, char* argv[]) +int dsa_sign_main(int argc, char* argv[]) { if(argc != 4) { diff --git a/src/apps/dsa_ver.cpp b/src/apps/dsa_ver.cpp index 9cf0ed969..a5d0ca271 100644 --- a/src/apps/dsa_ver.cpp +++ b/src/apps/dsa_ver.cpp @@ -22,7 +22,7 @@ secure_vector<byte> b64_decode(const std::string& in) } -int dsa_verify(int argc, char* argv[]) +int dsa_verify_main(int argc, char* argv[]) { if(argc != 4) { diff --git a/src/apps/factor.cpp b/src/apps/factor.cpp index 484f024d8..7a5018d62 100644 --- a/src/apps/factor.cpp +++ b/src/apps/factor.cpp @@ -121,7 +121,7 @@ std::vector<BigInt> factorize(const BigInt& n_in, } -int factor(int argc, char* argv[]) +int factor_main(int argc, char* argv[]) { if(argc != 2) { diff --git a/src/apps/fpe.cpp b/src/apps/fpe.cpp index dd5b9b682..e40db8a32 100644 --- a/src/apps/fpe.cpp +++ b/src/apps/fpe.cpp @@ -102,7 +102,7 @@ u64bit decrypt_cc_number(u64bit enc_cc, } -int fpe(int argc, char* argv[]) +int fpe_main(int argc, char* argv[]) { if(argc != 4) { diff --git a/src/apps/hash.cpp b/src/apps/hash.cpp index c1e5aab3e..5c5705210 100644 --- a/src/apps/hash.cpp +++ b/src/apps/hash.cpp @@ -11,7 +11,7 @@ using namespace Botan; -int hash(int argc, char* argv[]) +int hash_main(int argc, char* argv[]) { if(argc < 3) { diff --git a/src/apps/keygen.cpp b/src/apps/keygen.cpp index 885364834..40055f6cf 100644 --- a/src/apps/keygen.cpp +++ b/src/apps/keygen.cpp @@ -8,7 +8,7 @@ #include <botan/rsa.h> using namespace Botan; -int keygen(int argc, char* argv[]) +int keygen_main(int argc, char* argv[]) { if(argc != 2 && argc != 3) { diff --git a/src/apps/ocsp.cpp b/src/apps/ocsp.cpp index 853debbe3..98324caff 100644 --- a/src/apps/ocsp.cpp +++ b/src/apps/ocsp.cpp @@ -8,7 +8,7 @@ using namespace Botan; -int ocsp_check(int argc, char* argv[]) +int ocsp_check_main(int argc, char* argv[]) { if(argc != 2) { diff --git a/src/apps/pkcs10.cpp b/src/apps/pkcs10.cpp index 6e36f73fb..cb1d44436 100644 --- a/src/apps/pkcs10.cpp +++ b/src/apps/pkcs10.cpp @@ -8,7 +8,7 @@ using namespace Botan; #include <fstream> #include <memory> -int pkcs10(int argc, char* argv[]) +int pkcs10_main(int argc, char* argv[]) { if(argc != 6) { diff --git a/src/apps/read_ssh.cpp b/src/apps/read_ssh.cpp index ce72fa064..2745f3209 100644 --- a/src/apps/read_ssh.cpp +++ b/src/apps/read_ssh.cpp @@ -111,7 +111,7 @@ Public_Key* read_ssh_pubkey(const std::string& file) } -int read_ssh(int argc, char* argv[]) +int read_ssh_main(int argc, char* argv[]) { if(argc != 2) { diff --git a/src/apps/self_sig.cpp b/src/apps/self_sig.cpp index c4202442c..7d05aed60 100644 --- a/src/apps/self_sig.cpp +++ b/src/apps/self_sig.cpp @@ -8,7 +8,7 @@ using namespace Botan; #include <fstream> #include <memory> -int self_sig(int argc, char* argv[]) +int self_sig_main(int argc, char* argv[]) { if(argc != 7) { diff --git a/src/speed/pk_bench.cpp b/src/apps/speed/pk_bench.cpp index 6ebb366c5..6ebb366c5 100644 --- a/src/speed/pk_bench.cpp +++ b/src/apps/speed/pk_bench.cpp diff --git a/src/speed/speed.cpp b/src/apps/speed/speed.cpp index 1cd3ec0f7..1cd3ec0f7 100644 --- a/src/speed/speed.cpp +++ b/src/apps/speed/speed.cpp diff --git a/src/speed/speed.h b/src/apps/speed/speed.h index ec0d06733..b4aabca8a 100644 --- a/src/speed/speed.h +++ b/src/apps/speed/speed.h @@ -2,7 +2,7 @@ #ifndef BOTAN_CHECK_BENCHMARK_H__ #define BOTAN_CHECK_BENCHMARK_H__ -#include "../common.h" +#include "../apps.h" #include <botan/rng.h> #include <botan/transform.h> #include <string> diff --git a/src/speed/timer.cpp b/src/apps/speed/timer.cpp index 9f3d34607..9f3d34607 100644 --- a/src/speed/timer.cpp +++ b/src/apps/speed/timer.cpp diff --git a/src/speed/timer.h b/src/apps/speed/timer.h index 48d6b6805..48d6b6805 100644 --- a/src/speed/timer.h +++ b/src/apps/speed/timer.h diff --git a/src/apps/tls_client.cpp b/src/apps/tls_client.cpp index 24c8197f6..7f201d5a9 100644 --- a/src/apps/tls_client.cpp +++ b/src/apps/tls_client.cpp @@ -132,7 +132,7 @@ std::string protocol_chooser(const std::vector<std::string>& protocols) } -int tls_client(int argc, char* argv[]) +int tls_client_main(int argc, char* argv[]) { if(argc != 2 && argc != 3 && argc != 4) { diff --git a/src/apps/tls_server.cpp b/src/apps/tls_server.cpp index cb212fef6..819b9f380 100644 --- a/src/apps/tls_server.cpp +++ b/src/apps/tls_server.cpp @@ -121,7 +121,7 @@ void alert_received(TLS::Alert alert, const byte buf[], size_t buf_size) } -int tls_server(int argc, char* argv[]) +int tls_server_main(int argc, char* argv[]) { int port = 4433; std::string transport = "tcp"; diff --git a/src/apps/tls_server_asio.cpp b/src/apps/tls_server_asio.cpp index 119e2154f..b49206136 100644 --- a/src/apps/tls_server_asio.cpp +++ b/src/apps/tls_server_asio.cpp @@ -275,7 +275,7 @@ size_t choose_thread_count() } -int tls_server_asio(int argc, char* argv[]) +int tls_server_asio_main(int argc, char* argv[]) { try { diff --git a/src/apps/x509print.cpp b/src/apps/x509print.cpp index c79ae7a6b..935b50668 100644 --- a/src/apps/x509print.cpp +++ b/src/apps/x509print.cpp @@ -1,7 +1,7 @@ #include "apps.h" #include <botan/x509cert.h> -int x509(int argc, char* argv[]) +int x509_main(int argc, char* argv[]) { if(argc < 1) { diff --git a/src/main.cpp b/src/main.cpp index 0d71c4ebd..64715f1d6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -27,7 +27,6 @@ using namespace Botan; #include "common.h" -#include "speed/speed.h" #include "tests/tests.h" #include "apps/apps.h" @@ -122,8 +121,10 @@ int main(int argc, char* argv[]) std::cout << resp << "\n"; } + //return app_main(cmd, argc - 1, argv + 1); + #define CALL_CMD(cmdsym) \ - do { if(cmd == #cmdsym) { return cmdsym (argc - 1, argv + 1); } } while(0) + do { if(cmd == #cmdsym) { return cmdsym ##_main (argc - 1, argv + 1); } } while(0) CALL_CMD(asn1); CALL_CMD(base64); |