Index: /trunk/Koakumafile
===================================================================
--- /trunk/Koakumafile	(revision 360)
+++ /trunk/Koakumafile	(revision 361)
@@ -51,4 +51,19 @@
 			RunCommand "doas cp tewidist.zip /raid/f/g/tewi/os2/tewidistos2-[exec make get-version]-nossl.zip"
 			RunCommand "doas cp tewidist.zip /raid/ftp/pub/tewi/os2/tewidistos2-[exec make get-version]-nossl.zip"
+			return
+		} elseif { "$project_name" == "Tewi-NetWare" } {
+			set ::env(WATCOM) "/usr/watcom"
+			set ::env(NOVELLNDK) "/usr/novell/clib"
+			set ::env(PATH) "$::env(PATH):/usr/watcom/binl64"
+			RunCommand "rm -rf netware"
+			RunCommand "make PLATFORM=netware"
+			RunCommand "make PLATFORM=netware install DESTDIR=netware/"
+			cd netware/SYS:
+			RunCommand "zip -rv ../../tewidist.zip Tewi"
+			cd ../..
+			RunCommand "doas mkdir -p /raid/f/g/tewi/netware"
+			RunCommand "doas mkdir -p /raid/ftp/pub/tewi/netware"
+			RunCommand "doas cp tewidist.zip /raid/f/g/tewi/netware/tewidistnw-[exec make get-version]-nossl.zip"
+			RunCommand "doas cp tewidist.zip /raid/ftp/pub/tewi/os2/tewidistnw-[exec make get-version]-nossl.zip"
 			return
 		} elseif { "$project_name" == "Tewi-PSP" } {
Index: /trunk/Platform/netware.mk
===================================================================
--- /trunk/Platform/netware.mk	(revision 360)
+++ /trunk/Platform/netware.mk	(revision 361)
@@ -7,5 +7,5 @@
 AR = wlib
 AR_FLAGS = -q -b -n -fo
-CFLAGS = -b netware_clib_lite -I $(NOVELLNDK)/include -I $(NOVELLNDK)/include/nlm -g -std=c99 -DPREFIX=\"$(PREFIX)\" -I ../Common -I ../VC6Compat -fPIC -D__WATCOM_LFN__ -Duint64_t=uint32_t
+CFLAGS = -b netware_clib_lite -I $(NOVELLNDK)/include -I $(NOVELLNDK)/include/nlm -g -std=c99 -DPREFIX=\"$(PREFIX)\" -I ../Common -I ../VC6Compat -fPIC -D__WATCOM_LFN__ -Duint64_t=uint32_t -DN_PLAT_NLM
 LDFLAGS = -b netware_clib_lite
 LIBS =
Index: /trunk/README
===================================================================
--- /trunk/README	(revision 360)
+++ /trunk/README	(revision 361)
@@ -47,4 +47,5 @@
 UnixWare                 Working on 7.1.1
 OS/2                     Working
+NetWare                  Working on 6.5 SP8
 DOS                      Working, missing module support and multi-threading
 NeXTSTEP                 Working, missing module support
@@ -58,4 +59,3 @@
 I sometimes check they do compile, but does not work:
 
-NetWare                  Cannot run fopen somehow
 PlayStation 2            Does not boot
Index: /trunk/README.tmpl
===================================================================
--- /trunk/README.tmpl	(revision 360)
+++ /trunk/README.tmpl	(revision 361)
@@ -47,4 +47,5 @@
 UnixWare                 Working on 7.1.1
 OS/2                     Working
+NetWare                  Working on 6.5 SP8
 DOS                      Working, missing module support and multi-threading
 NeXTSTEP                 Working, missing module support
@@ -58,4 +59,3 @@
 I sometimes check they do compile, but does not work:
 
-NetWare                  Cannot run fopen somehow
 PlayStation 2            Does not boot
Index: /trunk/Server/http.c
===================================================================
--- /trunk/Server/http.c	(revision 360)
+++ /trunk/Server/http.c	(revision 361)
@@ -29,4 +29,5 @@
 #endif
 #elif defined(__NETWARE__)
+#include <sys/bsdskt.h>
 #include <sys/socket.h>
 #else
Index: /trunk/Server/main.c
===================================================================
--- /trunk/Server/main.c	(revision 360)
+++ /trunk/Server/main.c	(revision 361)
@@ -42,4 +42,7 @@
 #include <windows.h>
 #elif defined(__NETWARE__)
+#include <nwnamspc.h>
+#include <nwthread.h>
+#include <nwconio.h>
 #endif
 
@@ -549,7 +552,11 @@
 #ifdef __NETWARE__
 	struct arg_struct* parg = malloc(sizeof(*parg));
+	SetCurrentNameSpace(NW_NS_LONG);
 	parg->argc = argc;
 	parg->argv = argv;
-	thread_stuff(parg);
+	DestroyScreen(GetCurrentScreen());
+	SetCurrentScreen(CreateScreen("Tewi Console", 0));
+	BeginThread(thread_stuff, NULL, 0, parg);
+	ThreadSwitch();
 	return 0;
 }
Index: /trunk/Server/server.c
===================================================================
--- /trunk/Server/server.c	(revision 360)
+++ /trunk/Server/server.c	(revision 361)
@@ -64,11 +64,13 @@
 typedef int socklen_t;
 #elif defined(__NETWARE__)
+#include <sys/bsdskt.h>
 #include <sys/socket.h>
 
 #define IPPROTO_TCP 0
 #define INADDR_ANY 0
-#define htons(x) x
 #include "strptime.h"
 typedef int socklen_t;
+
+uint16_t htons(uint16_t n) { return ((n >> 8) & 0xff) | ((n << 8) & 0xff00); }
 #elif defined(__DOS__)
 #include <netinet/tcp.h>
@@ -1011,5 +1013,5 @@
 	struct timeval tv;
 #endif
-#if defined(__MINGW32__) || defined(__HAIKU__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
+#if defined(__MINGW32__) || defined(__HAIKU__) || defined(_MSC_VER) || defined(__BORLANDC__) || (defined(__WATCOMC__) && !defined(__NETWARE__))
 	struct thread_entry threads[2048];
 	for(i = 0; i < sizeof(threads) / sizeof(threads[0]); i++) {
@@ -1084,5 +1086,5 @@
 					_beginthread(tw_server_pass, 0, 0, e);
 #elif defined(__NETWARE__)
-					tw_server_pass(e);
+					BeginThread(tw_server_pass, NULL, 0, e);
 #elif defined(__DOS__)
 					tw_server_pass(e);
