diff '--color=auto' -uNr work.orig/ascii.c work/ascii.c
--- work.orig/ascii.c	2026-04-06 11:49:22.773880650 +0200
+++ work/ascii.c	2026-04-06 12:31:57.709799694 +0200
@@ -61,6 +61,7 @@
 #include <signal.h>
 #include <stdint.h>
 #include <time.h>
+#include <unistd.h>
 
 typedef int DWORD;
 #define closesocket		close
diff '--color=auto' -uNr work.orig/fileio.c work/fileio.c
--- work.orig/fileio.c	2026-04-06 11:49:22.773880650 +0200
+++ work/fileio.c	2026-04-06 12:31:57.710099792 +0200
@@ -61,6 +61,8 @@
 #include <fcntl.h>
 #include <signal.h>
 #include <stdint.h>
+#include <unistd.h>
+#include <ctype.h>
 
 typedef int DWORD;
 #define closesocket		close
@@ -398,7 +400,11 @@
     {
         int jj;
         rp += 5;
-        sscanf(rp, "%d", &client->ird.ir_length);
+	{
+	     int tmp_len = 0;
+	     sscanf(rp, "%d", &tmp_len);
+	     client->ird.ir_length = (byte)tmp_len;
+	}
 		rp = data+i;
         for (jj = 0;jj < client->ird.ir_length && jj < CODE_LENRAW; jj++)
         {
@@ -1193,7 +1199,7 @@
 	x = strtoul (st,NULL,2);
 	if (x > 32) x = x - 64;
 
-	sprintf (name,"%03d %03d %c%c%",x,y,pnt[20],pnt[21]);
+	sprintf (name,"%03d %03d %c%c%%",x,y,pnt[20],pnt[21]);
 }
 
 int DBFindCommandName (byte *command,char remote[],char name[],byte address,int *remote_num,int *command_num,word *command_num_rel,int start)
diff '--color=auto' -uNr work.orig/firmware.c work/firmware.c
--- work.orig/firmware.c	2026-04-06 11:49:22.773880650 +0200
+++ work/firmware.c	2026-04-06 12:31:57.710415121 +0200
@@ -31,6 +31,7 @@
 #include <signal.h>
 #include <stdint.h>
 #include <sys/time.h>
+#include <unistd.h>
 
 #define MAX_PATH	1024
 
@@ -1265,7 +1266,7 @@
 	int stat_cnt,stat_step,stat_next,stat_pos;
 	int cnt,max,pnt,start,dir,flash_end,pages,pg,len,res = 0;
 
-	sprintf (st,"Flash ETH %s - %x\n",fwname,zipfile);
+	sprintf (st,"Flash ETH %s - %p\n",fwname,(void *)zipfile);
 	log_print (st,LOG_DEBUG);
 
 	if (!memcmp (fwname + 4,IRDevices[bus].lan_version + 1,7)) {
@@ -1864,7 +1865,7 @@
 }
 
 
-GetLANVersions (int bus,char IRVersion[],char LANVersion[],int timeout)
+int GetLANVersions (int bus,char IRVersion[],char LANVersion[],int timeout)
 {
 	int res,i;
 	IRDATA ir;
diff '--color=auto' -uNr work.orig/flashrom.c work/flashrom.c
--- work.orig/flashrom.c	2026-04-06 11:49:22.773880650 +0200
+++ work/flashrom.c	2026-04-06 12:31:57.710684730 +0200
@@ -58,6 +58,10 @@
 #include "lowlevel.h"
 #include "global.h"
 #include "fileio.h"
+#include "serio.h"
+
+int  IRTransLanFlash (DEVICEINFO *dev,IRDATA_LAN_FLASH *ird,int len,uint32_t ip);
+void SwapIntN (int32_t *pnt);
 
 #ifdef WIN32
 #include "winio.h"
@@ -247,8 +251,11 @@
 	} while (stat < 0 && i < 3);
 
 	if (i == 3) {
-		GetError (stat,ERR_TIMEOUT);
-		log_print (stat,LOG_ERROR);
+                {
+                        char err[256];
+                        GetError (stat,err);
+                        log_print (err,LOG_ERROR);
+                }
 		return (-ERR_TIMEOUT);
 	}
 
@@ -289,8 +296,11 @@
 		} while (stat < 0 && i < 3);
 	
 		if (i == 3) {
-			GetError (stat,ERR_TIMEOUT);
-			log_print (stat,LOG_ERROR);
+                        {
+                                char err[256];
+                                GetError (stat,err);
+                                log_print (err,LOG_ERROR);
+                        }
 			return (-ERR_TIMEOUT);
 		}
 
