Changeset 215 in Main
- Timestamp:
- Oct 3, 2024, 4:24:43 AM (6 weeks ago)
- Location:
- trunk
- Files:
-
- 2 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/Makefile
r212 r215 4 4 STATIC=a 5 5 AR_FLAGS=rcs 6 AR_PROC=cat 6 7 include $(PWD)/Platform/$(PLATFORM).mk 7 8 … … 14 15 15 16 common.$(STATIC): $(OBJS) 16 $(AR) $(AR_FLAGS)$@ $(OBJS)17 $(AR) $(AR_FLAGS)$@ `echo $(OBJS) | $(AR_PROC)` 17 18 18 19 .c.$(OBJ): … … 20 21 21 22 clean: 22 rm -f *.o *.a *.lib 23 rm -f *.o *.a *.lib *.obj -
trunk/Common/dir.c
r212 r215 19 19 20 20 char** cm_scandir(const char* path) { 21 #if def _MSC_VER21 #if defined(_MSC_VER) || defined(__BORLANDC__) 22 22 return NULL; 23 23 #else -
trunk/Module/Makefile
r212 r215 14 14 15 15 .c.$(OBJ): 16 $(CC) $(CFLAGS) - c -o $@ $<16 $(CC) $(CFLAGS) -I ../Server -c -o $@ $< 17 17 18 18 clean: 19 rm -f *.o *.so *.a *.dll *.dll19 rm -f *.o *.so *.a *.dll -
trunk/Module/mod_cgi.c
r41 r215 1 1 /* $Id$ */ 2 2 3 #include "../Server/tw_module.h"3 #include <tw_module.h> 4 4 5 5 #include <cm_string.h> -
trunk/Module/mod_example.c
r40 r215 2 2 /* This module will accept all directives, and always return 403 on the access. */ 3 3 4 #include "../Server/tw_module.h"4 #include <tw_module.h> 5 5 6 6 int mod_init(struct tw_config* config, struct tw_tool* tools) { -
trunk/Module/mod_proxy.c
r126 r215 1 1 /* $Id$ */ 2 2 3 #include "../Server/tw_module.h"3 #include <tw_module.h> 4 4 5 5 #include <cm_string.h> -
trunk/Platform/vc6.mk
r214 r215 13 13 LIBSUF = .dll 14 14 OBJ = obj 15 PREOBJS = tewi_vc6.res -
trunk/Server/Makefile
r212 r215 14 14 tewi_strip$(EXEC): tewi$(EXEC) 15 15 16 tewi$(EXEC): $(OBJS) ../Common/common.$(STATIC) 16 tewi$(EXEC): $(OBJS) ../Common/common.$(STATIC) $(REQOBJS) 17 17 $(CC) $(LDFLAGS) $(EXTLDFLAGS) -o $@ $(OBJS) $(EXTLIBS) ../Common/common.$(STATIC) $(LIBS) 18 18 $(SERVADD) … … 49 49 $(WINDRES) tewi.rc -O coff -o $@ 50 50 51 tewi_vc6.res: tewi.rc ../Binary/tewi.ico 52 rc /fo$@ tewi.rc 53 54 tewi_bcc.res: tewi.rc ../Binary/tewi.ico 55 brc32 -r -fo$@ tewi.rc 56 51 57 clean: 52 58 rm -f *.o tewi *.exe *.res *.elf *.sfo *.pbp *.self *.pkg *.obj -
trunk/Server/config.c
r212 r215 11 11 #include <string.h> 12 12 13 #if ndef _MSC_VER13 #if !defined(_MSC_VER) && !defined(__BORLANDC__) 14 14 #include <unistd.h> 15 15 #endif 16 16 17 #if defined(__MINGW32__) || defined(_MSC_VER) 17 #if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) 18 18 #include <winsock2.h> 19 19 #endif … … 267 267 ) { 268 268 for(i = 1; r[i] != NULL; i++) { 269 #if def _MSC_VER269 #if defined(_MSC_VER) || defined(__BORLANDC__) 270 270 uint32_t port = atoi(r[i]); 271 271 #else … … 274 274 int j; 275 275 cm_log("Config", "Going to listen at port %d%s", (int)port, cm_strcaseequ(r[0], "ListenSSL") ? " with SSL" : ""); 276 #if def _MSC_VER276 #if defined(_MSC_VER) || defined(__BORLANDC__) 277 277 if(cm_strcaseequ(r[0], "ListenSSL")) port |= (1UL << 31); 278 278 #else -
trunk/Server/http.c
r213 r215 16 16 #include <string.h> 17 17 18 #if defined(__MINGW32__) || defined(_MSC_VER) 18 #if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) 19 19 #include <winsock2.h> 20 20 #else -
trunk/Server/main.c
r213 r215 5 5 #include "../config.h" 6 6 7 #ifndef _MSC_VER 7 #ifdef __BORLANDC__ 8 9 #pragma resource "tewi_bcc.res" 10 11 #endif 12 13 #if !defined(_MSC_VER) && !defined(__BORLANDC__) 8 14 #include <unistd.h> 9 15 #endif … … 25 31 #include "tw_version.h" 26 32 27 #if defined(__MINGW32__) || defined(_MSC_VER) 33 #if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) 28 34 #include <windows.h> 29 35 #endif … … 62 68 #define printf(...) tt_printf(__VA_ARGS__) 63 69 #define STDERR_LOG(...) tt_printf(__VA_ARGS__) 64 #elif defined(_MSC_VER) 70 #elif defined(_MSC_VER) || defined(__BORLANDC__) 65 71 void STDERR_LOG(const char* format, ...) { 66 72 va_list args; … … 784 790 cm_force_log(r); 785 791 free(r); 786 #if !defined(__MINGW32__) && !defined(_MSC_VER) 792 #if !defined(__MINGW32__) && !defined(_MSC_VER) && !defined(__BORLANDC__) 787 793 signal(SIGCHLD, SIG_IGN); 788 794 signal(SIGPIPE, SIG_IGN); -
trunk/Server/module.c
r212 r215 12 12 #include <string.h> 13 13 #include <stdlib.h> 14 #if ndef _MSC_VER14 #if !defined(_MSC_VER) && !defined(__BORLANDC__) 15 15 #include <unistd.h> 16 16 #endif … … 27 27 #else 28 28 29 #if defined(__MINGW32__) || defined(_MSC_VER) 29 #if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) 30 30 #include <windows.h> 31 31 #else … … 37 37 void* lib; 38 38 chdir(config.server_root); 39 #if defined(__MINGW32__) || defined(_MSC_VER) 39 #if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) 40 40 lib = LoadLibraryA(path); 41 41 #else … … 51 51 52 52 void* tw_module_symbol(void* mod, const char* sym) { 53 #if defined(__MINGW32__) || defined(_MSC_VER) 53 #if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) 54 54 return GetProcAddress(mod, sym); 55 55 #else -
trunk/Server/server.c
r214 r215 16 16 #include "tw_version.h" 17 17 18 #if ndef _MSC_VER18 #if !defined(_MSC_VER) && !defined(__BORLANDC__) 19 19 #include <unistd.h> 20 20 #endif … … 33 33 #include <cm_dir.h> 34 34 35 #if defined(__MINGW32__) || defined(_MSC_VER) 35 #if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) 36 36 #ifndef NO_GETADDRINFO 37 37 #include <ws2tcpip.h> … … 84 84 int sockets[MAX_PORTS]; 85 85 86 #if defined(__MINGW32__) || defined(_MSC_VER) 86 #if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) 87 87 const char* reserved_names[] = {"CON", "PRN", "AUX", "NUL", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9"}; 88 88 #endif … … 111 111 112 112 void close_socket(int sock) { 113 #if defined(__MINGW32__) || defined(_MSC_VER) 113 #if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) 114 114 closesocket(sock); 115 115 #else … … 120 120 int tw_server_init(void) { 121 121 int i; 122 #if defined(__MINGW32__) || defined(_MSC_VER) 122 #if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) 123 123 WSADATA wsa; 124 124 WSAStartup(MAKEWORD(2, 0), &wsa); … … 135 135 int sock = socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP); 136 136 #endif 137 #if defined(__MINGW32__) || defined(_MSC_VER) 137 #if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) 138 138 if(sock == INVALID_SOCKET) 139 139 #else … … 238 238 doc = NULL; 239 239 } 240 #if def _MSC_VER240 #if defined(_MSC_VER) || defined(__BORLANDC__) 241 241 sprintf(construct, "%lu", (unsigned long)size); 242 242 #else … … 451 451 #if defined(__MINGW32__) || defined(_MSC_VER) 452 452 unsigned int WINAPI tw_server_pass(void* ptr) { 453 #elif defined(__BORLANDC__) 454 void tw_server_pass(void* ptr) { 453 455 #elif defined(__HAIKU__) 454 456 int32_t tw_server_pass(void* ptr) { … … 456 458 int tw_server_pass(void* ptr) { 457 459 #endif 458 #if defined(__HAIKU__) || defined(__MINGW32__) || defined(_PSP) || defined(__PPU__) || defined(_MSC_VER) 460 #if defined(__HAIKU__) || defined(__MINGW32__) || defined(_PSP) || defined(__PPU__) || defined(_MSC_VER) || defined(__BORLANDC__) 459 461 #define FREE_PTR 460 462 int sock = ((struct pass_entry*)ptr)->sock; … … 549 551 struct tm* btm; 550 552 strptime(req.headers[i + 1], "%a, %d %b %Y %H:%M:%S GMT", &tm); 551 #if defined(__MINGW32__) || defined(_PSP) || defined(__PPU__) || defined(__ps2sdk__) || defined(_MSC_VER) 553 #if defined(__MINGW32__) || defined(_PSP) || defined(__PPU__) || defined(__ps2sdk__) || defined(_MSC_VER) || defined(__BORLANDC__) 552 554 t = 0; 553 555 btm = localtime(&t); … … 612 614 char* rpath; 613 615 struct stat st; 616 char* slash; 614 617 cm_log("Server", "Document root is %s", vhost_entry->root == NULL ? "not set" : vhost_entry->root); 615 618 path = cm_strcat(vhost_entry->root == NULL ? "" : vhost_entry->root, req.path); 616 619 cm_log("Server", "Filesystem path is %s", path); 617 #if defined(__MINGW32__) || defined(_MSC_VER) 620 #if defined(_MSC_VER) || defined(__BORLANDC__) 621 for(i = strlen(path) - 1; i >= 0; i--){ 622 if(path[i] == '/'){ 623 path[i] = 0; 624 }else{ 625 break; 626 } 627 } 628 #endif 629 #if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) 618 630 rpath = cm_strdup(path); 619 631 for(i = strlen(rpath) - 1; i >= 0; i--) { … … 647 659 } else if(S_ISDIR(st.st_mode)) { 648 660 if(req.path[strlen(req.path) - 1] != '/') { 649 char* headers[3] = {"Location", cm_strcat(req.path, "/"), NULL}; 661 char* headers[3] = {"Location", NULL, NULL}; 662 headers[1] = cm_strcat(req.path, "/"); 650 663 cm_log("Server", "Accessing directory without the slash at the end"); 651 664 _tw_process_page(s, sock, tw_http_status(301), NULL, NULL, NULL, 0, headers, 0, 0); … … 885 898 #endif 886 899 close_socket(sock); 887 #if defined(__MINGW32__) || defined(_MSC_VER) 888 _endthread(0); 900 #if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) 901 _endthread( 902 #ifndef __BORLANDC__ 903 0 904 #endif 905 ); 889 906 #elif defined(__HAIKU__) 890 907 exit_thread(0); 891 908 #endif 909 #ifndef __BORLANDC__ 892 910 return 0; 911 #endif 893 912 } 894 913 … … 898 917 #endif 899 918 900 #if defined(__MINGW32__) || defined(__HAIKU__) || defined(_MSC_VER) 919 #if defined(__MINGW32__) || defined(__HAIKU__) || defined(_MSC_VER) || defined(__BORLANDC__) 901 920 struct thread_entry { 902 921 #ifdef __HAIKU__ … … 917 936 struct timeval tv; 918 937 #endif 919 #if defined(__MINGW32__) || defined(__HAIKU__) || defined(_MSC_VER) 938 #if defined(__MINGW32__) || defined(__HAIKU__) || defined(_MSC_VER) || defined(__BORLANDC__) 920 939 struct thread_entry threads[2048]; 921 940 for(i = 0; i < sizeof(threads) / sizeof(threads[0]); i++) { … … 948 967 #endif 949 968 if(ret == -1) { 950 #if !defined(__MINGW32__) && !defined(_MSC_VER) 969 #if !defined(__MINGW32__) && !defined(_MSC_VER) && !defined(__BORLANDC__) 951 970 cm_log("Server", "Select failure: %s", strerror(errno)); 952 971 #endif … … 972 991 socklen_t clen = sizeof(claddr); 973 992 int sock = accept(sockets[i], (struct sockaddr*)&claddr, &clen); 974 #if defined(__MINGW32__) || defined(__HAIKU__) || defined(_PSP) || defined(__PPU__) || defined(_MSC_VER) 993 #if defined(__MINGW32__) || defined(__HAIKU__) || defined(_PSP) || defined(__PPU__) || defined(_MSC_VER) || defined(__BORLANDC__) 975 994 int j; 976 995 struct pass_entry* e = malloc(sizeof(*e)); 977 996 cm_log("Server", "New connection accepted"); 978 997 e->sock = sock; 979 #if def _MSC_VER998 #if defined(_MSC_VER) || defined(__BORLANDC__) 980 999 e->ssl = config.ports[i] & (1UL << 31); 981 1000 #else … … 985 1004 e->addr = claddr; 986 1005 #endif 987 #if defined(__MINGW32__) || defined(_MSC_VER) 1006 #if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) 988 1007 _beginthread(tw_server_pass, 0, e); 989 1008 #elif defined(_PSP) || defined(__PPU__) -
trunk/Server/strptime.c
r212 r215 36 36 //__RCSID("$NetBSD: strptime.c,v 1.62 2017/08/24 01:01:09 ginsbach Exp $"); 37 37 38 #if defined(__MINGW32__) || defined(_MSC_VER) 38 #if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) 39 39 40 40 #include <ctype.h> … … 104 104 #define isleap_sum(a, b) isleap((a) % 400 + (b) % 400) 105 105 106 #if def _MSC_VER106 #if defined(_MSC_VER) || defined(__BORLANDC__) 107 107 #define tzname _tzname 108 108 #define strncasecmp _strnicmp 109 #endif 110 111 #ifdef __BORLANDC__ 112 char* cm_strdup(const char* str); 113 114 int _strnicmp(const char* _a, const char* _b, int len){ 115 char* a = cm_strdup(_a); 116 char* b = cm_strdup(_b); 117 int i; 118 char* r; 119 for(i = 0; a[i] != 0; i++){ 120 a[i] = tolower(a[i]); 121 } 122 for(i = 0; b[i] != 0; i++){ 123 b[i] = tolower(b[i]); 124 } 125 r = strncmp(a, b, len); 126 free(a); 127 free(b); 128 return r; 129 } 109 130 #endif 110 131 … … 400 421 401 422 #ifndef TIME_MAX 402 #if def _MSC_VER423 #if defined(_MSC_VER) || defined(__BORLANDC__) 403 424 #define TIME_MAX INT32_MAX 404 425 #else … … 409 430 { 410 431 time_t sse = 0; 411 #if def _MSC_VER432 #if defined(_MSC_VER) || defined(__BORLANDC__) 412 433 uint32_t rulim = TIME_MAX; 413 434 #else … … 426 447 } while ((sse * 10 <= TIME_MAX) && 427 448 rulim && *bp >= '0' && *bp <= '9'); 428 #if def _MSC_VER449 #if defined(_MSC_VER) || defined(__BORLANDC__) 429 450 if (sse < 0 || (uint32_t)sse > TIME_MAX) { 430 451 #else … … 435 456 } 436 457 #ifdef _WIN32 437 #if def _MSC_VER458 #if defined(_MSC_VER) || defined(__BORLANDC__) 438 459 if (1) 439 460 #else -
trunk/Server/tw_config.h
r212 r215 15 15 #include <stdbool.h> 16 16 17 #if defined(__MINGW32__) || defined(_MSC_VER) 17 #if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) 18 18 #include <winsock2.h> 19 19 #define NO_IPV6 … … 43 43 #define MAX_README 8 44 44 45 #if def _MSC_VER45 #if defined(_MSC_VER) || defined(__BORLANDC__) 46 46 #define NUM1024 1024UL 47 47 #else … … 95 95 96 96 struct tw_config { 97 #if def _MSC_VER97 #if defined(_MSC_VER) || defined(__BORLANDC__) 98 98 uint32_t ports[MAX_PORTS + 1]; 99 99 #else -
trunk/Server/version.c
r214 r215 18 18 #elif defined(_MSC_VER) 19 19 "Windows-MSVC" 20 #elif defined(__BORLANDC__) 21 "Windows-BCC" 20 22 #elif defined(__HAIKU__) 21 23 "Haiku" -
trunk/config.h.tmpl
r212 r215 18 18 #endif 19 19 20 #if (defined(__MINGW32__) || defined(_MSC_VER) ) && defined(USE_POLL)20 #if (defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__)) && defined(USE_POLL) 21 21 #undef USE_POLL 22 22 /* Force select(2) for Windows */ 23 23 #endif 24 24 25 #if (defined(__MINGW32__) || defined(_MSC_VER) ) && defined(HAS_CHROOT)25 #if (defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__)) && defined(HAS_CHROOT) 26 26 #undef HAS_CHROOT 27 27 /* Windows should not have chroot */ 28 28 #endif 29 29 30 #if defined(_MSC_VER) && !defined(NO_GETADDRINFO)30 #if (defined(_MSC_VER) || defined(__BORLANDC__)) && !defined(NO_GETADDRINFO) 31 31 #define NO_GETADDRINFO 32 32 /* Do not use getaddrinfo */
Note:
See TracChangeset
for help on using the changeset viewer.