Changeset 312 in Main for trunk/Server


Ignore:
Timestamp:
Oct 14, 2024, 3:17:37 AM (5 weeks ago)
Author:
Nishi
Message:

works on os2

Location:
trunk/Server
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Server/config.c

    r311 r312  
    33#define SOURCE
    44
    5 #include "tw_config.h"
    6 #include "tw_module.h"
     5#include "../config.h"
    76
    87#include <stdio.h>
     
    1615#endif
    1716
    18 #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(__WATCOMC__))
    1918#ifdef USE_WINSOCK1
    2019#include <winsock.h>
     
    2625#include <cm_string.h>
    2726#include <cm_log.h>
     27
     28#ifdef __OS2__
     29#include <types.h>
     30#include <netinet/in.h>
     31#include <tcpustd.h>
     32#endif
     33
     34#include "tw_config.h"
     35#include "tw_module.h"
    2836
    2937struct tw_config config;
  • trunk/Server/http.c

    r294 r312  
    1616#include <string.h>
    1717
    18 #if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
     18#ifdef __OS2__
     19#include <sys/time.h>
     20#include <types.h>
     21#include <tcpustd.h>
     22#endif
     23
     24#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || (defined(__WATCOMC__) && !defined(__OS2__))
    1925#ifdef USE_WINSOCK1
    2026#include <winsock.h>
  • trunk/Server/main.c

    r311 r312  
    2222#ifndef NO_SSL
    2323#include <openssl/opensslv.h>
     24#endif
     25
     26#ifdef __OS2__
     27#include <types.h>
    2428#endif
    2529
     
    802806        signal(SIGCHLD, SIG_IGN);
    803807        signal(SIGPIPE, SIG_IGN);
    804 #elif !defined(BUILD_GUI)
     808#elif !defined(BUILD_GUI) && !defined(__OS2__)
    805809        SetConsoleTitle(tw_server);
    806810#endif
  • trunk/Server/module.c

    r219 r312  
    2828
    2929#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
     30#ifdef __OS2__
     31#define INCL_DOSMODULEMGR
     32#include <os2.h>
     33#else
    3034#include <windows.h>
    3135#include <direct.h>
     36#endif
    3237#else
    3338#include <dlfcn.h>
     
    3742        char* p = getcwd(NULL, 0);
    3843        void* lib;
     44        char tmp[512];
     45        unsigned long l;
    3946        chdir(config.server_root);
    4047#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
     48#ifdef __OS2__
     49        lib = NULL;
     50        l = (unsigned long)lib;
     51        DosLoadModule(tmp, 512, path, &l);
     52#else
    4153        lib = LoadLibraryA(path);
     54#endif
    4255#else
    4356        lib = dlopen(path, RTLD_LAZY);
     
    5366void* tw_module_symbol(void* mod, const char* sym) {
    5467#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
     68#ifdef __OS2__
     69        void* ret;
     70        DosQueryProcAddr((unsigned long)mod, 0, sym, (PFN*)&ret);
     71        return ret;
     72#else
    5573        return GetProcAddress(mod, sym);
     74#endif
    5675#else
    5776        return dlsym(mod, sym);
  • trunk/Server/server.c

    r311 r312  
    1919#include <unistd.h>
    2020#endif
     21#include <ctype.h>
    2122#include <string.h>
    2223#include <stdbool.h>
     
    3334#include <cm_dir.h>
    3435
     36#ifdef __OS2__
     37#include <types.h>
     38#include <sys/time.h>
     39#define INCL_DOSPROCESS
     40#include <os2.h>
     41#include <process.h>
     42#define HANDLE void*
     43
     44#include "strptime.h"
     45typedef int socklen_t;
     46
     47#include <tcpustd.h>
     48#endif
     49
    3550#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || (defined(__WATCOMC__) && !defined(__OS2__))
    3651#ifndef NO_GETNAMEINFO
     
    109124                } else if(*pw == '*') {
    110125                        return *(pw + 1) == 0 || tw_wildcard_match(pw, pt + 1) || tw_wildcard_match(pw + 1, pt);
    111                 } else if(*pw == '?' || (*pw == *pt)) {
     126                } else if(*pw == '?' || (tolower(*pw) == tolower(*pt))) {
    112127                        pw++;
    113128                        pt++;
     
    120135
    121136void close_socket(int sock) {
    122 #if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
     137#ifdef __OS2__
     138        soclose(sock);
     139#elif defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
    123140        closesocket(sock);
    124141#else
     
    129146int tw_server_init(void) {
    130147        int i;
    131 #if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
     148#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || (defined(__WATCOMC__) && !defined(__OS2__))
    132149        WSADATA wsa;
    133150#ifdef USE_WINSOCK1
     
    136153        WSAStartup(MAKEWORD(2, 0), &wsa);
    137154#endif
     155#endif
     156#ifdef __OS2__
     157        sock_init();
    138158#endif
    139159        for(i = 0; config.ports[i] != -1; i++)
     
    10201040#endif
    10211041#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
     1042#ifdef __OS2__
     1043                                        _beginthread(tw_server_pass, 0, 0, e);
     1044#else
    10221045                                        _beginthread(tw_server_pass, 0, e);
     1046#endif
    10231047#elif defined(_PSP) || defined(__PPU__)
    10241048                                                tw_server_pass(e);
  • trunk/Server/strptime.c

    r243 r312  
    463463                    continue;
    464464                }
    465 #ifdef _WIN32
     465#if defined(_WIN32) || defined(__OS2__)
    466466#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
    467467                if (1)
  • trunk/Server/strptime.h

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

    r311 r312  
    2626#include <net/net.h>
    2727#endif
     28#if !defined(__OS2__)
    2829#include <netinet/in.h>
     30#endif
    2931#ifdef __HAIKU__
    3032#define NO_IPV6
     
    3234#endif
    3335
    34 #ifdef NO_IPV6
     36#if defined(NO_IPV6)
    3537#define SOCKADDR struct sockaddr_in
    3638#else
  • trunk/Server/version.c

    r305 r312  
    1616#elif defined(__linux__)
    1717    "Linux"
     18#elif defined(__OS2__)
     19    "OS/2"
    1820#elif defined(__MINGW32__)
    1921    "Windows-MinGW32"
Note: See TracChangeset for help on using the changeset viewer.