]> Git repositories of Nishi - tewi.git/commitdiff
does not really work
authorNishi <nishi@nishi.boats>
Tue, 15 Oct 2024 16:33:28 +0000 (16:33 +0000)
committerNishi <nishi@nishi.boats>
Tue, 15 Oct 2024 16:33:28 +0000 (16:33 +0000)
git-svn-id: file:///raid/svn-personal/tewi/trunk@347 8739d7e6-ffea-ec47-b151-bdff447c6205

Server/config.c
Server/http.c
Server/main.c
Server/module.c
Server/server.c
Server/tw_config.h

index c98a79dde2c94ec0fd48c3eaf5caf850b0d715ed..00fa104d2ed80ffbb60c9e5c2934f5a9e371f691 100644 (file)
@@ -14,7 +14,7 @@
 #include <unistd.h>
 #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>
 #else
@@ -31,6 +31,9 @@
 #include <tcpustd.h>
 #endif
 
+#ifdef __NETWARE__
+#include <arpa/inet.h>
+#endif
 #include "tw_config.h"
 #include "tw_module.h"
 
index cf74139dfa5431dacd171df46491756a626b88a5..94dacf99029989e3070c6266cb8e62eedfab49eb 100644 (file)
@@ -29,6 +29,7 @@
 #endif
 #elif defined(__NETWARE__)
 #include <sys/socket.h>
+#include <sys/select.h>
 #else
 #ifdef USE_POLL
 #ifdef __PPU__
index 3658e910324d7fbed77a49a4a9c09cd1b824d3b4..f6b9fbc75e98a71181cb2bf213b425c62616bcb8 100644 (file)
@@ -37,8 +37,8 @@
 #if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || (defined(__WATCOMC__) && !defined(__OS2__) && !defined(__NETWARE__))
 #include <windows.h>
 #elif defined(__NETWARE__)
-#include <nwconio.h>
-#include <nwthread.h>
+#include <nks/thread.h>
+#include <screen.h>
 #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;
index 8ebd3952774d7739a1c0c907fb4f259d344e2c73..50c29b46fe59801913abaafd8e9bbac938ce2415 100644 (file)
@@ -32,8 +32,7 @@ int tw_module_init(void* mod) { return 1; }
 #define INCL_DOSERRORS
 #include <os2.h>
 #elif defined(__NETWARE__)
-#include <nwadv.h>
-#include <nwthread.h>
+#include <dlfcn.h>
 #else
 #include <windows.h>
 #include <direct.h>
@@ -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
index 03e90d560a814be24d2610950d4afbce21375ad2..d8f6c9b1bdf4bafcc732f1e6b3e66b31fdea1443 100644 (file)
@@ -64,9 +64,9 @@ typedef int socklen_t;
 typedef int socklen_t;
 #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"
 #else
@@ -106,7 +106,7 @@ typedef int socklen_t;
 #include <sys/time.h>
 #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
index b27d105bb14bb08caf1f6525c9129015aa7eda36..84c2fa778c84707cf2e3457e83074d361b76e914 100644 (file)
@@ -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