Changeset 212 in Main for trunk/Server/config.c
- Timestamp:
- Oct 3, 2024, 2:44:55 AM (6 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Server/config.c
r189 r212 10 10 #include <stdlib.h> 11 11 #include <string.h> 12 13 #ifndef _MSC_VER 12 14 #include <unistd.h> 13 14 #ifdef __MINGW32__ 15 #endif 16 17 #if defined(__MINGW32__) || defined(_MSC_VER) 15 18 #include <winsock2.h> 16 19 #endif … … 38 41 again: 39 42 for(i = 0; i < vhost->dir_count; i++) { 43 char* noslash; 40 44 struct tw_dir_entry* e = &vhost->dirs[i]; 41 45 pathstart = false; 42 46 if(strlen(path) >= strlen(e->dir)) { 47 int j; 43 48 pathstart = true; 44 int j;45 49 for(j = 0; path[j] != 0 && e->dir[j] != 0; j++) { 46 50 if(path[j] != e->dir[j]) { … … 50 54 } 51 55 } 52 char*noslash = cm_strdup(e->dir);56 noslash = cm_strdup(e->dir); 53 57 noslash[strlen(noslash) - 1] = 0; 54 58 if(strcmp(e->dir, path) == 0 || strcmp(noslash, path) == 0 || pathstart) { … … 120 124 121 125 int tw_config_read(const char* path) { 122 cm_log("Config", "Reading %s", path);123 126 char cbuf[2]; 124 cbuf[1] = 0;125 127 int ln = 0; 126 128 int ifbr = 0; 127 129 int ignore = -1; 128 FILE* f = fopen(path, "r"); 130 FILE* f; 131 cm_log("Config", "Reading %s", path); 132 f = fopen(path, "r"); 133 cbuf[1] = 0; 129 134 if(f != NULL) { 130 135 char* line = malloc(1); 131 line[0] = 0;132 136 int stop = 0; 133 137 struct tw_config_entry* current = &config.root; 134 138 char* vhost = NULL; 135 139 char* dir = NULL; 140 line[0] = 0; 136 141 while(stop == 0) { 137 142 int c = fread(cbuf, 1, 1, f); 138 143 if(cbuf[0] == '\n' || c <= 0) { 144 char* l = cm_trim(line); 139 145 ln++; 140 char* l = cm_trim(line);141 146 if(strlen(l) > 0 && l[0] != '#') { 142 147 char** r = cm_split(l, " \t"); … … 227 232 stop = 1; 228 233 } else { 234 int i; 229 235 vhost = cm_strdup(r[1]); 230 236 current = &config.vhosts[config.vhost_count++]; … … 235 241 current->readme_count = 0; 236 242 current->hideport = -1; 237 int i;238 243 current->name = cm_strdup(vhost); 239 244 current->port = -1; … … 262 267 ) { 263 268 for(i = 1; r[i] != NULL; i++) { 269 #ifdef _MSC_VER 270 uint32_t port = atoi(r[i]); 271 #else 264 272 uint64_t port = atoi(r[i]); 273 #endif 274 int j; 265 275 cm_log("Config", "Going to listen at port %d%s", (int)port, cm_strcaseequ(r[0], "ListenSSL") ? " with SSL" : ""); 266 if(cm_strcaseequ(r[0], "ListenSSL")) port |= (1ULL << 32); 267 int j; 276 #ifdef _MSC_VER 277 if(cm_strcaseequ(r[0], "ListenSSL")) port |= (1UL << 31); 278 #else 279 if(cm_strcaseequ(r[0], "ListenSSL")) port |= (1ULL << 31); 280 #endif 268 281 for(j = 0; config.ports[j] != -1; j++) 269 282 ; … … 319 332 cm_log("Config", "Missing condition type at line %d", ln); 320 333 } else { 334 bool ign = false; 321 335 ifbr++; 322 bool ign = false;323 336 if(cm_strcaseequ(r[1], "False")) { 324 337 ign = true; … … 429 442 if(r[0] != NULL) { 430 443 int argc; 444 int i; 445 bool called = false; 446 struct tw_tool tools; 431 447 for(argc = 0; r[argc] != NULL; argc++) 432 448 ; 433 449 stop = 0; 434 int i;435 bool called = false;436 struct tw_tool tools;437 450 tw_init_tools(&tools); 438 451 for(i = 0; i < config.module_count; i++) {
Note:
See TracChangeset
for help on using the changeset viewer.