shuffle up ncport.h to restore Hurd

This commit is contained in:
nick black 2021-08-16 00:23:33 -04:00
parent d00a96d850
commit 99a653db5f
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

View File

@ -10,28 +10,28 @@ extern "C" {
// 32-bit values to little-endian (as used in the nccell gcluster field). This // 32-bit values to little-endian (as used in the nccell gcluster field). This
// ought be defined so that it's a a no-op on little-endian builds. // ought be defined so that it's a a no-op on little-endian builds.
#if defined(__MINGW64__) // Windows #ifndef(__MINGW64__) // All but Windows
#define wcwidth(w) 1 // FIXME lol, no
#define wcswidth(w, s) (s) // FIXME lol, no
#define htole(x) (x) // FIXME are all windows installs LE? ugh
#else // Non-Windows, UNIX-common
#include <poll.h> #include <poll.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <termios.h> #include <termios.h>
#endif #endif
#if defined(__gnu_hurd__) // Hurd #if defined(__linux__) // Linux
#define wcwidth(w) 1 // FIXME lol, no
#define wcswidth(w, s) (s) // FIXME lol, no
#endif
#if defined(__linux__) || defined(__gnu_hurd__) // Linux/Hurd
#include <byteswap.h> #include <byteswap.h>
#define htole(x) (__bswap_32(htonl(x))) #define htole(x) (__bswap_32(htonl(x)))
#elif defined(__APPLE__) // macOS #elif defined(__APPLE__) // macOS
#include <libkern/OSByteOrder.h> #include <libkern/OSByteOrder.h>
#define htole(x) (OSSwapInt32(htonl(x))) #define htole(x) (OSSwapInt32(htonl(x)))
#else // BSD #elif defined(__gnu_hurd__) // Hurd
#include <byteswap.h>
#define htole(x) (__bswap_32(htonl(x)))
#define wcwidth(w) 1 // FIXME lol, no
#define wcswidth(w, s) (s) // FIXME lol, no
#elif defined(__MINGW64__) // Windows
#define wcwidth(w) 1 // FIXME lol, no
#define wcswidth(w, s) (s) // FIXME lol, no
#define htole(x) (x) // FIXME are all windows installs LE? ugh
#else // BSDs
#include <sys/endian.h> #include <sys/endian.h>
#define htole(x) (bswap32(htonl(x))) #define htole(x) (bswap32(htonl(x)))
#endif #endif