Index: /trunk/Common/dir.c
===================================================================
--- /trunk/Common/dir.c	(revision 218)
+++ /trunk/Common/dir.c	(revision 219)
@@ -6,6 +6,8 @@
 
 #include <sys/stat.h>
-#ifndef _MSC_VER
+#if !defined(_MSC_VER) && !defined(__WATCOMC__)
 #include <dirent.h>
+#elif defined(__WATCOMC__)
+#include <direct.h>
 #endif
 #include <stdlib.h>
Index: /trunk/Module/Makefile
===================================================================
--- /trunk/Module/Makefile	(revision 218)
+++ /trunk/Module/Makefile	(revision 219)
@@ -3,4 +3,5 @@
 OBJ=o
 STATIC=a
+END=_dll
 include $(PWD)/Platform/$(PLATFORM).mk
 
Index: /trunk/Platform/watcom.mk
===================================================================
--- /trunk/Platform/watcom.mk	(revision 219)
+++ /trunk/Platform/watcom.mk	(revision 219)
@@ -0,0 +1,14 @@
+# $Id$
+
+PREFIX = C:/Tewi
+
+CC = owcc
+AR = wlib
+AR_FLAGS = -q -b -n -fo
+CFLAGS = -b nt$(END) -I $(WATCOM)/h/nt -g -std=c99 -DPREFIX=\"$(PREFIX)\" -I ../Common -fPIC
+LDFLAGS = -b nt$(END)
+LIBS = ws2_32.lib
+EXEC = .exe
+STATIC = lib
+LIBSUF = .dll
+OBJ = obj
Index: /trunk/Server/http.c
===================================================================
--- /trunk/Server/http.c	(revision 218)
+++ /trunk/Server/http.c	(revision 219)
@@ -16,5 +16,5 @@
 #include <string.h>
 
-#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__)
+#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
 #include <winsock2.h>
 #else
Index: /trunk/Server/main.c
===================================================================
--- /trunk/Server/main.c	(revision 218)
+++ /trunk/Server/main.c	(revision 219)
@@ -790,5 +790,5 @@
 	cm_force_log(r);
 	free(r);
-#if !defined(__MINGW32__) && !defined(_MSC_VER) && !defined(__BORLANDC__)
+#if !defined(__MINGW32__) && !defined(_MSC_VER) && !defined(__BORLANDC__) && !defined(__WATCOMC__)
 	signal(SIGCHLD, SIG_IGN);
 	signal(SIGPIPE, SIG_IGN);
Index: /trunk/Server/module.c
===================================================================
--- /trunk/Server/module.c	(revision 218)
+++ /trunk/Server/module.c	(revision 219)
@@ -27,5 +27,5 @@
 #else
 
-#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__)
+#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
 #include <windows.h>
 #include <direct.h>
@@ -38,5 +38,5 @@
 	void* lib;
 	chdir(config.server_root);
-#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__)
+#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
 	lib = LoadLibraryA(path);
 #else
