Index | Thread | Search

From:
Ryan Freeman <ryan@slipgate.org>
Subject:
UPDATE: net/slurm
To:
ports@openbsd.org
Date:
Mon, 20 Apr 2026 17:31:46 -0700

Download raw body.

Thread
Hi,

Attached is a patch to pull net/slurm up to version 0.4.4 with additional
patches from an open PR: https://github.com/mattthias/slurm/pull/53

0.4.3 to 0.4.4 does change the build system to meson.
Installing the manpage is no-longer a manual step in the port Makefile.
OpenBSD ports patches were pulled in upstream, except the manpage patch.
This one is pulled upstream but after the 0.4.4 release, so the local
patch remains: https://github.com/mattthias/slurm/commit/ef79c98269eb16bc49efcb520588a379c99f4f57

The PR adds several fixes, important enough to bring them in (almost)
entirely.  Changes for code paths limited to other platforms are ignored.

The PR has been open for 2 years, but I did post indicating the fixes worked
good for me, hopefully @mattthias merges the request.

applied from Iksas' pull request:
- fix out-of-bounds accesses of _x_speedarray 4873377
- remove unused constants 7a47a63
- tidy up height constants cc6d46d
- fix an error where ERR_IFACE_DOWN would never be set 0111751
- wrap numerical constants in parantheses to prevent silent errors in the future 8b673e9
- fix calculation of maximum speed 32e054a
- fix a bug where the graph would not automatically re-scale c8c32a9
- make sure graphs are centered when a terminal of width 80 is used c2022b3
- fix more out-of-bounds memory accesses 362f597
- fix graph rescaling in classic mode (-c) 323d2bf

ignored parts of the pull request:
- patch for src/hpux.c
- patch for os.h, dealing with constants when building for HP-UX or Solaris

Is this an OK direction for pulling in these outside patches?  Is using 'pl'
the appropriate marker under PKGNAME?

Tests good on amd64, ran for a few days and noted making terminal window larger
doesn't immediately muck up the output anymore.  There used to be some visible
character garbage when first starting the program as well, that is now gone.

OK?

-ryan


Index: Makefile
===================================================================
RCS file: /cvs/ports/net/slurm/Makefile,v
diff -u -p -r1.17 Makefile
--- Makefile	13 Feb 2026 12:02:17 -0000	1.17
+++ Makefile	21 Apr 2026 00:27:43 -0000
@@ -1,12 +1,9 @@
 COMMENT =	network traffic monitor and statistics
 
-GH_VERSION =	0.4.3
-GH_ACCOUNT =	mattthias
-GH_PROJECT =	slurm
-GH_TAGNAME =	upstream/${GH_VERSION}
-DISTNAME =	${GH_PROJECT}-${GH_VERSION}
+V =		0.4.4
+DIST_TUPLE =	github mattthias slurm upstream/${V} .
+PKGNAME =	slurm-${V}pl0
 CATEGORIES =	net
-REVISION =	0
 
 HOMEPAGE =	http://github.com/mattthias/slurm/wiki/
 
@@ -17,18 +14,15 @@ PERMIT_PACKAGE =	Yes
 
 WANTLIB =	c curses
 
-MODULES =	devel/cmake
-
-MODCMAKE_POLICY_VERSION_OVERRIDE = Yes
+MODULES =	devel/meson
 
 pre-configure:
-	@${SUBST_CMD} ${WRKSRC}/theme.c ${WRKSRC}/slurm.1
+	@${SUBST_CMD} ${WRKSRC}/slurm.1
 
 post-install:
 	${INSTALL_DATA_DIR} ${PREFIX}/share/doc/slurm/
 .for i in COPYRIGHT FAQ THANKS COPYING
 	${INSTALL_DATA} ${WRKSRC}/$i ${PREFIX}/share/doc/slurm/
 .endfor
-	${INSTALL_MAN} ${WRKSRC}/slurm.1 ${PREFIX}/man/man1/
 
 .include <bsd.port.mk>
