From 6e17fa6d7ba57b990dd929e07969d35dc82fc46b Mon Sep 17 00:00:00 2001 From: Kevin Butler Date: Sun, 1 Sep 2013 17:38:01 +0100 Subject: Added --library-versions flag to print the compile time and runtime versions of libevent, openssl and zlib. Partially implements #6384. --- src/or/config.c | 18 ++++++++++++++++++ src/or/main.c | 9 ++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) (limited to 'src/or') diff --git a/src/or/config.c b/src/or/config.c index 657bc6039..b00f0d6e1 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -46,6 +46,7 @@ #include "statefile.h" #include "transports.h" #include "ext_orport.h" +#include "torgzip.h" #ifdef _WIN32 #include #endif @@ -3816,6 +3817,7 @@ options_init_from_torrc(int argc, char **argv) printf("Tor version %s.\n",get_version()); exit(0); } + if (argc > 1 && (!strcmp(argv[1],"--digests"))) { printf("Tor version %s.\n",get_version()); printf("%s", libor_get_digests()); @@ -3823,6 +3825,22 @@ options_init_from_torrc(int argc, char **argv) exit(0); } + if (argc > 1 && (!strcmp(argv[1],"--library-versions"))) { + printf("Tor version %s. \n", get_version()); + printf("Library versions\tCompiled\t\tRuntime\n"); + printf("Libevent\t\t%-15s\t\t%s\n", + tor_libevent_get_header_version_str(), + tor_libevent_get_version_str()); + printf("OpenSSL \t\t%-15s\t\t%s\n", + crypto_openssl_get_header_version_str(), + crypto_openssl_get_version_str()); + printf("Zlib \t\t%-15s\t\t%s\n", + tor_zlib_get_header_version_str(), + tor_zlib_get_version_str()); + //TODO: Hex versions? + exit(0); + } + /* Go through command-line variables */ if (!global_cmdline_options) { /* Or we could redo the list every time we pass this place. diff --git a/src/or/main.c b/src/or/main.c index 33e1c6437..2d6ca74d8 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -2343,6 +2343,8 @@ tor_init(int argc, char *argv[]) /* --version implies --quiet */ if (!strcmp(argv[i], "--version")) quiet = 2; + if (!strcmp(argv[i], "--library-versions")) + quiet = 2; } /* give it somewhere to log to initially */ switch (quiet) { @@ -2365,11 +2367,12 @@ tor_init(int argc, char *argv[]) #else ""; #endif - log_notice(LD_GENERAL, "Tor v%s %srunning on %s with Libevent %s " - "and OpenSSL %s.", version, bev_str, + log_notice(LD_GENERAL, "Tor v%s %srunning on %s with Libevent %s, " + "OpenSSL %s and Zlib %s.", version, bev_str, get_uname(), tor_libevent_get_version_str(), - crypto_openssl_get_version_str()); + crypto_openssl_get_version_str(), + tor_zlib_get_version_str()); log_notice(LD_GENERAL, "Tor can't help you if you use it wrong! " "Learn how to be safe at " -- cgit v1.2.3