Changeset 1739
- Timestamp:
- 2000-12-05T13:08:17+13:00 (23 years ago)
- Location:
- trunk/gsdl
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/lib/cfgread.cpp
r1432 r1739 49 49 filein.get(c); 50 50 } 51 if (key.empty()) return -1;51 if (key.empty()) return 0; // blank line maybe? 52 52 return 0; 53 53 } -
trunk/gsdl/lib/fileutil.cpp
r1648 r1739 170 170 } 171 171 172 bool read_dir (const text_t &dirname, text_tset &filelist) { 173 174 WIN32_FIND_DATA FileData; 175 HANDLE hSearch; 176 char *dirpath = dirname.getcstr(); 177 strcat (dirpath, "\\*"); 178 179 hSearch = FindFirstFile(dirpath, &FileData); 180 // freeing this memory can cause a runtime error on some (particularly 181 // debug) versions of VC++ 182 delete dirpath; 183 184 if (hSearch == INVALID_HANDLE_VALUE) { 185 return false; 186 } 187 188 text_t filename = FileData.cFileName; 189 if (filename != "." && filename != ".." && filename != "CVS") 190 filelist.insert (filename); 191 192 while (FindNextFile(hSearch, &FileData)) { 193 filename = FileData.cFileName; 194 if (filename == "." || filename == ".." || filename == "CVS") 195 continue; 196 filelist.insert (filename); 197 } 198 199 FindClose(hSearch); 200 201 return true; 202 } 203 172 204 bool read_dir (const text_t &dirname, text_tarray &filelist) { 173 205 … … 217 249 } 218 250 251 bool read_dir (const text_t &dirname, text_tset &filelist) { 252 253 char *tmp = dirname.getcstr(); 254 DIR *dirin = opendir (tmp); 255 delete tmp; 256 257 if (dirin == NULL) return false; 258 259 dirent *dirp; 260 261 text_t filename; 262 while ((dirp = readdir (dirin)) != NULL) { 263 filename = dirp->d_name; 264 if (filename == "." || filename == ".." || filename == "CVS") 265 continue; 266 filelist.insert (filename); 267 } 268 closedir (dirin); 269 return true; 270 } 271 219 272 bool read_dir (const text_t &dirname, text_tarray &filelist) { 220 221 filelist.erase (filelist.begin(), filelist.end());222 273 223 274 char *tmp = dirname.getcstr(); -
trunk/gsdl/lib/fileutil.h
r1485 r1739 49 49 bool directory_exists (const text_t &dirname); 50 50 51 // note that read_dir appends to filelist, it doesn't clear 52 // it first 51 53 bool read_dir (const text_t &dirname, text_tarray &filelist); 54 bool read_dir (const text_t &dirname, text_tset &filelist); 52 55 53 56 bool file_copy (const text_t &fromfile, const text_t &tofile); -
trunk/gsdl/src/recpt/nullproto.h
r1679 r1739 41 41 // add_collection sets up the collectionserver and calls 42 42 // add_collectserver 43 v oid add_collection (const text_t &collection, void *recpt,44 const text_t &gsdlhome, const text_t &gdbmhome);43 virtual void add_collection (const text_t &collection, void *recpt, 44 const text_t &gsdlhome, const text_t &gdbmhome); 45 45 46 46 // add_collectserver should be called for each collection server -
trunk/gsdl/src/w32server/cgiwrapper.cpp
r1679 r1739 187 187 DWORD lastlibaccesstime; 188 188 DWORD baseavailvirtual; 189 text_t current_gsdlhome; 190 colinfo_tmap translated_collectinfo; 189 191 190 192 static void page_errormaincfg (const text_t &gsdlhome, const text_t &collection) { … … 351 353 text_t collection = ""; 352 354 text_tset gsdlhomes; 353 text_tarray collections; 354 colinfo_tmap::const_iterator this_info = gsdl_collectinfo.begin(); 355 colinfo_tmap::const_iterator end_info = gsdl_collectinfo.end(); 355 text_tset collections; 356 356 357 357 // note the current time … … 363 363 if (!checkdir (gsdl_gsdlhome + "\\macros\\")) return 0; 364 364 365 if (collection.empty()) { 366 367 // get all collections from each gsdlhome (this relies 368 // on there not being more than one collection with the same 369 // name) 370 read_dir (filename_cat (gsdl_gsdlhome, "collect"), collections); 365 // get all collections from each gsdlhome (this relies 366 // on there not being more than one collection with the same 367 // name) 368 369 if (!collection.empty()) { 370 // collection specific receptionist - one collection, one gsdlhome 371 collections.insert (collection); 371 372 gsdlhomes.insert (gsdl_gsdlhome); 373 collectioninfo_t tmp; 374 tmp.gsdl_gsdlhome = gsdl_gsdlhome; 375 tmp.gsdl_gdbmhome = gsdl_gdbmhome; 376 translated_collectinfo[collection] = tmp; 377 378 } else { 379 380 text_tset::const_iterator colhere; 381 text_tset::const_iterator colend; 382 text_tset these_collections; 383 384 // first volume gsdlhome's 385 colinfo_tmap::const_iterator this_info = gsdl_collectinfo.begin(); 386 colinfo_tmap::const_iterator end_info = gsdl_collectinfo.end(); 372 387 while (this_info != end_info) { 373 388 if (gsdlhomes.find ((*this_info).second.gsdl_gsdlhome) == gsdlhomes.end()) { 374 read_dir (filename_cat ((*this_info).second.gsdl_gsdlhome, "collect"), collections); 389 these_collections.erase (these_collections.begin(), these_collections.end()); 390 read_dir (filename_cat ((*this_info).second.gsdl_gsdlhome, "collect"), these_collections); 391 colhere = these_collections.begin(); 392 colend = these_collections.end(); 393 while (colhere != colend) { 394 if ((collections.find (*colhere)) == collections.end()) { 395 // make sure the build.cfg file is at gsdlhome (as it's possible that 396 // the collection appears at this gsdlhome only because it's gdbm 397 // file is installed here -- it's real gdbm will therefore be 398 // somewhere else). 399 text_t build_cfg = filename_cat ((*this_info).second.gsdl_gsdlhome, "collect", 400 *colhere, "index", "build.cfg"); 401 if (file_exists (build_cfg)) { 402 collections.insert (*colhere); 403 404 // since gsdl_collectinfo keys will be stuff like collection#1 405 // for a multiple volume collection we want to translate it 406 // so that the keys are the actual collection names 407 translated_collectinfo[*colhere] = (*this_info).second; 408 } 409 } 410 colhere ++; 411 } 375 412 gsdlhomes.insert ((*this_info).second.gsdl_gsdlhome); 376 413 } 377 414 this_info ++; 378 415 } 379 } else { 380 collections.push_back (collection); 381 gsdlhomes.insert (gsdl_gsdlhome); 382 } 383 384 text_tarray::const_iterator thiscol = collections.begin(); 385 text_tarray::const_iterator endcol = collections.end(); 416 417 // then if necessary the main gsdlhome (this should only happen if the 418 // gsdl.ini is a little screwed up and no volume gsdlhomes occurred 419 if (gsdlhomes.find (gsdl_gsdlhome) == gsdlhomes.end()) { 420 these_collections.erase (these_collections.begin(), these_collections.end()); 421 read_dir (filename_cat (gsdl_gsdlhome, "collect"), these_collections); 422 colhere = these_collections.begin(); 423 colend = these_collections.end(); 424 while (colhere != colend) { 425 collections.insert (*colhere); 426 collectioninfo_t tmp; 427 tmp.gsdl_gsdlhome = gsdl_gsdlhome; 428 tmp.gsdl_gdbmhome = gsdl_gdbmhome; 429 translated_collectinfo[*colhere] = tmp; 430 colhere ++; 431 } 432 gsdlhomes.insert (gsdl_gsdlhome); 433 } 434 } 435 436 text_tset::const_iterator thiscol = collections.begin(); 437 text_tset::const_iterator endcol = collections.end(); 386 438 387 439 while (thiscol != endcol) { … … 394 446 395 447 // create collection server and add to null protocol 396 nproto.add_collection (*thiscol, &recpt, gsdl_gsdlhome, gsdl_gsdlhome); 448 text_t this_gsdlhome = gsdl_gsdlhome; 449 text_t this_gdbmhome = gsdl_gdbmhome; 450 colinfo_tmap::const_iterator it = translated_collectinfo.find (*thiscol); 451 assert (it != translated_collectinfo.end()); 452 this_gsdlhome = (*it).second.gsdl_gsdlhome; 453 this_gdbmhome = (*it).second.gsdl_gdbmhome; 454 455 nproto.add_collection (*thiscol, &recpt, this_gsdlhome, this_gdbmhome); 397 456 398 457 thiscol ++; … … 479 538 480 539 int maxrequests = 1; 481 text_tset seenhomes; 482 this_info = gsdl_collectinfo.begin(); 483 484 // configure any collections with gsdlhome (or gdbmhome) 540 541 // configure collections (and receptionist) with collectinfo stuff 485 542 // different from the default 543 colinfo_tmap::const_iterator this_info = translated_collectinfo.begin(); 544 colinfo_tmap::const_iterator end_info = translated_collectinfo.end(); 545 486 546 while (this_info != end_info) { 487 if (((*this_info).second.gsdl_gsdlhome != gsdl_gsdlhome) || 488 ((*this_info).second.gsdl_gdbmhome != gsdl_gdbmhome) && 489 (seenhomes.find ((*this_info).second.gsdl_gsdlhome + 490 (*this_info).second.gsdl_gdbmhome) == seenhomes.end())) { 491 text_tarray tmpconf; 492 tmpconf.push_back ((*this_info).first); 493 tmpconf.push_back ((*this_info).second.gsdl_gsdlhome); 494 tmpconf.push_back ((*this_info).second.gsdl_gdbmhome); 495 recpt.configure ("collectinfo", tmpconf); 496 seenhomes.insert ((*this_info).second.gsdl_gsdlhome + 497 (*this_info).second.gsdl_gdbmhome); 498 } 547 text_tarray tmpconf; 548 tmpconf.push_back ((*this_info).first); 549 tmpconf.push_back ((*this_info).second.gsdl_gsdlhome); 550 tmpconf.push_back ((*this_info).second.gsdl_gdbmhome); 551 recpt.configure ("collectinfo", tmpconf); 499 552 this_info ++; 500 553 } … … 563 616 564 617 // set up file name 565 text_t filenamet = text_t(gsdl_gsdlhome) + filename; 566 text_t::iterator here = filenamet.begin(); 567 text_t::iterator end = filenamet.end(); 568 while (here != end) { 569 if (*here == '/') *here = '\\'; 570 here ++; 571 } 572 618 text_t filenamet = filename_cat (current_gsdlhome, filename); 573 619 filename = filenamet.getcstr(); 574 620 … … 613 659 return; 614 660 } 615 661 662 colinfo_tmap::const_iterator it = translated_collectinfo.find (args["c"]); 663 if (it != translated_collectinfo.end()) { 664 current_gsdlhome = (*it).second.gsdl_gsdlhome; 665 } else { 666 current_gsdlhome = gsdl_gsdlhome; 667 } 668 616 669 // produce cgi header 617 670 response_t response; -
trunk/gsdl/src/w32server/cgiwrapper.h
r1284 r1739 34 34 extern int libaccessnum; 35 35 36 //void configure_httpprefix ();37 38 36 int ExamineURIStr(char *URIStr,RequestInfoT *RequestInfo, 39 37 RequestFieldsT *RequestFields); -
trunk/gsdl/src/w32server/settings.cpp
r1203 r1739 376 376 if (conf) { 377 377 while (read_ini_line(conf, key, value) >= 0) { 378 if (key.empty()) continue; 378 379 if (value.empty()) { 379 380 // should be a section title
Note:
See TracChangeset
for help on using the changeset viewer.