diff '--color=auto' -uNr work.orig/lanio.c work/lanio.c
--- work.orig/lanio.c	2026-04-06 11:49:22.773880650 +0200
+++ work/lanio.c	2026-04-06 12:31:57.710884447 +0200
@@ -60,6 +60,8 @@
 #include <stdint.h>
 #include <sys/time.h>
 #include <sys/timeb.h>
+#include <unistd.h>
+#include <time.h>
 
 typedef int DWORD;
 #define closesocket		close
diff '--color=auto' -uNr work.orig/linuxserio.c work/linuxserio.c
--- work.orig/linuxserio.c	2026-04-06 11:49:22.773880650 +0200
+++ work/linuxserio.c	2026-04-06 12:31:57.711026712 +0200
@@ -37,6 +37,7 @@
 #include <termios.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <sys/file.h>
 #include <sys/ioctl.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
diff '--color=auto' -uNr work.orig/lowlevel.c work/lowlevel.c
--- work.orig/lowlevel.c	2026-04-06 11:49:22.773880650 +0200
+++ work/lowlevel.c	2026-04-06 12:35:42.774136078 +0200
@@ -66,6 +66,7 @@
 #include <stdint.h>
 #include <sys/time.h>
 #include <netdb.h>
+#include <unistd.h>
 
 typedef int DWORD;
 #define closesocket		close
@@ -81,6 +82,7 @@
 #include "global.h"
 #include "flash.h"
 #include "functioncodes.h"
+#include "serio.h"
 
 #ifdef WIN32
 #include "winio.h"
@@ -1410,7 +1412,7 @@
 			memset (sb,0,sizeof (STATUS_BUFFER_N));
 			sb->my_adress = sbc.my_adress;
 
