diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2021-03-21 19:40:56 +0100 |
---|---|---|
committer | cgzones <cgzones@googlemail.com> | 2021-04-14 17:29:56 +0200 |
commit | 9a8221568ada269d20c3e9d291ad5f9d07cac755 (patch) | |
tree | 025f098f3e98e3ae27105feb60dc76d4ff627452 /Macros.h | |
parent | 36880cd61c52f13c6fd284aa23d42d9493d3ab2e (diff) |
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.
Diffstat (limited to 'Macros.h')
-rw-r--r-- | Macros.h | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -4,27 +4,31 @@ #include <assert.h> // 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 |