Small improvement to platform detection.

This commit is contained in:
LoRd_MuldeR 2022-04-08 23:10:27 +02:00
parent 70e9d2d3b5
commit 50955210ac
Signed by: mulder
GPG Key ID: 2B5913365F57E03F
2 changed files with 75 additions and 64 deletions

View File

@ -157,7 +157,7 @@ int MAIN(const int argc, CHR *const argv[])
init_terminal(); init_terminal();
setup_signal_handler(SIGINT, sigint_handler); setup_signal_handler(SIGINT, sigint_handler);
FPRINTF(stderr, T("SlunkCrypt Utility (%") T(PRIstr) T("-%") T(PRIstr) T("), by LoRd_MuldeR <MuldeR2@GMX.de>\n"), OS_TYPE, CPU_ARCH); FPRINTF(stderr, T("SlunkCrypt Utility (%") T(PRIstr) T("-%") T(PRIstr) T("), by LoRd_MuldeR <MuldeR2@GMX.de>\n"), OS_TYPE_NAME, CPU_ARCH);
FPRINTF(stderr, T("Using libSlunkCrypt v%u.%u.%u [%") T(PRIstr) T("]\n\n"), SLUNKCRYPT_VERSION_MAJOR, SLUNKCRYPT_VERSION_MINOR, SLUNKCRYPT_VERSION_PATCH, SLUNKCRYPT_BUILD); FPRINTF(stderr, T("Using libSlunkCrypt v%u.%u.%u [%") T(PRIstr) T("]\n\n"), SLUNKCRYPT_VERSION_MAJOR, SLUNKCRYPT_VERSION_MINOR, SLUNKCRYPT_VERSION_PATCH, SLUNKCRYPT_BUILD);
fflush(stderr); fflush(stderr);

View File

@ -16,26 +16,36 @@
# endif # endif
#endif #endif
#if defined(_WIN32) /* Detect operating system type */
# define OS_TYPE "Windows" #if defined(__MINGW32__)
# define OS_TYPE_NAME "MinGW32"
#elif defined(_WIN32)
# define OS_TYPE_NAME "Windows"
#elif defined(__CYGWIN__) #elif defined(__CYGWIN__)
# define OS_TYPE "Cygwin" # define OS_TYPE_NAME "Cygwin"
#elif defined(__linux__) #elif defined(__linux__)
# define OS_TYPE "Linux" # define OS_TYPE_NAME "Linux"
#elif defined(__FreeBSD__) #elif defined(__FreeBSD__)
# define OS_TYPE "FreeBSD" # define OS_TYPE_NAME "FreeBSD"
#elif defined(__DragonFly__)
# define OS_TYPE_NAME "DragonFly"
#elif defined(__NetBSD__) #elif defined(__NetBSD__)
# define OS_TYPE "NetBSD" # define OS_TYPE_NAME "NetBSD"
#elif defined(__OpenBSD__) #elif defined(__OpenBSD__)
# define OS_TYPE "OpenBSD" # define OS_TYPE_NAME "OpenBSD"
#elif defined(__sun) #elif defined(__sun) && defined(__SVR4)
# define OS_TYPE "Solaris" # define OS_TYPE_NAME "Solaris"
#elif defined(__QNX__)
# define OS_TYPE_NAME "QNX"
#elif defined(__APPLE__) && defined(__MACH__)
# define OS_TYPE_NAME "macOS"
#elif defined(__unix__) #elif defined(__unix__)
# define OS_TYPE "Unix" # define OS_TYPE_NAME "Unix"
#else #else
# error Unknown operating system! # error Unknown operating system!
#endif #endif
/* Detect CPU architecture */
#if defined(__x86_64__) || defined(_M_X64) #if defined(__x86_64__) || defined(_M_X64)
# define CPU_ARCH "x64" # define CPU_ARCH "x64"
#elif defined(__i386__) || defined(_M_IX86) #elif defined(__i386__) || defined(_M_IX86)
@ -48,6 +58,7 @@
# error Unknown CPU architecture! # error Unknown CPU architecture!
#endif #endif
/* Platform-specific quirks */
#ifdef _WIN32 #ifdef _WIN32
# define MAIN wmain # define MAIN wmain
# define CHR wchar_t # define CHR wchar_t