From 3803d55e1ab1b788f5559c143cc18dc92238e45e Mon Sep 17 00:00:00 2001 From: Alexandre Nizoux Date: Thu, 16 Apr 2020 12:50:55 +0200 Subject: [PATCH] ABOUT: Further changes to version display --- src/build.c | 27 +++++---------------------- src/sv_main.c | 2 +- src/version.h | 22 ++++++++++------------ 3 files changed, 16 insertions(+), 35 deletions(-) diff --git a/src/build.c b/src/build.c index 63f05cbc..73c9da0b 100644 --- a/src/build.c +++ b/src/build.c @@ -27,16 +27,6 @@ #include "qwsvdef.h" -/* -======================= -VersionString -====================== -*/ -char *VersionString (void) -{ - return VERSION_NUMBER " (build " GIT_COMMIT ")"; -} - /* ======================= VersionStringFull @@ -47,19 +37,12 @@ char *VersionStringFull (void) static char str[256]; if (!str[0]) { - snprintf(str, sizeof(str), SERVER_NAME " " VERSION_NUMBER " (" QW_PLATFORM " build " GIT_COMMIT ")"); + if (GIT_COMMIT) { + snprintf(str, sizeof(str), SERVER_NAME " " VERSION_NUMBER); + } else { + snprintf(str, sizeof(str), SERVER_NAME " " VERSION_NUMBER " (build " GIT_COMMIT "/" QW_PLATFORM_SHORT ")"); + } } return str; } - -/* -======================= -Version_f -====================== -*/ -void Version_f (void) -{ - Con_Printf ("%s\n%s\nHome page: %s\n", VersionStringFull(), BUILD_DATE, HOMEPAGE_URL); -} - diff --git a/src/sv_main.c b/src/sv_main.c index d37a6fb1..d9ab722f 100644 --- a/src/sv_main.c +++ b/src/sv_main.c @@ -3799,7 +3799,7 @@ void Host_Init (int argc, char **argv, int default_memsize) Con_Printf ("%4.1f megabyte heap\n", (float)hunk_size / (1024 * 1024)); Con_Printf ("QuakeWorld Initialized\n"); - Version_f(); + Con_Printf (VersionStringFull()); Cbuf_InsertText ("exec server.cfg\n"); diff --git a/src/version.h b/src/version.h index afe8e62e..39629e28 100644 --- a/src/version.h +++ b/src/version.h @@ -25,39 +25,39 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #if defined(_WIN32) #define QW_PLATFORM "Windows" -#define QW_PLATFORM_SHORT "(w)" +#define QW_PLATFORM_SHORT "w" #elif defined(__FreeBSD__) #define QW_PLATFORM "FreeBSD" -#define QW_PLATFORM_SHORT "(f)" +#define QW_PLATFORM_SHORT "f" #elif defined(__OpenBSD__) #define QW_PLATFORM "OpenBSD" -#define QW_PLATFORM_SHORT "(o)" +#define QW_PLATFORM_SHORT "o" #elif defined(__NetBSD__) #define QW_PLATFORM "NetBSD" -#define QW_PLATFORM_SHORT "(n)" +#define QW_PLATFORM_SHORT "n" #elif defined(__DragonFly__) #define QW_PLATFORM "DragonFly" -#define QW_PLATFORM_SHORT "(d)" +#define QW_PLATFORM_SHORT "d" #elif defined(__linux__) #define QW_PLATFORM "Linux" -#define QW_PLATFORM_SHORT "(l)" +#define QW_PLATFORM_SHORT "l" #elif defined(__sun__) #define QW_PLATFORM "SunOS" -#define QW_PLATFORM_SHORT "(s)" +#define QW_PLATFORM_SHORT "s" #elif defined(__APPLE__) #define QW_PLATFORM "MacOS" -#define QW_PLATFORM_SHORT "(m)" +#define QW_PLATFORM_SHORT "m" #else #define QW_PLATFORM "Unknown" -#define QW_PLATFORM_SHORT "(u)" +#define QW_PLATFORM_SHORT "u" #endif @@ -67,14 +67,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define SERVER_NAME "MVDSV" #define HOMEPAGE_URL "https://github.com/deurk/mvdsv" #define BUILD_DATE __DATE__ ", " __TIME__ -#define GIT_COMMIT "unknown" +#define GIT_COMMIT "" #define QWDTOOLS_NAME "QWDtools" -char *VersionString (void); char *VersionStringFull (void); -void Version_f (void); #endif /* !__VERSION_H__ */