From: Nishi Date: Sun, 3 Nov 2024 10:39:59 +0000 (+0000) Subject: amiga X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=4b32299e557d32756ba30807fea6371e2a13173c;p=tewi.git amiga git-svn-id: file:///raid/svn-personal/tewi/trunk@402 8739d7e6-ffea-ec47-b151-bdff447c6205 --- diff --git a/Platform/amiga.mk b/Platform/amiga.mk new file mode 100644 index 0000000..60e1978 --- /dev/null +++ b/Platform/amiga.mk @@ -0,0 +1,12 @@ +# $Id$ + +PREFIX = :Tewi + +CC = m68k-amigaos-gcc +AR = m68k-amigaos-ar +CFLAGS = -g -std=c99 -DPREFIX=\"$(PREFIX)\" -I $(PWD)/Common -mcrt=nix13 +LDFLAGS = -mcrt=nix13 +LIBS = -lsocket -lpthread +MODULE = +EXEC = +LIBSUF = .so diff --git a/README.tmpl b/README.tmpl index 4726238..af45d19 100644 --- a/README.tmpl +++ b/README.tmpl @@ -62,3 +62,4 @@ I sometimes check they do compile, but does not work: PlayStation 2 Does not boot Windows NT (MIPS) Cannot read file properly +Amiga Cannot connect diff --git a/Server/config.c b/Server/config.c index 8fef798..8fc335b 100644 --- a/Server/config.c +++ b/Server/config.c @@ -133,6 +133,8 @@ void tw_config_init(void) { strcpy(config.hostname, "ps2"); #elif defined(__NETWARE__) strcpy(config.hostname, "netware"); +#elif defined(__amiga__) + strcpy(config.hostname, "amiga"); #else gethostname(config.hostname, 1024); #endif diff --git a/Server/module.c b/Server/module.c index a35a83e..a3e60e5 100644 --- a/Server/module.c +++ b/Server/module.c @@ -17,7 +17,7 @@ extern struct tw_config config; -#if defined(_PSP) || defined(__PPU__) || defined(__ps2sdk__) || defined(__NeXT__) || defined(__DOS__) +#if defined(_PSP) || defined(__PPU__) || defined(__ps2sdk__) || defined(__NeXT__) || defined(__DOS__) || defined(__amiga__) void* tw_module_load(const char* path) { return NULL; } void* tw_module_symbol(void* mod, const char* sym) { return NULL; } diff --git a/Server/server.c b/Server/server.c index b148735..e312199 100644 --- a/Server/server.c +++ b/Server/server.c @@ -15,6 +15,10 @@ #include "tw_module.h" #include "tw_version.h" +#ifdef __amiga__ +#include +#endif + #if !defined(_MSC_VER) && !defined(__BORLANDC__) #include #endif @@ -107,7 +111,7 @@ uint16_t htons(uint16_t n) { return ((n >> 8) & 0xff) | ((n << 8) & 0xff00); } #endif #endif -#if defined(_PSP) || defined(__ps2sdk__) || defined(__bsdi__) +#if defined(_PSP) || defined(__ps2sdk__) || defined(__bsdi__) || defined(__amiga__) #include "strptime.h" #endif @@ -515,12 +519,14 @@ struct pass_entry { #if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__) #define NO_RETURN_THREAD void tw_server_pass(void* ptr) { +#elif defined(__amiga__) +void* tw_server_pass(void* ptr) { #elif defined(__HAIKU__) int32_t tw_server_pass(void* ptr) { #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__) || defined(__WATCOMC__) +#if defined(__HAIKU__) || defined(__MINGW32__) || defined(_PSP) || defined(__PPU__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__amiga__) #define FREE_PTR int sock = ((struct pass_entry*)ptr)->sock; bool ssl = ((struct pass_entry*)ptr)->ssl; @@ -621,7 +627,7 @@ int tw_server_pass(void* ptr) { 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__) || defined(__WATCOMC__) || defined(__USLC__) || defined(__NeXT__) || defined(__bsdi__) +#if defined(__MINGW32__) || defined(_PSP) || defined(__PPU__) || defined(__ps2sdk__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__USLC__) || defined(__NeXT__) || defined(__bsdi__) || defined(__amiga__) t = 0; btm = localtime(&t); cmtime = mktime(&tm); @@ -1055,7 +1061,7 @@ void tw_server_loop(void) { if(ret == -1) { #if !defined(__MINGW32__) && !defined(_MSC_VER) && !defined(__BORLANDC__) && !defined(__WATCOMC__) if(errno == EINTR) continue; - cm_log("Server", "Select failure: %s", strerror(errno)); + cm_log("Server", "Select/poll failure: %s", strerror(errno)); #endif break; } else if(ret == 0) { @@ -1078,7 +1084,10 @@ void tw_server_loop(void) { 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__) || defined(__WATCOMC__) +#if defined(__MINGW32__) || defined(__HAIKU__) || defined(_PSP) || defined(__PPU__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__amiga__) +#ifdef __amiga__ + pthread_t thrt; +#endif int j; struct pass_entry* e = malloc(sizeof(*e)); cm_log("Server", "New connection accepted"); @@ -1103,6 +1112,8 @@ void tw_server_loop(void) { #endif #elif defined(_PSP) || defined(__PPU__) tw_server_pass(e); +#elif defined(__amiga__) + pthread_create(&thrt, NULL, tw_server_pass, e); #elif defined(__HAIKU__) for(j = 0; j < sizeof(threads) / sizeof(threads[0]); j++) { if(threads[j].used) { diff --git a/Server/strptime.c b/Server/strptime.c index b763023..1ce02c5 100644 --- a/Server/strptime.c +++ b/Server/strptime.c @@ -35,7 +35,7 @@ //#include //__RCSID("$NetBSD: strptime.c,v 1.62 2017/08/24 01:01:09 ginsbach Exp $"); -#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__NeXT__) || defined(__bsdi__) +#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__NeXT__) || defined(__bsdi__) || defined(__amiga__) #include #include @@ -115,7 +115,7 @@ static const unsigned char *find_string(const unsigned char *, int *, const char #define strncasecmp _strnicmp #endif -#ifdef __WATCOMC__ +#if defined(__WATCOMC__) #define _tzset tzset #endif @@ -469,8 +469,8 @@ recurse: bp = NULL; continue; } -#if defined(_WIN32) || defined(__OS2__) || defined(__NeXT__) || defined(__DOS__) -#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__NeXT__) +#if defined(_WIN32) || defined(__OS2__) || defined(__NeXT__) || defined(__DOS__) || defined(__amiga__) +#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__NeXT__) || defined(__amiga__) if (1) #else if (localtime_s(tm, &sse) == 0) @@ -560,6 +560,7 @@ recurse: case 'z': // #ifdef _WIN32 _tzset(); +#elif defined(__amiga__) #else tzset(); #endif diff --git a/Server/strptime.h b/Server/strptime.h index 68eab31..82f6fce 100644 --- a/Server/strptime.h +++ b/Server/strptime.h @@ -7,7 +7,7 @@ extern "C" { #include -#if defined(_WIN32) || defined(_PSP) || defined(__ps2sdk__) || defined(__OS2__) || defined(__NETWARE__) || defined(__NeXT__) || defined(__DOS__) || defined(__bsdi__) +#if defined(_WIN32) || defined(_PSP) || defined(__ps2sdk__) || defined(__OS2__) || defined(__NETWARE__) || defined(__NeXT__) || defined(__DOS__) || defined(__bsdi__) || defined(__amiga__) char* strptime(const char *buf, const char *fmt, struct tm *tm); #endif diff --git a/Server/version.c b/Server/version.c index cea7d64..54d87e1 100644 --- a/Server/version.c +++ b/Server/version.c @@ -25,6 +25,8 @@ const char* tw_platform = "NetWare" #elif defined(__DOS__) "DOS" +#elif defined(__amiga__) + "Amiga" #elif defined(__MINGW32__) "Windows-MinGW32" #elif defined(_MSC_VER) diff --git a/config_platform.h b/config_platform.h index 2bf9975..b12c318 100644 --- a/config_platform.h +++ b/config_platform.h @@ -36,6 +36,21 @@ /* Do not use getnameinfo */ #endif +#if (defined(__amiga__)) && !defined(NO_IPV6) +#define NO_IPV6 +/* Amiga does not have IPv6 */ +#endif + +#if (defined(__amiga__)) && defined(HAS_CHROOT) +#undef HAS_CHROOT +/* Amiga does not have chroot */ +#endif + +#if (defined(__amiga__)) && !defined(NO_GETNAMEINFO) +#define NO_GETNAMEINFO +/* Do not use getnameinfo */ +#endif + #if (defined(_PSP) || defined(__PPU__) || defined(__ps2sdk__)) && !defined(NO_IPV6) #define NO_IPV6 /* PSP/PS2/PS3 does not have IPv6 */