Feature os_fedora,kali,openbsd,mysys2 and fix some bug with os;Add stdarg in helper.h ;Add OS_macros in helper.h

This commit is contained in:
Heng Guo
2023-09-03 12:01:43 +08:00
parent 251ea5c827
commit 890bf23b28
3 changed files with 270 additions and 23 deletions

View File

@@ -12,6 +12,7 @@
#ifndef XY_H
#define XY_H
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
@@ -19,6 +20,7 @@
// #define NDEBUG
#ifdef _WIN32
static bool xy_on_windows = true;
@@ -26,20 +28,36 @@
static bool xy_on_macos = false;
static bool xy_on_bsds = false;
static char* xy_os_devnull = "nul";
#include <windows.h>
#define xy_useutf8() SetConsoleOutputCP(65001)
#else
#elif defined(__linux__) || defined(__linux)
static bool xy_on_windows = false;
static bool xy_on_linux = true;
static bool xy_on_macos = false;
static bool xy_on_bsds = false;
static char* xy_os_devnull = "/dev/null"
#define xy_useutf8()
#elif defined(TARGET_OS_MAC) ||defined(__MACOSX__)
static bool xy_on_windows = false;
static bool xy_on_linux = false;
static bool xy_on_macos = true;
static bool xy_on_bsds = false;
#define xy_useutf8()
#elif defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)
static bool xy_on_windows = false;
static bool xy_on_linux = false;
static bool xy_on_macos = false;
static bool xy_on_bsds = true;
#define xy_useutf8()
#endif