Index: trunk/Server/config.c
===================================================================
--- trunk/Server/config.c	(revision 344)
+++ trunk/Server/config.c	(revision 347)
@@ -15,5 +15,5 @@
 #endif
 
-#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || (defined(__WATCOMC__) && !defined(__OS2__) && !defined(__WATCOMC__))
+#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || (defined(__WATCOMC__) && !defined(__OS2__) && !defined(__NETWARE__))
 #ifdef USE_WINSOCK1
 #include <winsock.h>
@@ -32,4 +32,7 @@
 #endif
 
+#ifdef __NETWARE__
+#include <arpa/inet.h>
+#endif
 #include "tw_config.h"
 #include "tw_module.h"
Index: trunk/Server/http.c
===================================================================
--- trunk/Server/http.c	(revision 344)
+++ trunk/Server/http.c	(revision 347)
@@ -30,4 +30,5 @@
 #elif defined(__NETWARE__)
 #include <sys/socket.h>
+#include <sys/select.h>
 #else
 #ifdef USE_POLL
Index: trunk/Server/main.c
===================================================================
--- trunk/Server/main.c	(revision 344)
+++ trunk/Server/main.c	(revision 347)
@@ -38,6 +38,6 @@
 #include <windows.h>
 #elif defined(__NETWARE__)
-#include <nwconio.h>
-#include <nwthread.h>
+#include <nks/thread.h>
+#include <screen.h>
 #endif
 
@@ -549,15 +549,7 @@
 	parg->argc = argc;
 	parg->argv = argv;
-	DestroyScreen(GetCurrentScreen());
-	SetCurrentScreen(CreateScreen("Tewi Console", 0));
-	BeginThread(thread_stuff, NULL, 0, parg);
-	ThreadSwitch();
-	ExitThread(EXIT_THREAD, 0);
+	thread_stuff(parg);
 	return 0;
 }
-
-#ifdef __NETWARE__
-void __WATCOM_Prelude(void){return;}
-#endif
 
 void thread_stuff(void* pargs) {
Index: trunk/Server/module.c
===================================================================
--- trunk/Server/module.c	(revision 344)
+++ trunk/Server/module.c	(revision 347)
@@ -33,6 +33,5 @@
 #include <os2.h>
 #elif defined(__NETWARE__)
-#include <nwadv.h>
-#include <nwthread.h>
+#include <dlfcn.h>
 #else
 #include <windows.h>
@@ -60,6 +59,5 @@
 	lib = (void*)mod;
 #elif defined(__NETWARE__)
-	*hnd = FindNLMHandle(path);
-	lib = (void*)hnd;
+	lib = dlopen(path, RTLD_LAZY);
 #else
 	lib = LoadLibraryA(path);
@@ -87,5 +85,5 @@
 	return ret;
 #elif defined(__NETWARE__)
-	return ImportSymbol(*(unsigned int*)mod, sym);
+	return dlsym(mod, sym);
 #else
 	return GetProcAddress(mod, sym);
Index: trunk/Server/server.c
===================================================================
--- trunk/Server/server.c	(revision 344)
+++ trunk/Server/server.c	(revision 347)
@@ -65,7 +65,7 @@
 #elif defined(__NETWARE__)
 #include <sys/socket.h>
-#include <nwthread.h>
-#define IPPROTO_TCP 0
-#define INADDR_ANY 0
+#include <arpa/inet.h>
+#include <sys/select.h>
+#include <pthread.h>
 #define htons(x) x
 #include "strptime.h"
@@ -107,5 +107,5 @@
 #endif
 
-#if defined(__USLC__) || defined(__NeXT__) || defined(__NETWARE__)
+#if defined(__USLC__) || defined(__NeXT__)
 typedef int socklen_t;
 #endif
@@ -933,5 +933,9 @@
 						tw_http_error(s, sock, 403, name, port, vhost_entry);
 					} else {
-						tw_process_page(s, sock, tw_http_status(200), mime, f, NULL, st.st_size, st.st_mtime, cmtime);
+#ifdef __NETWARE__
+						tw_process_page(s, sock, tw_http_status(200), mime, f, NULL, st.st_size, st.st_mtime.tv_sec, cmtime);
+#else
+							tw_process_page(s, sock, tw_http_status(200), mime, f, NULL, st.st_size, st.st_mtime, cmtime);
+#endif
 						fclose(f);
 					}
@@ -961,5 +965,5 @@
 #if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
 #ifdef __NETWARE__
-	ExitThread(EXIT_THREAD, 0);
+	pthread_exit(NULL);
 #else
 	_endthread();
@@ -1072,5 +1076,7 @@
 					_beginthread(tw_server_pass, 0, 0, e);
 #elif defined(__NETWARE__)
-					BeginThread(tw_server_pass, 0, 0, e);
+					pthread_t thr;
+					pthread_create(&thr, NULL, (void* (*)(void*))tw_server_pass, e);
+					pthread_detach(thr);
 #else
 					_beginthread(tw_server_pass, 0, e);
Index: trunk/Server/tw_config.h
===================================================================
--- trunk/Server/tw_config.h	(revision 344)
+++ trunk/Server/tw_config.h	(revision 347)
@@ -35,17 +35,4 @@
 #define NO_IPV6
 #endif
-#endif
-
-#ifdef __NETWARE__
-struct in_addr {
-	unsigned int s_addr;
-};
-
-struct sockaddr_in {
-	unsigned short sin_family;
-	unsigned short sin_port;
-	struct in_addr sin_addr;
-	char sin_zero[8];
-};
 #endif
 
