From: Nishi Date: Tue, 15 Oct 2024 16:33:28 +0000 (+0000) Subject: does not really work X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=1941c027bd69cbbed210e8d6cb3bf97fc72afabd;p=tewi.git does not really work git-svn-id: file:///raid/svn-personal/tewi/trunk@347 8739d7e6-ffea-ec47-b151-bdff447c6205 --- diff --git a/Server/config.c b/Server/config.c index c98a79d..00fa104 100644 --- a/Server/config.c +++ b/Server/config.c @@ -14,7 +14,7 @@ #include #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 #else @@ -31,6 +31,9 @@ #include #endif +#ifdef __NETWARE__ +#include +#endif #include "tw_config.h" #include "tw_module.h" diff --git a/Server/http.c b/Server/http.c index cf74139..94dacf9 100644 --- a/Server/http.c +++ b/Server/http.c @@ -29,6 +29,7 @@ #endif #elif defined(__NETWARE__) #include +#include #else #ifdef USE_POLL #ifdef __PPU__ diff --git a/Server/main.c b/Server/main.c index 3658e91..f6b9fbc 100644 --- a/Server/main.c +++ b/Server/main.c @@ -37,8 +37,8 @@ #if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || (defined(__WATCOMC__) && !defined(__OS2__) && !defined(__NETWARE__)) #include #elif defined(__NETWARE__) -#include -#include +#include +#include #endif #ifdef _PSP @@ -548,18 +548,10 @@ int main(int argc, char** argv) { struct arg_struct* parg = malloc(sizeof(*parg)); 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) { int st; int argc = ((struct arg_struct*)pargs)->argc; diff --git a/Server/module.c b/Server/module.c index 8ebd395..50c29b4 100644 --- a/Server/module.c +++ b/Server/module.c @@ -32,8 +32,7 @@ int tw_module_init(void* mod) { return 1; } #define INCL_DOSERRORS #include #elif defined(__NETWARE__) -#include -#include +#include #else #include #include @@ -59,8 +58,7 @@ void* tw_module_load(const char* path) { } lib = (void*)mod; #elif defined(__NETWARE__) - *hnd = FindNLMHandle(path); - lib = (void*)hnd; + lib = dlopen(path, RTLD_LAZY); #else lib = LoadLibraryA(path); #endif @@ -86,7 +84,7 @@ void* tw_module_symbol(void* mod, const char* sym) { } return ret; #elif defined(__NETWARE__) - return ImportSymbol(*(unsigned int*)mod, sym); + return dlsym(mod, sym); #else return GetProcAddress(mod, sym); #endif diff --git a/Server/server.c b/Server/server.c index 03e90d5..d8f6c9b 100644 --- a/Server/server.c +++ b/Server/server.c @@ -64,9 +64,9 @@ typedef int socklen_t; typedef int socklen_t; #elif defined(__NETWARE__) #include -#include -#define IPPROTO_TCP 0 -#define INADDR_ANY 0 +#include +#include +#include #define htons(x) x #include "strptime.h" #else @@ -106,7 +106,7 @@ typedef int socklen_t; #include #endif -#if defined(__USLC__) || defined(__NeXT__) || defined(__NETWARE__) +#if defined(__USLC__) || defined(__NeXT__) typedef int socklen_t; #endif @@ -932,7 +932,11 @@ int tw_server_pass(void* ptr) { if(f == NULL) { 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); } } @@ -960,7 +964,7 @@ cleanup: close_socket(sock); #if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__) #ifdef __NETWARE__ - ExitThread(EXIT_THREAD, 0); + pthread_exit(NULL); #else _endthread(); #endif @@ -1071,7 +1075,9 @@ void tw_server_loop(void) { #ifdef __OS2__ _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); #endif diff --git a/Server/tw_config.h b/Server/tw_config.h index b27d105..84c2fa7 100644 --- a/Server/tw_config.h +++ b/Server/tw_config.h @@ -36,19 +36,6 @@ extern "C" { #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 - #if defined(NO_IPV6) #define SOCKADDR struct sockaddr_in #else