Index: distinfo
===================================================================
RCS file: /cvs/ports/net/slurm/distinfo,v
diff -u -p -r1.4 distinfo
--- distinfo	23 Sep 2015 09:44:55 -0000	1.4
+++ distinfo	21 Apr 2026 00:27:43 -0000
@@ -1,2 +1,2 @@
-SHA256 (slurm-0.4.3.tar.gz) = uWDA0hWSe+HQLBduGxiTIYVgMCJskfhAKEiGtyfTo6w=
-SIZE (slurm-0.4.3.tar.gz) = 36085
+SHA256 (mattthias-slurm-upstream/0.4.4.tar.gz) = L4RsmqFvhswNODLFzREiudMioYn55qz46WRt7hL5rAI=
+SIZE (mattthias-slurm-upstream/0.4.4.tar.gz) = 76154
Index: patches/patch-error_h
===================================================================
RCS file: patches/patch-error_h
diff -N patches/patch-error_h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-error_h	21 Apr 2026 00:27:43 -0000
@@ -0,0 +1,23 @@
+wrap numerical constants in parantheses to prevent silent errors in the future
+from: https://github.com/mattthias/slurm/pull/53/changes/8b673e9e4910f94dce1433f9ff1a0f7a3a72fc72
+
+Index: error.h
+--- error.h.orig
++++ error.h
+@@ -9,11 +9,11 @@
+  *       (i.e. & 0x01ff to enable syslog logging)
+  */
+ 
+-#define ERR_DEBUG	0x0001
+-#define ERR_NOTICE	0x0003
+-#define ERR_WARNING 0x0004
+-#define ERR_ERROR	0x0005
+-#define ERR_FATAL	0x0006
++#define ERR_DEBUG	(0x0001)
++#define ERR_NOTICE	(0x0003)
++#define ERR_WARNING (0x0004)
++#define ERR_ERROR	(0x0005)
++#define ERR_FATAL	(0x0006)
+ #define ERRBUF BUFSIZ
+ 
+ #endif
Index: patches/patch-slurm_1
===================================================================
RCS file: patches/patch-slurm_1
diff -N patches/patch-slurm_1
--- patches/patch-slurm_1	11 Mar 2022 19:47:31 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,23 +0,0 @@
-avoid makewhatis error; N.B. hand-edited to avoid CVS keyword.
-
---- slurm.1.orig	Fri Feb  6 02:33:54 2004
-+++ slurm.1	Wed Sep 17 10:24:47 2008
-@@ -1,3 +1,2 @@
--.TH slurm 1
- .Dd February 23, 2003
- .Dt slurm 1
-@@ -11,5 +10,6 @@
- .Op Fl csl
- .Op Fl d Ar delay
--.B  -i interface
-+.Op Fl i Ar interface
-+.Op Fl t Ar theme
- .Sh DESCRIPTION
- slurm is a generic network load monitor which shows device statistics
-@@ -34,4 +34,6 @@
- .It Fl i Ar interface
- select interface to monitor (required)
-+.It Fl t Ar theme
-+select theme, searches ~/.slurm and ${PREFIX}/share/slurm
- .El
- .Sh KEYS
Index: patches/patch-slurm_c
===================================================================
RCS file: patches/patch-slurm_c
diff -N patches/patch-slurm_c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-slurm_c	21 Apr 2026 00:27:43 -0000
@@ -0,0 +1,451 @@
+fix multiple bugs
+fix calculation of maximum speed
+fix out-of-bounds accesses of _x_speedarray
+fix a bug where the graph would not automatically re-scale
+fix more out-of-bounds memory accesses
+fix graph rescaling in classic mode (-c)
+from: https://github.com/mattthias/slurm/pull/53
+
+Index: slurm.c
+--- slurm.c.orig
++++ slurm.c
+@@ -345,27 +345,50 @@ int update_stat_large(void)
+             tx_overallmax = txspeed;
+     }
+ 
+-    /*
+-     * update the Graph Top Speed field
+-     * as it might be shorter than before just be sure to not leave
+-     * trailing garbage by printing spaces
++
++    /* prepare the graph array
++     *
++     * shift the graph to the left and then add the last entry
++     * in addition move the traffic stats left
+      */
+ 
+-    if (rx_scalechanged) {
+-        snprintf(draw, DRAWLEN - 1, "%.2f KB/s",
+-                 (float) rx_maxspeed / 1024);
+-        strncat(draw, "               ", DRAWLEN - strlen(draw));
+-        mvprintw(22, 24, "%s", draw);
++    /* move */
++    for (x = GRAPH_WIDTH - 1; x >= 1; x--) {
++        rx_speedarray[x] = rx_speedarray[x - 1];
++        tx_speedarray[x] = tx_speedarray[x - 1];
++        for (y = 0; y < GRAPHLARGE_HEIGHT; y++) {
++            rx_graph[x][y] = rx_graph[x - 1][y];
++            tx_graph[x][y] = tx_graph[x - 1][y];
++        }
+     }
+-    if (tx_scalechanged) {
+-        snprintf(draw, DRAWLEN - 1, "%.2f KB/s",
+-                 (float) tx_maxspeed / 1024);
+-        strncat(draw, "               ", DRAWLEN - strlen(draw));
+-        mvprintw(22, 65, "%s", draw);
++
++    /* add the last column */
++    if (rx_maxspeed > 0)
++        i = (int) ((rxspeed / rx_maxspeed) * GRAPHLARGE_HEIGHT);
++    for (y = 0; y <= GRAPHLARGE_HEIGHT; y++) {
++        if (i > y)
++            rx_graph[0][y] = 1;
++        else
++            rx_graph[0][y] = 0;
+     }
++    if (0 != (int) rxspeed)
++        rx_graph[0][1] = 1;
++    rx_speedarray[0] = rxspeed;
+ 
++    if (tx_maxspeed > 0)
++        i = (int) ((txspeed / tx_maxspeed) * GRAPHLARGE_HEIGHT);
++    for (y = 0; y <= GRAPHLARGE_HEIGHT; y++) {
++        if (i > y)
++            tx_graph[0][y] = 1;
++        else
++            tx_graph[0][y] = 0;
++    }
++    if (0 != (int) txspeed)
++        tx_graph[0][1] = 1;
++    tx_speedarray[0] = txspeed;
+ 
+-    /* increment position of max speed as we move the graph */
++
++    /* increment position of max speed as we moved the graph */
+     rx_maxspeedpos++;
+     tx_maxspeedpos++;
+ 
+@@ -375,74 +398,55 @@ int update_stat_large(void)
+ 
+     tmp_maxspeed = 0;
+     tmp_maxspeedpos = 1;
+-    if (rx_maxspeedpos >= GRAPH_WIDTH) {
++    if (rx_maxspeedpos >= (GRAPH_WIDTH-1)) {
+         /* max speed calculation has to be redone */
+         for (i = 0; i < GRAPH_WIDTH; i++) {
+             if (rx_speedarray[i] > tmp_maxspeed) {
+-                tmp_maxspeed = rx_speedarray[1];
++                tmp_maxspeed = rx_speedarray[i];
+                 tmp_maxspeedpos = i;
+             }
+         }
+         /* set new values */
+         rx_maxspeed = tmp_maxspeed;
+         rx_maxspeedpos = tmp_maxspeedpos;
++        rx_scalechanged++;
+     }
+ 
+     tmp_maxspeed = 0;
+     tmp_maxspeedpos = 1;
+-    if (tx_maxspeedpos >= GRAPH_WIDTH) {
++    if (tx_maxspeedpos >= (GRAPH_WIDTH-1)) {
+         /* max speed calculation has to be redone */
+         for (i = 0; i < GRAPH_WIDTH; i++) {
+             if (tx_speedarray[i] > tmp_maxspeed) {
+-                tmp_maxspeed = tx_speedarray[1];
++                tmp_maxspeed = tx_speedarray[i];
+                 tmp_maxspeedpos = i;
+             }
+         }
+         /* set new values */
+         tx_maxspeed = tmp_maxspeed;
+         tx_maxspeedpos = tmp_maxspeedpos;
++        tx_scalechanged++;
+     }
+ 
+-    /* prepare the graph array
+-     *
+-     * shift the graph to the left and then add the last entry
+-     * in addition move the traffic stats left
++    /*
++     * update the Graph Top Speed field
++     * as it might be shorter than before just be sure to not leave
++     * trailing garbage by printing spaces
+      */
+ 
+-    /* move */
+-    for (x = GRAPH_WIDTH - 1; x >= 0; x--) {
+-        rx_speedarray[x] = rx_speedarray[x - 1];
+-        tx_speedarray[x] = tx_speedarray[x - 1];
+-        for (y = 0; y < GRAPHLARGE_HEIGHT; y++) {
+-            rx_graph[x][y] = rx_graph[x - 1][y];
+-            tx_graph[x][y] = tx_graph[x - 1][y];
+-        }
++    if (rx_scalechanged) {
++        snprintf(draw, DRAWLEN - 1, "%.2f KB/s",
++                 (float) rx_maxspeed / 1024);
++        strncat(draw, "               ", DRAWLEN - strlen(draw));
++        mvprintw(22, 24, "%s", draw);
+     }
+-
+-    /* add the last column */
+-    if (rx_maxspeed > 0)
+-        i = (int) ((rxspeed / rx_maxspeed) * GRAPHLARGE_HEIGHT);
+-    for (y = 0; y <= GRAPHLARGE_HEIGHT; y++) {
+-        if (i > y)
+-            rx_graph[0][y] = 1;
+-        else
+-            rx_graph[0][y] = 0;
++    if (tx_scalechanged) {
++        snprintf(draw, DRAWLEN - 1, "%.2f KB/s",
++                 (float) tx_maxspeed / 1024);
++        strncat(draw, "               ", DRAWLEN - strlen(draw));
++        mvprintw(22, 65, "%s", draw);
+     }
+-    if (0 != (int) rxspeed)
+-        rx_graph[0][1] = 1;
+-    rx_speedarray[0] = rxspeed;
+ 
+-    if (tx_maxspeed > 0)
+-        i = (int) ((txspeed / tx_maxspeed) * GRAPHLARGE_HEIGHT);
+-    for (y = 0; y <= GRAPHLARGE_HEIGHT; y++) {
+-        if (i > y)
+-            tx_graph[0][y] = 1;
+-        else
+-            tx_graph[0][y] = 0;
+-    }
+-    if (0 != (int) txspeed)
+-        tx_graph[0][1] = 1;
+-    tx_speedarray[0] = txspeed;
+ 
+     /*
+      * rescale graph
+@@ -491,7 +495,7 @@ int update_stat_large(void)
+      */
+ 
+     for (y = GRAPHLARGE_HEIGHT - 1; y > 0; y--) {
+-        for (x = 0; x <= GRAPH_WIDTH; x++) {
++        for (x = 0; x < GRAPH_WIDTH; x++) {
+             /* RX graph */
+             if (rx_graph[x][y] == 1) {
+                 attrset(COLOR_PAIR(PAIR_RX) |
+@@ -633,25 +637,48 @@ int update_stat_split(void)
+         }
+     }
+ 
+-    /*
+-     * update the Graph Top Speed field
+-     * as it might be shorter than before just be sure to not leave
+-     * trailing garbage by printing spaces
++    /* prepare the graph array
++     *
++     * shift the graph to the left and then add the last entry
++     * in addition move the traffic stats left
+      */
+ 
+-    if (rx_scalechanged) {
+-        snprintf(draw, DRAWLEN - 1, "%.2f KB/s", rx_maxspeed / 1024);
+-        strncat(draw, "               ", DRAWLEN - strlen(draw));
+-        mvprintw(18, 24, "%s", draw);
++    /* move */
++    for (x = GRAPHSPLIT_WIDTH - 1; x >= 1; x--) {
++        rx_speedarray[x] = rx_speedarray[x - 1];
++        tx_speedarray[x] = tx_speedarray[x - 1];
++        for (y = 0; y < GRAPHSPLIT_HEIGHT; y++) {
++            rx_graph[x][y] = rx_graph[x - 1][y];
++            tx_graph[x][y] = tx_graph[x - 1][y];
++        }
+     }
+-    if (tx_scalechanged) {
+-        snprintf(draw, DRAWLEN - 1, "%.2f KB/s", tx_maxspeed / 1024);
+-        strncat(draw, "               ", DRAWLEN - strlen(draw));
+-        mvprintw(18, 65, "%s", draw);
++
++    /* add the last column */
++    if (rx_maxspeed > 0)
++        i = (int) ((rxspeed / rx_maxspeed) * GRAPHSPLIT_HEIGHT);
++    for (y = 0; y <= GRAPHSPLIT_HEIGHT; y++) {
++        if (i > y)
++            rx_graph[0][y] = 1;
++        else
++            rx_graph[0][y] = 0;
+     }
++    if (0 != (int) rxspeed)
++        rx_graph[0][1] = 1;
++    rx_speedarray[0] = rxspeed;
+ 
++    if (tx_maxspeed > 0)
++        i = (int) ((txspeed / tx_maxspeed) * GRAPHSPLIT_HEIGHT);
++    for (y = 0; y <= GRAPHSPLIT_HEIGHT; y++) {
++        if (i > y)
++            tx_graph[0][y] = 1;
++        else
++            tx_graph[0][y] = 0;
++    }
++    if (0 != (int) txspeed)
++        tx_graph[0][1] = 1;
++    tx_speedarray[0] = txspeed;
+ 
+-    /* increment position of max speed as we move the graph */
++    /* increment position of max speed as we moved the graph */
+     rx_maxspeedpos++;
+     tx_maxspeedpos++;
+ 
+@@ -665,13 +692,14 @@ int update_stat_split(void)
+         /* max speed calculation has to be redone */
+         for (i = 0; i < GRAPHSPLIT_WIDTH; i++) {
+             if (rx_speedarray[i] > tmp_maxspeed) {
+-                tmp_maxspeed = rx_speedarray[1];
++                tmp_maxspeed = rx_speedarray[i];
+                 tmp_maxspeedpos = i;
+             }
+         }
+         /* set new values */
+         rx_maxspeed = tmp_maxspeed;
+         rx_maxspeedpos = tmp_maxspeedpos;
++        rx_scalechanged++;
+     }
+ 
+     tmp_maxspeed = 0;
+@@ -680,55 +708,33 @@ int update_stat_split(void)
+         /* max speed calculation has to be redone */
+         for (i = 0; i < GRAPHSPLIT_WIDTH; i++) {
+             if (tx_speedarray[i] > tmp_maxspeed) {
+-                tmp_maxspeed = tx_speedarray[1];
++                tmp_maxspeed = tx_speedarray[i];
+                 tmp_maxspeedpos = i;
+             }
+         }
+         /* set new values */
+         tx_maxspeed = tmp_maxspeed;
+         tx_maxspeedpos = tmp_maxspeedpos;
++        tx_scalechanged++;
+     }
+ 
+-    /* prepare the graph array
+-     *
+-     * shift the graph to the left and then add the last entry
+-     * in addition move the traffic stats left
++    /*
++     * update the Graph Top Speed field
++     * as it might be shorter than before just be sure to not leave
++     * trailing garbage by printing spaces
+      */
+ 
+-    /* move */
+-    for (x = GRAPHSPLIT_WIDTH - 1; x >= 0; x--) {
+-        rx_speedarray[x] = rx_speedarray[x - 1];
+-        tx_speedarray[x] = tx_speedarray[x - 1];
+-        for (y = 0; y < GRAPHSPLIT_HEIGHT; y++) {
+-            rx_graph[x][y] = rx_graph[x - 1][y];
+-            tx_graph[x][y] = tx_graph[x - 1][y];
+-        }
++    if (rx_scalechanged) {
++        snprintf(draw, DRAWLEN - 1, "%.2f KB/s", rx_maxspeed / 1024);
++        strncat(draw, "               ", DRAWLEN - strlen(draw));
++        mvprintw(18, 24, "%s", draw);
+     }
+-
+-    /* add the last column */
+-    if (rx_maxspeed > 0)
+-        i = (int) ((rxspeed / rx_maxspeed) * GRAPHSPLIT_HEIGHT);
+-    for (y = 0; y <= GRAPHSPLIT_HEIGHT; y++) {
+-        if (i > y)
+-            rx_graph[0][y] = 1;
+-        else
+-            rx_graph[0][y] = 0;
++    if (tx_scalechanged) {
++        snprintf(draw, DRAWLEN - 1, "%.2f KB/s", tx_maxspeed / 1024);
++        strncat(draw, "               ", DRAWLEN - strlen(draw));
++        mvprintw(18, 65, "%s", draw);
+     }
+-    if (0 != (int) rxspeed)
+-        rx_graph[0][1] = 1;
+-    rx_speedarray[0] = rxspeed;
+ 
+-    if (tx_maxspeed > 0)
+-        i = (int) ((txspeed / tx_maxspeed) * GRAPHSPLIT_HEIGHT);
+-    for (y = 0; y <= GRAPHSPLIT_HEIGHT; y++) {
+-        if (i > y)
+-            tx_graph[0][y] = 1;
+-        else
+-            tx_graph[0][y] = 0;
+-    }
+-    if (0 != (int) txspeed)
+-        tx_graph[0][1] = 1;
+-    tx_speedarray[0] = txspeed;
+ 
+     /*
+      * rescale graph
+@@ -777,7 +783,7 @@ int update_stat_split(void)
+      */
+ 
+     for (y = GRAPHSPLIT_HEIGHT - 1; y > 0; y--) {
+-        for (x = 0; x <= GRAPHSPLIT_WIDTH; x++) {
++        for (x = 0; x < GRAPHSPLIT_WIDTH; x++) {
+             /* RX graph */
+             if (rx_graph[x][y] == 1) {
+                 attrset(COLOR_PAIR(PAIR_RX) |
+@@ -897,40 +903,7 @@ int update_stat_combined(void)
+         }
+     }
+ 
+-    /*
+-     * update the Graph Top Speed field
+-     * as it might be shorter than before just be sure to not leave
+-     * trailing garbage by printing spaces
+-     */
+ 
+-    if (rx_scalechanged) {
+-        snprintf(draw, DRAWLEN - 1, "%.2f KB/s", comb_maxspeed / 1024);
+-        strncat(draw, "               ", DRAWLEN - strlen(draw));
+-        mvprintw(19, 24, "%s", draw);
+-    }
+-
+-    /* increment position of max speed as we move the graph */
+-    rx_maxspeedpos++;
+-
+-    /* check if max speed has to be lowered for the graph as the max speed
+-     * was reached too long ago
+-     */
+-
+-    tmp_maxspeed = 0;
+-    tmp_maxspeedpos = 1;
+-    if (rx_maxspeedpos >= GRAPHCOMBINED_WIDTH) {
+-        /* max speed calculation has to be redone */
+-        for (i = 0; i < GRAPHCOMBINED_WIDTH; i++) {
+-            if (rx_speedarray[i] > tmp_maxspeed) {
+-                tmp_maxspeed = rx_speedarray[1];
+-                tmp_maxspeedpos = i;
+-            }
+-        }
+-        /* set new values */
+-        comb_maxspeed = tmp_maxspeed;
+-        rx_maxspeedpos = tmp_maxspeedpos;
+-    }
+-
+     /* prepare the graph array
+      *
+      * shift the graph to the left and then add the last entry
+@@ -942,7 +915,7 @@ int update_stat_combined(void)
+      */
+ 
+     /* move */
+-    for (x = GRAPHCOMBINED_WIDTH - 1; x >= 0; x--) {
++    for (x = GRAPHCOMBINED_WIDTH - 1; x >= 1; x--) {
+         rx_speedarray[x] = rx_speedarray[x - 1];
+         tx_speedarray[x] = tx_speedarray[x - 1];
+         for (y = 0; y < GRAPHCOMBINED_HEIGHT; y++) {
+@@ -966,7 +939,44 @@ int update_stat_combined(void)
+     rx_speedarray[0] = rxspeed;
+     tx_speedarray[0] = txspeed;
+ 
++
++    /* increment position of max speed as we moved the graph */
++    rx_maxspeedpos++;
++
++    /* check if max speed has to be lowered for the graph as the max speed
++     * was reached too long ago
++     */
++
++    tmp_maxspeed = 0;
++    tmp_maxspeedpos = 1;
++    if (rx_maxspeedpos >= (GRAPHCOMBINED_WIDTH-1)) {
++        /* max speed calculation has to be redone */
++        for (i = 0; i < GRAPHCOMBINED_WIDTH; i++) {
++            if (rx_speedarray[i] > tmp_maxspeed) {
++                tmp_maxspeed = rx_speedarray[i];
++                tmp_maxspeedpos = i;
++            }
++        }
++        /* set new values */
++        comb_maxspeed = tmp_maxspeed;
++        rx_maxspeedpos = tmp_maxspeedpos;
++        rx_scalechanged++;
++    }
++
+     /*
++     * update the Graph Top Speed field
++     * as it might be shorter than before just be sure to not leave
++     * trailing garbage by printing spaces
++     */
++
++    if (rx_scalechanged) {
++        snprintf(draw, DRAWLEN - 1, "%.2f KB/s", comb_maxspeed / 1024);
++        strncat(draw, "               ", DRAWLEN - strlen(draw));
++        mvprintw(19, 24, "%s", draw);
++    }
++
++
++    /*
+      * rescale graph
+      *
+      * in case the maxspeed for the shown graph changed we need to
+@@ -978,7 +988,7 @@ int update_stat_combined(void)
+         /* for each line rewrite the graph */
+         for (x = GRAPHCOMBINED_WIDTH - 1; x >= 0; x--) {
+             i = (int) ((rx_speedarray[x] / comb_maxspeed) *
+-                       GRAPHSPLIT_HEIGHT);
++                       GRAPHCOMBINED_HEIGHT);
+             for (y = 0; y <= GRAPHCOMBINED_HEIGHT; y++) {
+                 if (i > y)
+                     rx_graph[x][y] = 1;
+@@ -997,7 +1007,7 @@ int update_stat_combined(void)
+      */
+ 
+     for (y = GRAPHCOMBINED_HEIGHT - 1; y > 0; y--) {
+-        for (x = 0; x <= GRAPHCOMBINED_WIDTH; x++) {
++        for (x = 0; x < GRAPHCOMBINED_WIDTH; x++) {
+             /* RX graph */
+             if (rx_graph[x][y] == 1) {
+                 attrset(COLOR_PAIR(PAIR_RX) |
Index: patches/patch-slurm_h
===================================================================
RCS file: patches/patch-slurm_h
diff -N patches/patch-slurm_h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-slurm_h	21 Apr 2026 00:27:43 -0000
@@ -0,0 +1,121 @@
+wrap numerical constants in parantheses to prevent silent errors in the future
+remove unused constants
+tidy up height constants
+make sure graphs are centered when a terminal of width 80 is used
+from: https://github.com/mattthias/slurm/pull/53
+
+Index: slurm.h
+--- slurm.h.orig
++++ slurm.h
+@@ -22,14 +22,14 @@
+  *
+  ***************************************************************************/
+ 
+-#define LED_RX    1
+-#define LED_TX    2
++#define LED_RX    (1)
++#define LED_TX    (2)
+ 
+ #ifndef TRUE
+-#define TRUE 1
++#define TRUE (1)
+ #endif
+ #ifndef FALSE
+-#define FALSE 0
++#define FALSE (0)
+ #endif
+ 
+ #define SYMBOL_TRAFFIC		"x"
+@@ -39,9 +39,9 @@
+ #define PATH_NET_DEV "/proc/net/dev"
+ #endif
+ 
+-#define MODE_COMBINED 1
+-#define MODE_SPLIT 2
+-#define MODE_LARGE 3
++#define MODE_COMBINED (1)
++#define MODE_SPLIT (2)
++#define MODE_LARGE (3)
+ 
+ /* slap HPUX with a large trout
+  * HPUX 10.xx cannot handle 2^32 int constants, so we have to "tweak" it
+@@ -54,17 +54,17 @@
+ #endif
+ 
+ #undef MAXHOSTNAMELEN
+-#define MAXHOSTNAMELEN 64
++#define MAXHOSTNAMELEN (64)
+ 
+-#define DRAWLEN 16
++#define DRAWLEN (16)
+ 
+ /* 10th of a second */
+-#define REFRESH_DEFAULT 1
+-#define REFRESH_MIN 1
+-#define REFRESH_MAX 300
++#define REFRESH_DEFAULT (1)
++#define REFRESH_MIN (1)
++#define REFRESH_MAX (300)
+ 
+ #ifndef BUFSIZ
+-#define BUFSIZ 1024
++#define BUFSIZ (1024)
+ #warning "setting buf size to 1024"
+ #endif
+ 
+@@ -141,16 +141,16 @@ void zero_stats (void);
+ void slurm_shutdown (int);
+ 
+ /* Variables Declarations */
+-#define TYPE_MEGA 0
+-#define TYPE_GIGA 1
++#define TYPE_MEGA (0)
++#define TYPE_GIGA (1)
+ int data_type = TYPE_MEGA;
+ long refreshdelay = REFRESH_DEFAULT;
+ 
+ /* internal database status */
+ /* possible modes are: */
+-#define DB_STATUS_STARTUP 1
+-#define DB_STATUS_RUNNING 2
+-#define DB_STATUS_REINIT  3
++#define DB_STATUS_STARTUP (1)
++#define DB_STATUS_RUNNING (2)
++#define DB_STATUS_REINIT  (3)
+ int db_status = DB_STATUS_STARTUP;
+ 
+ #ifdef __linux
+@@ -158,23 +158,21 @@ static FILE *proc_net_dev;
+ #endif
+ /* End of Variables Declarations */
+ 
+-/* max speed in graph */
+-#define GRAPHSINGLE_WIDTH 77
+-#define GRAPHSINGLE_HEIGHT 10
++/* new max width and height */
++/* Note that these first two constants are used to define array sizes, 
++ * so they must be larger/equal to all other heights/widths. */
++#define GRAPH_HEIGHT (12)
++#define GRAPH_WIDTH (78)
+ 
+ /* define graph height for split screen graphs */
+-#define GRAPHSPLIT_HEIGHT 6
+-#define GRAPHSPLIT_WIDTH 77
++#define GRAPHSPLIT_HEIGHT (6)
++#define GRAPHSPLIT_WIDTH GRAPH_WIDTH
+ 
+-#define GRAPHCOMBINED_WIDTH 77
+-#define GRAPHCOMBINED_HEIGHT 12
++#define GRAPHCOMBINED_HEIGHT GRAPH_HEIGHT
++#define GRAPHCOMBINED_WIDTH GRAPH_WIDTH
+ 
+-/* new max height */
+-#define GRAPH_HEIGHT 12
+-#define GRAPH_WIDTH 77
+-
+ /* large split mode graph height */
+-#define GRAPHLARGE_HEIGHT 11
++#define GRAPHLARGE_HEIGHT (11)
+ 
+ /* rx is higher than need as we use it for the combined view */
+ int rx_graph[GRAPHSPLIT_WIDTH][GRAPHCOMBINED_HEIGHT];
Index: patches/patch-src_if_media_c
===================================================================
RCS file: patches/patch-src_if_media_c
diff -N patches/patch-src_if_media_c
--- patches/patch-src_if_media_c	11 Mar 2022 19:47:31 -0000	1.4
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,47 +0,0 @@
---- src/if_media.c.orig	Mon Sep 27 07:08:59 2004
-+++ src/if_media.c	Fri Sep 11 09:22:41 2015
-@@ -51,7 +51,7 @@ int get_if_speed (char *ifstring)
-     int speed=ERR_IFACE_NO_SPEED;
-     int s; /* socket */
-     struct ifmediareq ifmr;
--    int *media_list;
-+    uint64_t *media_list;
-     int type, physical;
- 
-     if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
-@@ -75,7 +75,7 @@ int get_if_speed (char *ifstring)
-         return ERR_IFACE_NO_SPEED;
-     }
- 
--    media_list = (int *)malloc(ifmr.ifm_count * sizeof(int));
-+    media_list = (uint64_t *)malloc(ifmr.ifm_count * sizeof(uint64_t));
-     if (media_list == NULL)
-         fprintf(stderr, "malloc() error in if_media.c\n");
-     ifmr.ifm_ulist = media_list;
-@@ -95,8 +95,16 @@ int get_if_speed (char *ifstring)
-      *
-      */
- 
-+#ifdef IFM_TYPE
-+    type = IFM_TYPE(ifmr.ifm_active);
-+#else
-     type = ifmr.ifm_active & 0xf0;
-+#endif
-+#ifdef IFM_TYPE
-+    physical = IFM_SUBTYPE(ifmr.ifm_active);
-+#else
-     physical = ifmr.ifm_active & 0x0f;
-+#endif
- 
- #ifdef MEDIADEBUG
-     printf("      all: %6d\n", ifmr.ifm_current);
-@@ -202,7 +210,8 @@ int get_if_speed (char *ifstring)
- #endif
- #if WIRELESS && \
- 	(defined(__FreeBSD__) && (__FreeBSD_version >= 500111)) || \
--	(defined(__NetBSD__) && (__NetBSD_Version_ > 106020000))
-+	(defined(__NetBSD__) && (__NetBSD_Version_ > 106020000)) || \
-+	defined(__OpenBSD__)
-                 case IFM_IEEE80211_OFDM6:
-                     speed = 6 * 1000;
-                     break;
Index: patches/patch-src_if_media_h
===================================================================
RCS file: patches/patch-src_if_media_h
diff -N patches/patch-src_if_media_h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_if_media_h	21 Apr 2026 00:27:43 -0000
@@ -0,0 +1,14 @@
+wrap numerical constants in parantheses to prevent silent errors in the future
+from: https://github.com/mattthias/slurm/pull/53
+
+Index: src/if_media.h
+--- src/if_media.h.orig
++++ src/if_media.h
+@@ -1,5 +1,5 @@
+ /* interface speed detection errors */
+-#define ERR_IFACE_NO_SPEED -1
+-#define ERR_IFACE_DOWN -2
++#define ERR_IFACE_NO_SPEED (-1)
++#define ERR_IFACE_DOWN (-2)
+ 
+ int get_if_speed(char *);
Index: patches/patch-src_openbsd_c
===================================================================
RCS file: patches/patch-src_openbsd_c
diff -N patches/patch-src_openbsd_c
--- patches/patch-src_openbsd_c	11 Mar 2022 19:47:31 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,11 +0,0 @@
---- src/openbsd.c.orig	Sun Feb 23 11:26:02 2003
-+++ src/openbsd.c	Mon Feb 23 05:19:51 2015
-@@ -128,7 +128,7 @@ int get_stat(void)
-             /* search for the right network interface */
-             if (sdl->sdl_family != AF_LINK)
-                 continue;
--            if (strcmp(sdl->sdl_data, ifdata.if_name) != 0)
-+            if (strncmp(sdl->sdl_data, ifdata.if_name, sdl->sdl_nlen) != 0)
-                 continue;
-             strncpy(s, sdl->sdl_data, sdl->sdl_nlen);
-             s[sdl->sdl_nlen] = '\0';
Index: patches/patch-theme_c
===================================================================
RCS file: patches/patch-theme_c
diff -N patches/patch-theme_c
--- patches/patch-theme_c	11 Mar 2022 19:47:31 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,19 +0,0 @@
---- theme.c.orig	Wed Sep 23 09:44:38 2015
-+++ theme.c	Wed Sep 23 09:45:42 2015
-@@ -58,14 +58,14 @@ int theme_readfile(theme *t, char *name)
- 	/* search for the theme:
- 	 *  - in the local directory
- 	 *  - in ~/.slurm
--	 *  - in /usr/local/share/slurm
-+	 *  - in ${PREFIX}/share/slurm
- 	 *    (make this /usr/share/slurm for Debian systems by specifing
- 	 *     -D__Debian__)
- 	 */
- 	search_paths[0] = ".";                               /* local directory */
- 	search_paths[1] = strcat(getenv("HOME"), "/.slurm"); /* $HOME/.slurm/ */
- 	search_paths[2] = "/usr/share/slurm";                /* Debian style */
--	search_paths[3] = "/usr/local/share/slurm";          /* default install path */
-+	search_paths[3] = "${PREFIX}/share/slurm";          /* default install path */
- 	search_paths[4] = "/usr/pkg/share/slurm";            /* NetBSD style */
- 
- 	for (iter=0; iter <= 4; iter++) {
Index: patches/patch-theme_h
===================================================================
RCS file: patches/patch-theme_h
diff -N patches/patch-theme_h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-theme_h	21 Apr 2026 00:27:43 -0000
@@ -0,0 +1,81 @@
+wrap numerical constants in parantheses to prevent silent errors in the future
+from: https://github.com/mattthias/slurm/pull/53
+
+Index: theme.h
+--- theme.h.orig
++++ theme.h
+@@ -31,45 +31,45 @@ typedef struct {
+ theme t;
+ 
+ /* possible entities */
+-#define E_BACKGROUND	0x0101
+-#define E_RX			0x0102
+-#define E_TX			0x0104
+-#define E_TEXT			0x0108
+-#define E_TEXTVAR		0x0110
+-#define E_TITLE			0x0120
+-#define E_RXATTR		0x0201
+-#define E_TXATTR		0x0202
+-#define E_TEXTATTR		0x0204
+-#define E_TEXTVARATTR	0x0208
+-#define E_TITLEATTR		0x0210
++#define E_BACKGROUND	(0x0101)
++#define E_RX			(0x0102)
++#define E_TX			(0x0104)
++#define E_TEXT			(0x0108)
++#define E_TEXTVAR		(0x0110)
++#define E_TITLE			(0x0120)
++#define E_RXATTR		(0x0201)
++#define E_TXATTR		(0x0202)
++#define E_TEXTATTR		(0x0204)
++#define E_TEXTVARATTR	(0x0208)
++#define E_TITLEATTR		(0x0210)
+ 
+ #define E_ALL	(E_BACKGROUND | E_RX | E_TX | E_TEXT | E_TEXTVAR | \
+ 				 E_RXATTR | E_TXATTR | E_TEXTATTR | E_TEXTVARATTR | \
+ 				 E_TITLE | E_TITLEATTR)
+-#define E_NULL	0
++#define E_NULL	(0)
+ 
+ /* color definitions */
+ #ifndef COLOR_BLACK
+-#define COLOR_BLACK		0
+-#define COLOR_RED		1
+-#define COLOR_GREEN		2
+-#define COLOR_YELLOW	3
+-#define COLOR_BLUE		4
+-#define COLOR_MAGENTA	5
+-#define COLOR_CYAN		6
+-#define COLOR_WHITE		7
++#define COLOR_BLACK		(0)
++#define COLOR_RED		(1)
++#define COLOR_GREEN		(2)
++#define COLOR_YELLOW	(3)
++#define COLOR_BLUE		(4)
++#define COLOR_MAGENTA	(5)
++#define COLOR_CYAN		(6)
++#define COLOR_WHITE		(7)
+ #endif
+-#define COLOR_TRANSPARENT -1
++#define COLOR_TRANSPARENT (-1)
+ 
+-#define COL_NORMAL	0
+-#define COL_BOLD	1
+-#define COL_DIM		2
++#define COL_NORMAL	(0)
++#define COL_BOLD	(1)
++#define COL_DIM		(2)
+ 
+ /* internal color pairs */
+-#define PAIR_TEXT 1
+-#define PAIR_RX 2
+-#define PAIR_TX 3
+-#define PAIR_VAR 4
+-#define PAIR_TITLE 5
++#define PAIR_TEXT (1)
++#define PAIR_RX (2)
++#define PAIR_TX (3)
++#define PAIR_VAR (4)
++#define PAIR_TITLE (5)
+ 
+ #endif