Changeset 182 in Main
- Timestamp:
- Sep 27, 2024, 9:55:12 PM (7 weeks ago)
- Location:
- trunk
- Files:
-
- 10 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/log.c
r62 r182 12 12 #include <stdarg.h> 13 13 14 #ifdef _PSP 15 #include <pspdebug.h> 16 #endif 17 14 18 FILE* logfile; 15 19 … … 23 27 char date[513]; 24 28 strftime(date, 512, "%a %b %d %H:%M:%S %Z %Y", tm); 29 #ifdef _PSP 30 pspDebugScreenPrintf("[%s] %s\n", date, log); 31 #else 25 32 fprintf(logfile, "[%s] %s\n", date, log); 33 #endif 26 34 fflush(logfile); 27 35 } … … 69 77 } 70 78 79 #ifdef _PSP 80 pspDebugScreenPrintf("%s %s\n", namebuf, result); 81 #else 71 82 fprintf(logfile, "%s %s\n", namebuf, result); 83 #endif 72 84 va_end(args); 73 85 -
trunk/Makefile
r181 r182 4 4 PLATFORM = generic 5 5 PREFIX = /usr/local 6 MODULE = ./Module 6 7 7 8 include Platform/$(PLATFORM).mk … … 11 12 .PHONY: all format clean ./Server ./Common ./Module get-version 12 13 13 all: ./Server ./Module./Tool/genconf ./Tool/itworks14 all: ./Server $(MODULE) ./Tool/genconf ./Tool/itworks 14 15 15 16 ./Tool/option: ./Tool/option.c config.h -
trunk/Platform/psp.mk
r181 r182 1 1 # $Id$ 2 2 3 CC = cc4 AR = ar5 CFLAGS = -g -std=c99 -DPREFIX=\"$(PREFIX)\" -I $(PWD)/Common - fPIC6 LDFLAGS = 7 LIBS = 8 EXEC = 3 CC = psp-gcc 4 AR = psp-ar 5 CFLAGS = -g -std=c99 -DPREFIX=\"$(PREFIX)\" -I $(PWD)/Common -I /usr/local/pspdev/psp/sdk/include -D_PSP_FW_VERSION=600 6 LDFLAGS = -L /usr/local/pspdev/psp/sdk/lib 7 LIBS = -lpspgum -lpspgu -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspnet -lpspnet_apctl 8 EXEC = .elf 9 9 LIB = .so 10 MODULE = 11 SERVADD = psp-fixup-imports tewi.elf && psp-strip tewi.elf -o tewi_strip.elf 12 TARGET = tewi.pbp -
trunk/Server/Makefile
r128 r182 8 8 OBJS = version.o main.o config.o server.o http.o module.o strptime.o $(EXTOBJS) $(PREOBJS) 9 9 10 all: tewi$(EXEC) 10 all: tewi$(EXEC) $(TARGET) 11 12 tewi_strip$(EXEC): tewi$(EXEC) 11 13 12 14 tewi$(EXEC): $(OBJS) ../Common/common.a 13 15 $(CC) $(LDFLAGS) $(EXTLDFLAGS) -o $@ $(OBJS) $(EXTLIBS) $(LIBS) ../Common/common.a 16 $(SERVADD) 17 18 tewi.pbp: tewi_strip$(EXEC) param.sfo 19 pack-pbp $@ param.sfo NULL NULL NULL NULL NULL tewi_strip$(EXEC) NULL 20 21 param.sfo: 22 mksfoex -d MEMSIZE=1 'Tewi HTTPd' $@ 14 23 15 24 .c.o: … … 20 29 21 30 clean: 22 rm -f *.o tewi *.exe *.res 31 rm -f *.o tewi *.exe *.res *.elf *.sfo *.pbp -
trunk/Server/config.c
r178 r182 102 102 config.server_admin = cm_strdup(SERVER_ADMIN); 103 103 config.defined[0] = NULL; 104 #ifdef _PSP 105 strcpy(config.hostname, "psp"); 106 #else 104 107 gethostname(config.hostname, 1024); 108 #endif 105 109 #ifdef HAS_CHROOT 106 110 tw_add_define("HAS_CHROOT"); … … 411 415 } 412 416 } else if(cm_strcaseequ(r[0], "ReadmeFile") || cm_strcaseequ(r[0], "Readme")) { 413 if(cm_strcaseequ(r[0], "Readme")) {417 if(cm_strcaseequ(r[0], "Readme")) { 414 418 cm_force_log("NOTE: Readme directive is deprecated."); 415 419 } -
trunk/Server/main.c
r168 r182 24 24 #ifdef __MINGW32__ 25 25 #include <windows.h> 26 #endif 27 28 #ifdef _PSP 29 #include <pspkernel.h> 30 #include <pspdebug.h> 31 32 PSP_MODULE_INFO("Tewi HTTPd", PSP_MODULE_USER, 1, 1); 33 PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER); 34 35 #define printf(...) pspDebugScreenPrintf(__VA_ARGS__) 26 36 #endif 27 37 … … 83 93 StartServiceCtrlDispatcher(table); 84 94 #else 95 #ifdef _PSP 96 pspDebugScreenInit(); 97 pspDebugScreenSetXY(0, 0); 98 #endif 85 99 int st = startup(argc, argv); 86 100 if(st != -1) return st; … … 114 128 } 115 129 confpath = argv[i]; 130 #ifndef _PSP 116 131 } else if(strcmp(argv[i], "--logfile") == 0 || strcmp(argv[i], "-l") == 0) { 117 132 i++; … … 128 143 return 1; 129 144 } 145 #endif 130 146 } else if(strcmp(argv[i], "--version") == 0 || strcmp(argv[i], "-V") == 0) { 131 147 printf("Tewi HTTPd Tewi/%s\n", tw_get_version()); … … 135 151 printf("Usage: %s [--config|-C config] [--verbose|-v] [--version|-V]\n", argv[0]); 136 152 printf("--config | -C config : Specify config\n"); 153 #ifndef _PSP 137 154 printf("--logfile | -l logfile : Specify logfile\n"); 155 #endif 138 156 printf("--verbose | -v : Verbose mode\n"); 139 157 printf("--version | -V : Version information\n"); -
trunk/Server/module.c
r159 r182 14 14 #include <stdlib.h> 15 15 16 extern struct tw_config config; 17 18 #ifdef _PSP 19 void* tw_module_load(const char* path) { return NULL; } 20 21 void* tw_module_symbol(void* mod, const char* sym) { return NULL; } 22 23 int tw_module_init(void* mod) { return 1; } 24 25 #else 26 16 27 #ifdef __MINGW32__ 17 28 #include <windows.h> … … 19 30 #include <dlfcn.h> 20 31 #endif 21 22 extern struct tw_config config;23 32 24 33 void* tw_module_load(const char* path) { … … 46 55 #endif 47 56 } 57 58 int tw_module_init(void* mod) { 59 tw_mod_init_t mod_init = (tw_mod_init_t)tw_module_symbol(mod, "mod_init"); 60 if(mod_init == NULL) { 61 cm_log("Module", "Could not init a module"); 62 return 1; 63 } else { 64 struct tw_tool tools; 65 tw_init_tools(&tools); 66 return mod_init(&config, &tools); 67 } 68 } 69 #endif 48 70 49 71 void tw_add_version(const char* string) { … … 88 110 tools->add_define = tw_add_define; 89 111 } 90 91 int tw_module_init(void* mod) {92 tw_mod_init_t mod_init = (tw_mod_init_t)tw_module_symbol(mod, "mod_init");93 if(mod_init == NULL) {94 cm_log("Module", "Could not init a module");95 return 1;96 } else {97 struct tw_tool tools;98 tw_init_tools(&tools);99 return mod_init(&config, &tools);100 }101 } -
trunk/Server/server.c
r173 r182 24 24 #include <errno.h> 25 25 #include <sys/stat.h> 26 #include <sys/types.h> 26 27 #include <time.h> 27 28 … … 53 54 #include <netdb.h> 54 55 #endif 56 #endif 57 58 #ifdef _PSP 59 #include "strptime.h" 55 60 #endif 56 61 … … 507 512 struct tm tm; 508 513 strptime(req.headers[i + 1], "%a, %d %b %Y %H:%M:%S GMT", &tm); 509 #if def __MINGW32__514 #if defined(__MINGW32__) || defined(_PSP) 510 515 time_t t = 0; 511 516 struct tm* btm = localtime(&t); … … 907 912 if(cond) { 908 913 SOCKADDR claddr; 909 int clen = sizeof(claddr);914 socklen_t clen = sizeof(claddr); 910 915 int sock = accept(sockets[i], (struct sockaddr*)&claddr, &clen); 911 916 cm_log("Server", "New connection accepted"); -
trunk/Server/strptime.c
r44 r182 36 36 //__RCSID("$NetBSD: strptime.c,v 1.62 2017/08/24 01:01:09 ginsbach Exp $"); 37 37 38 #if def __MINGW32__38 #if defined(__MINGW32__) 39 39 40 40 #include <ctype.h> -
trunk/Server/strptime.h
r140 r182 8 8 #include <time.h> 9 9 10 #if def _WIN3210 #if defined(_WIN32) || defined(_PSP) 11 11 char* strptime(const char *buf, const char *fmt, struct tm *tm); 12 12 #endif -
trunk/config.h.tmpl
r173 r182 28 28 #endif 29 29 30 #if defined(_PSP) && !defined(NO_IPV6) 31 #define NO_IPV6 32 /* PSP does not have IPv6 */ 33 #endif 34 35 #if defined(_PSP) && defined(USE_POLL) 36 #undef USE_POLL 37 /* Force select(2) for PSP */ 38 #endif 39 40 #if defined(_PSP) && defined(HAS_CHROOT) 41 #undef HAS_CHROOT 42 /* PSP should not have chroot */ 43 #endif 44 45 #if defined(_PSP) && !defined(NO_GETADDRINFO) 46 #define NO_GETADDRINFO 47 /* PSP should not have getaddrinfo */ 48 #endif 49 30 50 #endif 31 51
Note:
See TracChangeset
for help on using the changeset viewer.