-			for (i=0;i <= 15;i++) CopyStatusBuffer (&sbc.stat[i],&sb->stat[i],(i == sb->my_adress),bus);
+			for (i=0;i <= 15;i++) CopyStatusBuffer (&sbc.stat[i],(STATUS_LINE_N *)&sb->stat[i],(i == sb->my_adress),bus);
 		}
 
 		if (res == sizeof (STATUS_BUFFER)) {
@@ -1418,14 +1420,14 @@
 			memset (sb,0,sizeof (STATUS_BUFFER));
 			sb->my_adress = sbc.my_adress;
 
-			for (i=0;i <= 15;i++) CopyStatusBuffer (&sbc.stat[i],&sb->stat[i],(i == sb->my_adress),bus);
+			for (i=0;i <= 15;i++) CopyStatusBuffer (&sbc.stat[i],(STATUS_LINE_N *)&sb->stat[i],(i == sb->my_adress),bus);
 		}
 		if (res == sizeof (STATUS_BUFFER_1)) {
 			memcpy (&sb1,sb,sizeof (STATUS_BUFFER_1));
 			memset (sb,0,sizeof (STATUS_BUFFER));
 			sb->my_adress = sb1.my_adress;
 
-			for (i=0;i <= 15;i++) CopyStatusBuffer ((STATUS_LINE_N *)&sb1.stat[i],&sb->stat[i],(i == sb->my_adress),bus);
+			for (i=0;i <= 15;i++) CopyStatusBuffer ((STATUS_LINE_N *)&sb1.stat[i],(STATUS_LINE_N *)&sb->stat[i],(i == sb->my_adress),bus);
 		}
 
 		if (res == sizeof (STATUS_BUFFER_2)) {
@@ -1433,7 +1435,7 @@
 			memset (sb,0,sizeof (STATUS_BUFFER));
 			sb->my_adress = sb2.my_adress;
 
-			for (i=0;i <= 15;i++) CopyStatusBuffer ((STATUS_LINE_N *)&sb2.stat[i],&sb->stat[i],(i == sb->my_adress),bus);
+			for (i=0;i <= 15;i++) CopyStatusBuffer ((STATUS_LINE_N *)&sb2.stat[i],(STATUS_LINE_N *)&sb->stat[i],(i == sb->my_adress),bus);
 		}
 
 		if (res == sizeof (STATUS_BUFFER_3)) {
@@ -1441,7 +1443,7 @@
 			memset (sb,0,sizeof (STATUS_BUFFER));
 			sb->my_adress = sb3.my_adress;
 
-			for (i=0;i <= 15;i++) CopyStatusBuffer ((STATUS_LINE_N *)&sb3.stat[i],&sb->stat[i],(i == sb->my_adress),bus);
+			for (i=0;i <= 15;i++) CopyStatusBuffer ((STATUS_LINE_N *)&sb3.stat[i],(STATUS_LINE_N *)&sb->stat[i],(i == sb->my_adress),bus);
 		}
 
 		if (res == sizeof (STATUS_BUFFER_4)) {
@@ -1449,14 +1451,14 @@
 			memset (sb,0,sizeof (STATUS_BUFFER));
 			sb->my_adress = sb4.my_adress;
 
-			for (i=0;i <= 15;i++) CopyStatusBuffer ((STATUS_LINE_N *)&sb4.stat[i],&sb->stat[i],(i == sb->my_adress),bus);
+			for (i=0;i <= 15;i++) CopyStatusBuffer ((STATUS_LINE_N *)&sb4.stat[i],(STATUS_LINE_N *)&sb->stat[i],(i == sb->my_adress),bus);
 		}
 		if (res == sizeof (STATUS_BUFFER_5)) {
 			memcpy (&sb5,sb,sizeof (STATUS_BUFFER_5));
 			memset (sb,0,sizeof (STATUS_BUFFER));
 			sb->my_adress = sb5.my_adress;
 
-			for (i=0;i <= 15;i++) CopyStatusBuffer ((STATUS_LINE_N *)&sb5.stat[i],&sb->stat[i],(i == sb->my_adress),bus);
+			for (i=0;i <= 15;i++) CopyStatusBuffer ((STATUS_LINE_N *)&sb5.stat[i],(STATUS_LINE_N *)&sb->stat[i],(i == sb->my_adress),bus);
 		}
 
 		IRDevices[bus].my_addr = sb->my_adress;
diff '--color=auto' -uNr work.orig/serio.h work/serio.h
--- work.orig/serio.h	2026-04-06 11:49:22.774033548 +0200
+++ work/serio.h	2026-04-06 12:36:13.905311309 +0200
@@ -36,5 +36,7 @@
 
 int		OpenSerialPortEx (char Pname[],HANDLE *port,int wait);
 int		WriteSerialStringEx (DEVICEINFO *dev,byte pnt[],int len);
+int		ReadSerialStringEx (DEVICEINFO *dev,byte pnt[],int len,int timeout);
+int		ReadSerialStringEx_ITo (DEVICEINFO *dev,byte pnt[],int len,int timeout);
 void	SetSerialTimeoutEx (DEVICEINFO *dev,int time);
 void	SetSerialTimeoutEx_ITo (DEVICEINFO *dev,int time);
diff '--color=auto' -uNr work.orig/server.c work/server.c
--- work.orig/server.c	2026-04-06 11:49:22.773880650 +0200
+++ work/server.c	2026-04-06 12:31:57.711758734 +0200
@@ -76,6 +76,7 @@
 #include <netdb.h>
 #include <stdint.h>
 #include <sys/utsname.h>
+#include <unistd.h>
 
 typedef int DWORD;
 
