From 1e98b16602570969b928fdac10a476ffe72e59ae Mon Sep 17 00:00:00 2001 From: Fufu Fang Date: Tue, 31 Aug 2021 14:00:47 +0100 Subject: [PATCH] Now prints version number at startup --- src/config.c | 3 +++ src/log.c | 13 +++++++++++++ src/log.h | 5 +++++ src/main.c | 12 ------------ 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/config.c b/src/config.c index 24f4a59..a4be982 100644 --- a/src/config.c +++ b/src/config.c @@ -70,4 +70,7 @@ void Config_init(void) CONFIG.sonic_id3 = 0; CONFIG.sonic_insecure = 0; + + /*---------- Print version number -----------*/ + print_version(); } diff --git a/src/log.c b/src/log.c index 3984db9..18c22b7 100644 --- a/src/log.c +++ b/src/log.c @@ -3,6 +3,8 @@ #include "config.h" #include "util.h" +#include + #include #include #include @@ -53,4 +55,15 @@ log_printf(LogType type, const char *file, const char *func, int line, exit_failure(); } } +} + +void print_version() +{ + /* FUSE prints its help to stderr */ + lprintf(info, "HTTPDirFS version " VERSION "\n"); + /* + * --------- Print off SSL engine version --------- + */ + curl_version_info_data *data = curl_version_info(CURLVERSION_NOW); + lprintf(info, "libcurl SSL engine: %s\n", data->ssl_version); } \ No newline at end of file diff --git a/src/log.h b/src/log.h index 4b1f77b..33e827f 100644 --- a/src/log.h +++ b/src/log.h @@ -39,3 +39,8 @@ void log_printf(LogType type, const char *file, const char *func, int line, #define lprintf(type, ...) \ log_printf(type, __FILE__, __func__, __LINE__, __VA_ARGS__); #endif + +/** + * \brief Print the version information for HTTPDirFS + */ +void print_version(); \ No newline at end of file diff --git a/src/main.c b/src/main.c index de31d53..c75649e 100644 --- a/src/main.c +++ b/src/main.c @@ -10,7 +10,6 @@ void add_arg(char ***fuse_argv_ptr, int *fuse_argc, char *opt_string); static void print_help(char *program_name, int long_help); -static void print_version(); static void print_long_help(); static int parse_arg_list(int argc, char **argv, char ***fuse_argv, int *fuse_argc); @@ -331,17 +330,6 @@ static void print_help(char *program_name, int long_help) } } -static void print_version() -{ - /* FUSE prints its help to stderr */ - fprintf(stderr, "HTTPDirFS version " VERSION "\n"); - /* - * --------- Print off SSL engine version --------- - */ - curl_version_info_data *data = curl_version_info(CURLVERSION_NOW); - fprintf(stderr, "libcurl SSL engine: %s\n", data->ssl_version); -} - static void print_long_help() { /* FUSE prints its help to stderr */