Changeset 315 in Main for trunk


Ignore:
Timestamp:
Oct 14, 2024, 7:01:02 PM (5 weeks ago)
Author:
Nishi
Message:

wip

Location:
trunk
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/Common/dir.c

    r292 r315  
    77#include <sys/stat.h>
    88#if !defined(_MSC_VER) && !defined(__WATCOMC__)
     9#include <dirent.h>
     10#elif defined(__NETWARE__)
    911#include <dirent.h>
    1012#elif defined(__WATCOMC__) || defined(_MSC_VER)
  • trunk/Makefile

    r312 r315  
    4545        -cp ./Server/tewi $(DESTDIR)$(PREFIX)/bin/
    4646        -cp ./Server/tewi.exe $(DESTDIR)$(PREFIX)/bin/
     47        -cp ./Server/tewi.nlm $(DESTDIR)$(PREFIX)/bin/
    4748        -cp ./Module/*.so $(DESTDIR)$(PREFIX)/lib/tewi/
    4849        -cp ./Module/*.dll $(DESTDIR)$(PREFIX)/lib/tewi/
     50        -cp ./Module/*.nlm $(DESTDIR)$(PREFIX)/lib/tewi/
    4951
    5052format:
  • trunk/Module/Makefile

    r314 r315  
    1313
    1414.$(OBJ)$(LIBSUF):
    15         $(CC) $(LDFLAGS) $(SHARED) -o $@ $< ../Common/common.$(STATIC) $(LIBS)
     15        $(CC) $(LDFLAGS) $(SHARED) -o $@ $< $(LIBEXTRA) ../Common/common.$(STATIC) $(LIBS)
    1616
    1717.c.$(OBJ):
  • trunk/Module/mod_cgi.c

    r313 r315  
    2222        return TW_MODULE_STOP;
    2323}
     24
     25#ifdef __NETWARE__
     26int main() { return 0; }
     27#endif
  • trunk/Module/mod_example.c

    r313 r315  
    1313
    1414int MODULE_DECL mod_request(struct tw_tool* tools, struct tw_http_request* req, struct tw_http_response* res) { return TW_MODULE_ERROR(403); }
     15
     16#ifdef __NETWARE__
     17int main() { return 0; }
     18#endif
  • trunk/Module/mod_proxy.c

    r314 r315  
    1414
    1515int MODULE_DECL mod_request(struct tw_tool* tools, struct tw_http_request* req, struct tw_http_response* res) { return TW_MODULE_PASS; }
     16
     17#ifdef __NETWARE__
     18int main() { return 0; }
     19#endif
  • trunk/README

    r313 r315  
    4545Minix                    Working
    4646UnixWare                 Working on 7.1.1
    47 OS/2                     Mostly working, module is broken. Help required!
     47OS/2                     Working
     48NetWare                  WIP
    4849PlayStation Portable     Working, missing module support
    4950                         TODO: Get multi-threading working (maybe)
  • trunk/README.tmpl

    r314 r315  
    4646UnixWare                 Working on 7.1.1
    4747OS/2                     Working
    48 NetWare                  WIP
     48NetWare                  WIP, cannot run fopen somehow
    4949PlayStation Portable     Working, missing module support
    5050                         TODO: Get multi-threading working (maybe)
  • trunk/Server/Makefile

    r255 r315  
    6060
    6161clean:
    62         rm -f *.o tewi *.exe *.res *.elf *.sfo *.pbp *.self *.pkg *.obj concat.rc *.tds
     62        rm -f *.o tewi *.exe *.res *.elf *.sfo *.pbp *.self *.pkg *.obj concat.rc *.tds *.nlm
  • trunk/Server/config.c

    r312 r315  
    1010#include <string.h>
    1111#include <sys/stat.h>
     12#include <errno.h>
    1213
    1314#if !defined(_MSC_VER) && !defined(__BORLANDC__)
     
    125126#elif defined(__ps2sdk__)
    126127        strcpy(config.hostname, "ps2");
     128#elif defined(__NETWARE__)
     129        strcpy(config.hostname, "netware");
    127130#else
    128131        gethostname(config.hostname, 1024);
     
    584587                }
    585588        } else {
     589                printf("%d\n", errno);
    586590                cm_log("Config", "Could not open the file");
    587591                return 1;
  • trunk/Server/http.c

    r312 r315  
    2222#endif
    2323
    24 #if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || (defined(__WATCOMC__) && !defined(__OS2__))
     24#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || (defined(__WATCOMC__) && !defined(__OS2__) && !defined(__NETWARE__))
    2525#ifdef USE_WINSOCK1
    2626#include <winsock.h>
     
    2828#include <winsock2.h>
    2929#endif
     30#elif defined(__NETWARE__)
     31#include <sys/socket.h>
    3032#else
    3133#ifdef USE_POLL
  • trunk/Server/main.c

    r312 r315  
    3535#include "tw_version.h"
    3636
    37 #if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || (defined(__WATCOMC__) && !defined(__OS2__))
     37#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || (defined(__WATCOMC__) && !defined(__OS2__) && !defined(__NETWARE__))
    3838#include <windows.h>
     39#elif defined(__NETWARE__)
     40#include <nwconio.h>
     41#include <nwthread.h>
    3942#endif
    4043
     
    9396int startup(int argc, char** argv);
    9497
    95 #if defined(__MINGW32__) || defined(_MSC_VER) || (defined(__WATCOMC__) && !defined(__OS2__)) || defined(__BORLANDC__)
     98#if defined(__MINGW32__) || defined(_MSC_VER) || (defined(__WATCOMC__) && !defined(__OS2__) && !defined(__NETWARE__)) || defined(__BORLANDC__)
    9699char* get_registry(const char* main, const char* sub) {
    97100        DWORD bufsize = 512;
     
    533536
    534537#if !defined(BUILD_GUI_VALID)
     538void thread_stuff(void* pargs);
     539
     540struct arg_struct {
     541        int argc;
     542        char** argv;
     543};
     544
    535545int main(int argc, char** argv) {
    536546        int st;
     547#ifdef __NETWARE__
     548        struct arg_struct* parg = malloc(sizeof(*parg));
     549        parg->argc = argc;
     550        parg->argv = argv;
     551        DestroyScreen(GetCurrentScreen());
     552        SetCurrentScreen(CreateScreen("Tewi Console", 0));
     553        BeginThread(thread_stuff, NULL, 0, parg);
     554        ThreadSwitch();
     555        ExitThread(EXIT_THREAD, 0);
     556        return 0;
     557}
     558
     559void thread_stuff(void* pargs) {
     560        int st;
     561        int argc = ((struct arg_struct*)pargs)->argc;
     562        char** argv = ((struct arg_struct*)pargs)->argv;
     563#endif
    537564#ifdef SERVICE
    538565        SERVICE_TABLE_ENTRY table[] = {{"Tewi HTTPd", servmain}, {NULL, NULL}};
     
    707734                        ;
    708735#endif
     736#ifdef __NETWARE__
     737                return;
     738#else
    709739                return st;
     740#endif
    710741#endif
    711742        }
     
    715746        sceKernelExitGame();
    716747#endif
     748#ifdef __NETWARE__
     749        return;
     750#else
    717751        return 0;
     752#endif
    718753}
    719754#endif
     
    722757        int i;
    723758        char* r;
    724 #if defined(__MINGW32__) || defined(_MSC_VER) || (defined(__WATCOMC__) && !defined(__OS2__)) || defined(__BORLANDC__)
     759#if defined(__MINGW32__) || defined(_MSC_VER) || (defined(__WATCOMC__) && !defined(__OS2__) && !defined(__NETWARE__)) || defined(__BORLANDC__)
    725760        char* confpath = cm_strdup(PREFIX "/etc/tewi.conf");
    726761        char* regpath = get_registry("Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Tewi HTTPd", "InstallDir");
     
    806841        signal(SIGCHLD, SIG_IGN);
    807842        signal(SIGPIPE, SIG_IGN);
    808 #elif !defined(BUILD_GUI) && !defined(__OS2__)
     843#elif !defined(BUILD_GUI) && !defined(__OS2__) && !defined(__NETWARE__)
    809844        SetConsoleTitle(tw_server);
    810845#endif
  • trunk/Server/module.c

    r313 r315  
    3232#define INCL_DOSERRORS
    3333#include <os2.h>
     34#elif defined(__NETWARE__)
     35#include <nwadv.h>
     36#include <nwthread.h>
    3437#else
    3538#include <windows.h>
     
    4649#ifdef __OS2__
    4750        HMODULE mod;
     51#elif defined(__NETWARE__)
     52        unsigned int* hnd = malloc(sizeof(*hnd));
    4853#endif
    4954        chdir(config.server_root);
    5055#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
    5156#ifdef __OS2__
    52         if(DosLoadModule(tmp, 512, path, &mod) != NO_ERROR){
     57        if(DosLoadModule(tmp, 512, path, &mod) != NO_ERROR) {
    5358                return NULL;
    5459        }
    5560        lib = (void*)mod;
     61#elif defined(__NETWARE__)
     62        *hnd = FindNLMHandle(path);
     63        lib = (void*)hnd;
    5664#else
    5765        lib = LoadLibraryA(path);
     
    7381        void* ret;
    7482        APIRET rc;
    75         if((rc = DosQueryProcAddr((HMODULE)mod, 0, sym, (PFN*)&ret)) != NO_ERROR){
     83        if((rc = DosQueryProcAddr((HMODULE)mod, 0, sym, (PFN*)&ret)) != NO_ERROR) {
    7684                cm_log("Module", "OS/2 error %d", (int)rc);
    7785                return NULL;
    7886        }
    7987        return ret;
     88#elif defined(__NETWARE__)
     89        return ImportSymbol(*(unsigned int*)mod, sym);
    8090#else
    8191        return GetProcAddress(mod, sym);
  • trunk/Server/server.c

    r314 r315  
    4848#endif
    4949
    50 #if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || (defined(__WATCOMC__) && !defined(__OS2__))
     50#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || (defined(__WATCOMC__) && !defined(__OS2__) && !defined(__NETWARE__))
    5151#ifndef NO_GETNAMEINFO
    5252#include <ws2tcpip.h>
     
    6363#include "strptime.h"
    6464typedef int socklen_t;
     65#elif defined(__NETWARE__)
     66#include <sys/socket.h>
     67#include <nwthread.h>
     68
     69typedef int socklen_t;
     70#define IPPROTO_TCP 0
     71#define INADDR_ANY 0
     72#define htons(x) x
     73#include "strptime.h"
    6574#else
    6675#ifdef USE_POLL
     
    137146#ifdef __OS2__
    138147        soclose(sock);
     148#elif defined(__NETWARE__)
     149        shutdown(sock, 2);
    139150#elif defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
    140151        closesocket(sock);
     
    146157int tw_server_init(void) {
    147158        int i;
    148 #if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || (defined(__WATCOMC__) && !defined(__OS2__))
     159#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || (defined(__WATCOMC__) && !defined(__OS2__) && !defined(__NETWARE__))
    149160        WSADATA wsa;
    150161#ifdef USE_WINSOCK1
     
    522533        struct sockaddr* sa = (struct sockaddr*)&addr;
    523534        getnameinfo(sa, sizeof(addr), address, 512, NULL, 0, NI_NUMERICHOST);
    524 #else
    525                 addrstr = inet_ntoa(addr.sin_addr);
    526                 strcpy(address, addrstr);
    527                 address[strlen(addrstr)] = 0;
     535#elif defined(__NETWARE__)
     536                address[0] = 0;
     537#else
     538        addrstr = inet_ntoa(addr.sin_addr);
     539        strcpy(address, addrstr);
     540        address[strlen(addrstr)] = 0;
    528541#endif
    529542#ifdef FREE_PTR
     
    632645                        tw_mod_request_t mod_req = (tw_mod_request_t)tw_module_symbol(config.modules[i], "MOD_REQUEST");
    633646#else
    634                         tw_mod_request_t mod_req = (tw_mod_request_t)tw_module_symbol(config.modules[i], "mod_request");
     647                                tw_mod_request_t mod_req = (tw_mod_request_t)tw_module_symbol(config.modules[i], "mod_request");
    635648#endif
    636649                        if(mod_req != NULL) {
     
    941954        close_socket(sock);
    942955#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
     956#ifdef __NETWARE__
     957        ExitThread(EXIT_THREAD, 0);
     958#else
    943959        _endthread();
     960#endif
    944961#elif defined(__HAIKU__)
    945962                exit_thread(0);
     
    959976#ifdef __HAIKU__
    960977        thread_id thread;
     978#elif defined(__NETWARE__)
     979        int thread;
    961980#else
    962981        HANDLE handle;
     
    10461065#ifdef __OS2__
    10471066                                        _beginthread(tw_server_pass, 0, 0, e);
     1067#elif defined(__NETWARE__)
     1068                                        BeginThread(tw_server_pass, 0, 0, e);
    10481069#else
    10491070                                        _beginthread(tw_server_pass, 0, e);
  • trunk/Server/strptime.c

    r312 r315  
    3838#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
    3939
     40#include <stdlib.h>
    4041#include <ctype.h>
    4142#include <string.h>
     
    4445
    4546#ifdef __WATCOMC__
     47#ifndef __NETWARE__
    4648#include <strings.h>
     49#endif
    4750#endif
    4851
     
    117120#endif
    118121
    119 #ifdef __BORLANDC__
     122#if defined(__BORLANDC__) || defined(__NETWARE__)
    120123char* cm_strdup(const char* str);
     124
     125#ifdef __NETWARE__
     126#define strncasecmp _strnicmp
     127#endif
    121128
    122129int _strnicmp(const char* _a, const char* _b, int len){
     
    124131        char* b = cm_strdup(_b);
    125132        int i;
    126         char* r;
     133        int r;
    127134        for(i = 0; a[i] != 0; i++){
    128135                a[i] = tolower(a[i]);
     
    429436
    430437#ifndef TIME_MAX
    431 #if defined(_MSC_VER) || defined(__BORLANDC__)
     438#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__NETWARE__)
    432439#define TIME_MAX        INT32_MAX
    433440#else
  • trunk/Server/strptime.h

    r312 r315  
    88#include <time.h>
    99
    10 #if defined(_WIN32) || defined(_PSP) || defined(__ps2sdk__) || defined(__OS2__)
     10#if defined(_WIN32) || defined(_PSP) || defined(__ps2sdk__) || defined(__OS2__) || defined(__NETWARE__)
    1111char* strptime(const char *buf, const char *fmt, struct tm *tm);
    1212#endif
  • trunk/Server/tw_config.h

    r312 r315  
    1515#include <stdbool.h>
    1616
    17 #if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || (defined(__WATCOMC__) && !defined(__OS2__))
     17#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || (defined(__WATCOMC__) && !defined(__OS2__) && !defined(__NETWARE__))
    1818#ifdef USE_WINSOCK1
    1919#include <winsock.h>
     
    2626#include <net/net.h>
    2727#endif
    28 #if !defined(__OS2__)
     28#if !defined(__OS2__) && !defined(__NETWARE__)
    2929#include <netinet/in.h>
    3030#endif
     
    3232#define NO_IPV6
    3333#endif
     34#endif
     35
     36#ifdef __NETWARE__
     37struct in_addr {
     38        unsigned int s_addr;
     39};
     40
     41struct sockaddr_in {
     42        unsigned short sin_family;
     43        unsigned short sin_port;
     44        struct in_addr sin_addr;
     45        char sin_zero[8];
     46};
    3447#endif
    3548
  • trunk/Server/tw_module.h

    r314 r315  
    1616#include <os2.h>
    1717#define MODULE_DECL __export APIENTRY
     18#elif defined(__WATCOMC__)
     19#define MODULE_DECL __export
    1820#else
    1921#define MODULE_DECL
     
    4749#define TW_CONFIG_ERROR _TW_CONFIG_ERROR
    4850
    49 typedef int (MODULE_DECL *tw_mod_init_t)(struct tw_config* config, struct tw_tool* tools);
    50 typedef int (MODULE_DECL *tw_mod_request_t)(struct tw_tool* tools, struct tw_http_request* req, struct tw_http_response* res);
    51 typedef int (MODULE_DECL *tw_mod_config_t)(struct tw_tool* tools, char** argv, int argc);
     51typedef int(MODULE_DECL* tw_mod_init_t)(struct tw_config* config, struct tw_tool* tools);
     52typedef int(MODULE_DECL* tw_mod_request_t)(struct tw_tool* tools, struct tw_http_request* req, struct tw_http_response* res);
     53typedef int(MODULE_DECL* tw_mod_config_t)(struct tw_tool* tools, char** argv, int argc);
    5254
    5355#ifdef SOURCE
  • trunk/config.h.tmpl

    r312 r315  
    2020#endif
    2121
    22 #if (defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || (defined(__WATCOMC__) && !defined(__OS2__))) && defined(BUILD_GUI) && !defined(SERVICE)
     22#if (defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || (defined(__WATCOMC__) && !defined(__OS2__) && !defined(__NETWARE__))) && defined(BUILD_GUI) && !defined(SERVICE)
    2323#define BUILD_GUI_VALID
    2424#endif
     
    7373#endif
    7474
     75#if defined(__WATCOMC__) && defined(__NETWARE__) && !defined(NO_IPV6)
     76#define NO_IPV6
     77#endif
     78
    7579#endif
    7680
Note: See TracChangeset for help on using the changeset viewer.