--- src/script_functions.c.orig	2022-01-29 11:26:21.000000000 -0800
+++ src/script_functions.c	2022-04-03 23:17:14.783898389 -0700
@@ -19,6 +19,7 @@
  */
 #include <stdlib.h>
 #include <sys/types.h>
+#include <errno.h>
 
 #define WNCK_I_KNOW_THIS_IS_UNSTABLE
 #include <libwnck/libwnck.h>
@@ -374,7 +375,8 @@
 #else
 		int32_t struts[12] = {};
 #endif
-		for (int i = 0; i < top; i++) {
+		int i;
+		for (i = 0; i < top; i++) {
 			struts[i] = lua_tonumber(lua, i + 1);
 		}
 
@@ -489,7 +491,8 @@
 	int n = lua_gettop(lua);  /* number of arguments */
 	lua_getglobal(lua, "tostring");
 
-	for (int i = 1; i <= n; i++) {
+	int i;
+	for (i = 1; i <= n; i++) {
 		lua_pushvalue(lua, -1);  /* function to be called */
 		lua_pushvalue(lua, i);   /* value to print */
 		lua_call(lua, 1, 1);
@@ -1792,7 +1795,8 @@
 	int monitor_no = MONITOR_ALL;
 	enum { CENTRE_NONE, CENTRE_H, CENTRE_V, CENTRE_HV } centre = CENTRE_HV;
 
-	for (int i = 1; i <= top; ++i) {
+	int i;
+	for (i = 1; i <= top; ++i) {
 		int type = lua_type(lua, i);
 		gchar *indata;
 
--- src/xutils.c.orig	2022-01-29 11:26:21.000000000 -0800
+++ src/xutils.c	2022-04-03 23:20:56.640986813 -0700
@@ -24,6 +24,7 @@
 #include <gdk/gdkx.h>
 #include <X11/Xlib.h>
 #include <string.h>
+#include <sys/types.h>
 
 // FIXME: retrieve screen position via wnck
 #include <X11/extensions/Xinerama.h>
@@ -622,7 +623,8 @@
 
 	GdkPoint centre = { window_r.x + window_r.width / 2, window_r.y + window_r.height / 2 };
 
-	for (int i = 0; i < monitor_count; ++i) {
+	int i;
+	for (i = 0; i < monitor_count; ++i) {
 		if (centre.x >= monitor_list[i].x_org &&
 		    centre.x <  monitor_list[i].x_org + monitor_list[i].width &&
 		    centre.y >= monitor_list[i].y_org &&
@@ -636,7 +638,8 @@
 	// just use the first matching
 	// FIXME?: should find whichever shows most of the window (if tied, closest to window centre)
 	if (id < 0) {
-		for (int i = 0; i < monitor_count; ++i) {
+		int i;
+		for (i = 0; i < monitor_count; ++i) {
 			GdkRectangle r = {
 				monitor_list[i].x_org, monitor_list[i].y_org,
 				monitor_list[i].x_org + monitor_list[i].width,
