ssf
Owner: IIIlllIIIllI URL: git@git.0x00nyx.xyz:seb/ssf.git
_POSIX_C_SOURCE now skips OpenBSD so <sys/sysctl.h> exposes u_long and friends
Commit 9064d8e0bbef74da1baf4e5008f606a1caceccf0 by SM <seb.michalk@gmail.com> on 2025-09-23 15:46:05 +0200
diff --git a/Makefile b/Makefile
index 263fd99..002e9da 100644
--- a/Makefile
+++ b/Makefile
@@ -9,7 +9,7 @@ BIN = ssf
all: options ${BIN}
options:
- @echo "sysinfo build options:"
+ @echo "ssf build options:"
@echo "CC = ${CC}"
@echo "CPPFLAGS = ${CPPFLAGS}"
@echo "CFLAGS = ${CFLAGS}"
diff --git a/ssf.c b/ssf.c
index 6b86d4a..d77f7b0 100644
--- a/ssf.c
+++ b/ssf.c
@@ -1,4 +1,6 @@
+#ifndef __OpenBSD__
#define _POSIX_C_SOURCE 200809L
+#endif
#include <pwd.h>
#include <stdio.h>
@@ -36,7 +38,7 @@
#define CLR_YELLOW "\033[1;33m"
#define LEN(x) (sizeof(x) / sizeof(*(x)))
-#define MAX(a,b) ((a) > (b) ? (a) : (b))
+#define MAXIMUM(a,b) ((a) > (b) ? (a) : (b))
#define UNKNOWN(buf) strcpy((buf), "unknown")
#define APPEND(buf, fmt, ...) \
do { \
@@ -247,7 +249,7 @@ memory(struct Info *i)
}
#elif defined(__OpenBSD__)
long pagesize = 0;
- u_int pagecount = 0, freecount = 0;
+ unsigned int pagecount = 0, freecount = 0;
unsigned long long total, freep, used;
size_t len;
@@ -408,7 +410,7 @@ display(struct Info *i, int m, int s, char *k)
}
n = s ? short_total : total;
- max_lines = MAX(ascii_lines, n);
+ max_lines = MAXIMUM(ascii_lines, n);
for (j = 0; j < max_lines; j++) {
len = 0;
pad = ascii_width;