@@ -52,5 +52,5 @@
 
 void* tw_module_symbol(void* mod, const char* sym) {
-#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__)
+#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
 	return GetProcAddress(mod, sym);
 #else
Index: /trunk/Server/server.c
===================================================================
--- /trunk/Server/server.c	(revision 218)
+++ /trunk/Server/server.c	(revision 219)
@@ -33,5 +33,5 @@
 #include <cm_dir.h>
 
-#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__)
+#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
 #ifndef NO_GETADDRINFO
 #include <ws2tcpip.h>
@@ -85,5 +85,5 @@
 int sockets[MAX_PORTS];
 
-#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__)
+#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
 const char* reserved_names[] = {"CON", "PRN", "AUX", "NUL", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9"};
 #endif
@@ -112,5 +112,5 @@
 
 void close_socket(int sock) {
-#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__)
+#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
 	closesocket(sock);
 #else
@@ -121,5 +121,5 @@
 int tw_server_init(void) {
 	int i;
-#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__)
+#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
 	WSADATA wsa;
 	WSAStartup(MAKEWORD(2, 0), &wsa);
@@ -450,5 +450,5 @@
 };
 
-#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__)
+#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
 #define NO_RETURN_THREAD
 void tw_server_pass(void* ptr) {
@@ -458,5 +458,5 @@
 int tw_server_pass(void* ptr) {
 #endif
-#if defined(__HAIKU__) || defined(__MINGW32__) || defined(_PSP) || defined(__PPU__) || defined(_MSC_VER) || defined(__BORLANDC__)
+#if defined(__HAIKU__) || defined(__MINGW32__) || defined(_PSP) || defined(__PPU__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
 #define FREE_PTR
 	int sock = ((struct pass_entry*)ptr)->sock;
@@ -552,5 +552,5 @@
 					struct tm* btm;
 					strptime(req.headers[i + 1], "%a, %d %b %Y %H:%M:%S GMT", &tm);
-#if defined(__MINGW32__) || defined(_PSP) || defined(__PPU__) || defined(__ps2sdk__) || defined(_MSC_VER) || defined(__BORLANDC__)
+#if defined(__MINGW32__) || defined(_PSP) || defined(__PPU__) || defined(__ps2sdk__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
 					t = 0;
 					btm = localtime(&t);
@@ -619,5 +619,5 @@
 			path = cm_strcat(vhost_entry->root == NULL ? "" : vhost_entry->root, req.path);
 			cm_log("Server", "Filesystem path is %s", path);
-#if defined(_MSC_VER) || defined(__BORLANDC__)
+#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
 			for(i = strlen(path) - 1; i >= 0; i--) {
 				if(path[i] == '/') {
@@ -628,5 +628,5 @@
 			}
 #endif
-#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__)
+#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
 			rpath = cm_strdup(path);
 			for(i = strlen(rpath) - 1; i >= 0; i--) {
@@ -899,5 +899,5 @@
 #endif
 	close_socket(sock);
-#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__)
+#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
 	_endthread();
 #elif defined(__HAIKU__)
@@ -914,5 +914,5 @@
 #endif
 
-#if defined(__MINGW32__) || defined(__HAIKU__) || defined(_MSC_VER) || defined(__BORLANDC__)
+#if defined(__MINGW32__) || defined(__HAIKU__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
 struct thread_entry {
 #ifdef __HAIKU__
@@ -933,5 +933,5 @@
 	struct timeval tv;
 #endif
-#if defined(__MINGW32__) || defined(__HAIKU__) || defined(_MSC_VER) || defined(__BORLANDC__)
+#if defined(__MINGW32__) || defined(__HAIKU__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
 	struct thread_entry threads[2048];
 	for(i = 0; i < sizeof(threads) / sizeof(threads[0]); i++) {
@@ -964,5 +964,5 @@
 #endif
 		if(ret == -1) {
-#if !defined(__MINGW32__) && !defined(_MSC_VER) && !defined(__BORLANDC__)
+#if !defined(__MINGW32__) && !defined(_MSC_VER) && !defined(__BORLANDC__) && !defined(__WATCOMC__)
 			cm_log("Server", "Select failure: %s", strerror(errno));
 #endif
@@ -988,5 +988,5 @@
 					socklen_t clen = sizeof(claddr);
 					int sock = accept(sockets[i], (struct sockaddr*)&claddr, &clen);
-#if defined(__MINGW32__) || defined(__HAIKU__) || defined(_PSP) || defined(__PPU__) || defined(_MSC_VER) || defined(__BORLANDC__)
+#if defined(__MINGW32__) || defined(__HAIKU__) || defined(_PSP) || defined(__PPU__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
 					int j;
 					struct pass_entry* e = malloc(sizeof(*e));
@@ -1001,5 +1001,5 @@
 					e->addr = claddr;
 #endif
-#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__)
+#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
 					_beginthread(tw_server_pass, 0, e);
 #elif defined(_PSP) || defined(__PPU__)
Index: /trunk/Server/strptime.c
===================================================================
--- /trunk/Server/strptime.c	(revision 218)
+++ /trunk/Server/strptime.c	(revision 219)
@@ -36,5 +36,5 @@
 //__RCSID("$NetBSD: strptime.c,v 1.62 2017/08/24 01:01:09 ginsbach Exp $");
 
-#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__)
+#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
 
 #include <ctype.h>
Index: /trunk/Server/tw_config.h
===================================================================
--- /trunk/Server/tw_config.h	(revision 218)
+++ /trunk/Server/tw_config.h	(revision 219)
@@ -15,5 +15,5 @@
 #include <stdbool.h>
 
-#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__)
+#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
 #include <winsock2.h>
 #define NO_IPV6
Index: /trunk/Server/version.c
===================================================================
--- /trunk/Server/version.c	(revision 218)
+++ /trunk/Server/version.c	(revision 219)
@@ -17,7 +17,9 @@
     "Windows-MinGW32"
 #elif defined(_MSC_VER)
-    "Windows-MSVC"
+    "Windows-VisualC"
 #elif defined(__BORLANDC__)
-    "Windows-BCC"
+    "Windows-Borland"
+#elif defined(__WATCOMC__)
+    "Windows-Watcom"
 #elif defined(__HAIKU__)
     "Haiku"
Index: /trunk/config.h.tmpl
===================================================================
--- /trunk/config.h.tmpl	(revision 218)
+++ /trunk/config.h.tmpl	(revision 219)
@@ -18,15 +18,15 @@
 #endif
 
-#if (defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__)) && defined(USE_POLL)
+#if (defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)) && defined(USE_POLL)
 #undef USE_POLL
 /* Force select(2) for Windows */
 #endif
 
-#if (defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__)) && defined(HAS_CHROOT)
+#if (defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)) && defined(HAS_CHROOT)
 #undef HAS_CHROOT
 /* Windows should not have chroot */
 #endif
 
-#if (defined(_MSC_VER) || defined(__BORLANDC__)) && !defined(NO_GETADDRINFO)
+#if (defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)) && !defined(NO_GETADDRINFO)
 #define NO_GETADDRINFO
 /* Do not use getaddrinfo */
