From 9a8221568ada269d20c3e9d291ad5f9d07cac755 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Sun, 21 Mar 2021 19:40:56 +0100 Subject: Rework TTY column * Rename internal identifier from TTY_NR to just TTY * Unify column header on platforms * Use devname(3) on BSD derivate to show the actual terminal, simplifies current FreeBSD implementation. * Use 'unsigned long int' as id type, to fit dev_t on Linux. Only on Solaris the terminal path is not yet resolved. --- Macros.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'Macros.h') diff --git a/Macros.h b/Macros.h index 736d31c5..789b09b6 100644 --- a/Macros.h +++ b/Macros.h @@ -4,27 +4,31 @@ #include // IWYU pragma: keep #ifndef MINIMUM -#define MINIMUM(a, b) ((a) < (b) ? (a) : (b)) +#define MINIMUM(a, b) ((a) < (b) ? (a) : (b)) #endif #ifndef MAXIMUM -#define MAXIMUM(a, b) ((a) > (b) ? (a) : (b)) +#define MAXIMUM(a, b) ((a) > (b) ? (a) : (b)) #endif #ifndef CLAMP -#define CLAMP(x, low, high) (assert((low) <= (high)), ((x) > (high)) ? (high) : MAXIMUM(x, low)) +#define CLAMP(x, low, high) (assert((low) <= (high)), ((x) > (high)) ? (high) : MAXIMUM(x, low)) #endif #ifndef ARRAYSIZE -#define ARRAYSIZE(x) (sizeof(x) / sizeof((x)[0])) +#define ARRAYSIZE(x) (sizeof(x) / sizeof((x)[0])) #endif #ifndef SPACESHIP_NUMBER -#define SPACESHIP_NUMBER(a, b) (((a) > (b)) - ((a) < (b))) +#define SPACESHIP_NUMBER(a, b) (((a) > (b)) - ((a) < (b))) #endif #ifndef SPACESHIP_NULLSTR -#define SPACESHIP_NULLSTR(a, b) strcmp((a) ? (a) : "", (b) ? (b) : "") +#define SPACESHIP_NULLSTR(a, b) strcmp((a) ? (a) : "", (b) ? (b) : "") +#endif + +#ifndef SPACESHIP_DEFAULTSTR +#define SPACESHIP_DEFAULTSTR(a, b, s) strcmp((a) ? (a) : (s), (b) ? (b) : (s)) #endif #ifdef __GNUC__ // defined by GCC and Clang -- cgit v1.2.3