#include <cm_log.h>
#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>
#include <wspiapi.h>
SOCKADDR addresses[MAX_PORTS];
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
}
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
close(sock);
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);
#endif
SOCKADDR addr;
};
-#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) {
#elif defined(__HAIKU__)
#elif defined(_PSP) || defined(__PPU__)
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;
bool ssl = ((struct pass_entry*)ptr)->ssl;
time_t t;
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);
cmtime = mktime(&tm);
cm_log("Server", "Document root is %s", vhost_entry->root == NULL ? "not set" : vhost_entry->root);
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] == '/') {
path[i] = 0;
}
}
#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--) {
if(rpath[i] == '/') {
SSL_free(s);
#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__)
exit_thread(0);
extern SERVICE_STATUS_HANDLE status_handle;
#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__
thread_id thread;
fd_set fdset;
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++) {
threads[i].used = false;
#endif
#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
break;
SOCKADDR claddr;
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));
cm_log("Server", "New connection accepted");
e->port = config.ports[i];
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__)
tw_server_pass(e);