Changeset 182 in Main for trunk/Server
- Timestamp:
- Sep 27, 2024, 9:55:12 PM (7 weeks ago)
- Location:
- trunk/Server
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note:
See TracChangeset
for help on using the changeset viewer.