From 035f127081c3e911b55fe8232f6f19261ccef910 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Thu, 28 Jan 2016 14:26:50 +0100 Subject: [PATCH] Added get_build_config functions. --- client/common/cmdline.c | 7 +------ include/freerdp/freerdp.h | 1 + libfreerdp/core/freerdp.c | 17 ++++++++++++++--- libfreerdp/core/test/TestVersion.c | 4 ++++ winpr/include/winpr/winpr.h | 1 + winpr/libwinpr/utils/test/TestVersion.c | 4 ++++ winpr/libwinpr/utils/winpr.c | 17 ++++++++++++++--- 7 files changed, 39 insertions(+), 12 deletions(-) diff --git a/client/common/cmdline.c b/client/common/cmdline.c index 42fa8d14b..6d1c46890 100644 --- a/client/common/cmdline.c +++ b/client/common/cmdline.c @@ -21,7 +21,6 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include "buildflags.h" #include @@ -187,11 +186,7 @@ int freerdp_client_print_version() int freerdp_client_print_buildconfig() { - printf("Build configuration: %s\n", BUILD_CONFIG); - printf("Build type: %s\n", BUILD_TYPE); - printf("CFLAGS: %s\n", CFLAGS); - printf("Compiler: %s, %s\n", COMPILER_ID, COMPILER_VERSION); - printf("Target architecture: %s\n", TARGET_ARCH); + printf("%s", freerdp_get_build_config()); return 1; } diff --git a/include/freerdp/freerdp.h b/include/freerdp/freerdp.h index d2db002fa..cbc539887 100644 --- a/include/freerdp/freerdp.h +++ b/include/freerdp/freerdp.h @@ -272,6 +272,7 @@ FREERDP_API void freerdp_get_version(int* major, int* minor, int* revision); FREERDP_API const char* freerdp_get_version_string(void); FREERDP_API const char* freerdp_get_build_date(void); FREERDP_API const char* freerdp_get_build_revision(void); +FREERDP_API const char* freerdp_get_build_config(void); FREERDP_API freerdp* freerdp_new(void); FREERDP_API void freerdp_free(freerdp* instance); diff --git a/libfreerdp/core/freerdp.c b/libfreerdp/core/freerdp.c index cce07fe3b..18c2f56d1 100644 --- a/libfreerdp/core/freerdp.c +++ b/libfreerdp/core/freerdp.c @@ -30,6 +30,7 @@ #include "transport.h" #include "connection.h" #include "message.h" +#include "buildflags.h" #include @@ -438,13 +439,23 @@ const char* freerdp_get_version_string(void) const char* freerdp_get_build_date(void) { - static char build_date[64]; - - sprintf_s(build_date, sizeof(build_date), "%s %s", __DATE__, __TIME__); + static char build_date[] = __DATE__ " " __TIME__; return build_date; } +const char* freerdp_get_build_config(void) +{ + static const char build_config[] = + "Build configuration: " BUILD_CONFIG "\n" + "Build type: " BUILD_TYPE "\n" + "CFLAGS: " CFLAGS "\n" + "Compiler: " COMPILER_ID ", " COMPILER_VERSION "\n" + "Target architecture: " TARGET_ARCH "\n"; + + return build_config; +} + const char* freerdp_get_build_revision(void) { return GIT_REVISION; diff --git a/libfreerdp/core/test/TestVersion.c b/libfreerdp/core/test/TestVersion.c index 3203088c0..146e81f1b 100644 --- a/libfreerdp/core/test/TestVersion.c +++ b/libfreerdp/core/test/TestVersion.c @@ -33,6 +33,10 @@ int TestVersion(int argc, char* argv[]) if (!build) return -1; + build = freerdp_get_build_config(); + if (!build) + return -1; + return 0; } diff --git a/winpr/include/winpr/winpr.h b/winpr/include/winpr/winpr.h index 87cc17d1c..4e9250974 100644 --- a/winpr/include/winpr/winpr.h +++ b/winpr/include/winpr/winpr.h @@ -51,5 +51,6 @@ WINPR_API void winpr_get_version(int* major, int* minor, int* revision); WINPR_API const char* winpr_get_version_string(void); WINPR_API const char* winpr_get_build_date(void); WINPR_API const char* winpr_get_build_revision(void); +WINPR_API const char* winpr_get_build_config(void); #endif /* WINPR_H */ diff --git a/winpr/libwinpr/utils/test/TestVersion.c b/winpr/libwinpr/utils/test/TestVersion.c index cef572892..60c4f900b 100644 --- a/winpr/libwinpr/utils/test/TestVersion.c +++ b/winpr/libwinpr/utils/test/TestVersion.c @@ -36,6 +36,10 @@ int TestVersion(int argc, char* argv[]) if (!build) return -1; + build = winpr_get_build_config(); + if (!build) + return -1; + return 0; } diff --git a/winpr/libwinpr/utils/winpr.c b/winpr/libwinpr/utils/winpr.c index e6dbd9056..409368998 100644 --- a/winpr/libwinpr/utils/winpr.c +++ b/winpr/libwinpr/utils/winpr.c @@ -22,6 +22,8 @@ #include "config.h" #endif +#include "buildflags.h" + #include #include #include @@ -46,9 +48,7 @@ const char* winpr_get_version_string(void) const char* winpr_get_build_date(void) { - static char build_date[64]; - - sprintf_s(build_date, sizeof(build_date), "%s %s", __DATE__, __TIME__); + static char build_date[] = __DATE__ " " __TIME__; return build_date; } @@ -58,3 +58,14 @@ const char* winpr_get_build_revision(void) return GIT_REVISION; } +const char* winpr_get_build_config(void) +{ + static const char build_config[] = + "Build configuration: " BUILD_CONFIG "\n" + "Build type: " BUILD_TYPE "\n" + "CFLAGS: " CFLAGS "\n" + "Compiler: " COMPILER_ID ", " COMPILER_VERSION "\n" + "Target architecture: " TARGET_ARCH "\n"; + + return build_config; +}