@@ -101,6 +102,7 @@
 #include "flash.h"
 #include "xap.h"
 #include "ccf.h"
+#include "serio.h"
 
 #ifdef LINUX
 SOCKET local_socket;
@@ -151,6 +153,12 @@
 int		ConvertLongcode (byte cmd[],int len,byte target[]);
 void	GetDataPath (char path[]);
 
+/* Linux also uses these, but they were only declared in WIN32 sections / nowhere */
+int build_select_table (fd_set *events);
+int get_selected_fd (fd_set *events,SOCKET *sockfd,int *ionum);
+int AnalyzeUDPString (char *st,int *netcom,char *remote,char *command,char *ccf,int *netmask,int *bus,int *led,int *port,int *macro_wait);
+int FlashDevice (int bus,char filename[],char upg_key[],NETWORKSTATUS *stat,int client);
+void PostWindowsMessage (int rem_num,int com_num,char name[]);
 
 
 #ifdef WIN32
@@ -908,7 +916,7 @@
 
 #if defined LINUX || defined _CONSOLE
 
-main (int argc,char *argv[])
+int main (int argc,char *argv[])
 {
 	int res;
 	char *pnt;
diff '--color=auto' -uNr work.orig/webserver.c work/webserver.c
--- work.orig/webserver.c	2026-04-06 11:49:22.773880650 +0200
+++ work/webserver.c	2026-04-06 12:31:57.712090318 +0200
@@ -57,6 +57,7 @@
 #include <fcntl.h>
 #include <signal.h>
 #include <stdint.h>
+#include <unistd.h>
 
 typedef int DWORD;
 #define closesocket		close
Binärdateien work.orig/x64/ascii.o und work/x64/ascii.o sind verschieden.
Binärdateien work.orig/x64/fileio.o und work/x64/fileio.o sind verschieden.
Binärdateien work.orig/x64/firmware.o und work/x64/firmware.o sind verschieden.
Binärdateien work.orig/x64/flashrom.o und work/x64/flashrom.o sind verschieden.
Binärdateien work.orig/x64/lanio.o und work/x64/lanio.o sind verschieden.
Binärdateien work.orig/x64/linuxserio.o und work/x64/linuxserio.o sind verschieden.
Binärdateien work.orig/x64/server.o und work/x64/server.o sind verschieden.
Binärdateien work.orig/x64/webserver.o und work/x64/webserver.o sind verschieden.
Binärdateien work.orig/x64/xap.o und work/x64/xap.o sind verschieden.
Binärdateien work.orig/x64/xbmc.o und work/x64/xbmc.o sind verschieden.
diff '--color=auto' -uNr work.orig/xap.c work/xap.c
--- work.orig/xap.c	2026-04-06 11:49:22.773880650 +0200
+++ work/xap.c	2026-04-06 12:31:57.712240467 +0200
@@ -73,6 +73,7 @@
 #include <signal.h>
 #include <netdb.h>
 #include <stdint.h>
+#include <unistd.h>
 
 typedef int DWORD;
 
diff '--color=auto' -uNr work.orig/xbmc.c work/xbmc.c
--- work.orig/xbmc.c	2026-04-06 11:49:22.773880650 +0200
+++ work/xbmc.c	2026-04-06 12:31:57.712397396 +0200
@@ -61,6 +61,8 @@
 #include <fcntl.h>
 #include <signal.h>
 #include <stdint.h>
+#include <unistd.h>
+#include <time.h>
 
 typedef int DWORD;
 #define closesocket		close
@@ -274,13 +276,13 @@
 		pclose (fp);
 		i = 0;
 		while (ln[i] && ln[i] != ' ' && ln[i] != '\t') i++;
-		if (!ln[i]) return;
+		if (!ln[i]) return 0;
 	}
 
 
 	while (ln[i] == ' ' || ln[i] == '\t') i++;
 
-	if (!ln[i]) return;
+	if (!ln[i]) return 0;
 
 	xbmc_pid = atoi (ln + i);
 
