- Timestamp:
- 2000-07-13T10:21:53+12:00 (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/New_Config_Format-branch/gsdl/src/w32server/cgiwrapper.cpp
r1011 r1279 1 #include "text_t.h" 2 1 3 #include <windows.h> 2 4 #include <string.h> … … 32 34 33 35 // actions 34 #include "action.h"35 36 #include "statusaction.h" 36 37 #include "pageaction.h" … … 38 39 #include "queryaction.h" 39 40 #include "documentaction.h" 41 #include "tipaction.h" 40 42 #include "authenaction.h" 41 43 #include "usersaction.h" 42 44 #include "extlinkaction.h" 43 //#include "buildaction.h"45 #include "buildaction.h" 44 46 #include "delhistoryaction.h" 45 47 46 48 // browsers 47 #include "browserclass.h"48 49 #include "vlistbrowserclass.h" 49 50 #include "hlistbrowserclass.h" … … 78 79 RequestInfoT *RInfo; 79 80 ostream *casostr; 81 #if !defined (GSDL_USE_IOS_H) 82 char buffer[256]; 83 #endif 80 84 }; 81 85 82 86 textstreambuf::textstreambuf() { 83 87 tsbreset(); 88 #if !defined (GSDL_USE_IOS_H) 89 setp (&buffer[0], &buffer[255]); 90 #else 84 91 if (base() == ebuf()) allocate(); 85 92 setp (base(), ebuf()); 93 #endif 86 94 }; 87 95 88 96 int textstreambuf::sync () { 89 97 if ((RInfo != NULL) && 90 (Send_String_N(pbase(), out_waiting(), RInfo) < 0)) {98 (Send_String_N(pbase(), pptr()-pbase(), RInfo) < 0)) { 91 99 RInfo = NULL; 92 100 } … … 94 102 if (casostr != NULL) { 95 103 char *thepbase=pbase(); 96 for (int i=0;i<out_waiting();i++) (*casostr).put(thepbase[i]);104 for (int i=0;i<(pptr()-pbase());i++) (*casostr).put(thepbase[i]); 97 105 } 98 106 … … 118 126 int overflow (int ch); 119 127 int underflow () {return EOF;} 128 129 #if !defined (GSDL_USE_IOS_H) 130 private: 131 char buffer[256]; 132 #endif 120 133 }; 121 134 122 135 logstreambuf::logstreambuf () { 136 #if !defined (GSDL_USE_IOS_H) 137 setp (&buffer[0], &buffer[255]); 138 #else 123 139 if (base() == ebuf()) allocate(); 124 140 setp (base(), ebuf()); 141 #endif 125 142 } 126 143 … … 128 145 if (gsdl_keep_log || gsdl_show_console) { 129 146 log_message ("LOCAL LIB MESSAGE: "); 130 log_message_N (pbase(), out_waiting());147 log_message_N (pbase(), pptr()-pbase()); 131 148 } 132 149 … … 154 171 DWORD lastlibaccesstime; 155 172 DWORD baseavailvirtual; 156 157 static void page_errorsitecfg (const text_t &gsdlhome, const text_t &collection) {158 159 text_t message = "Error\n\n"160 "The site.cfg configuration file could not be found. This file\n"161 "should contain configuration information relating to this sites\n"162 "setup.\n";163 164 if (collection.empty()) {165 message += "As this program is not being run in collection specific mode,\n"166 "the file should reside at " + gsdlhome + "\\etc\\site.cfg.\n";167 } else {168 message += "As this program is being run in collection specific mode,\n"169 "the file can reside at " + gsdlhome + "\\collect\\" + collection +170 "\\etc\\site.cfg or " + gsdlhome + "\\etc\\site.cfg.\n";171 }172 173 MessageBox(NULL, message.getcstr(),174 "Greenstone Digital Library Software"175 ,MB_OK|MB_SYSTEMMODAL);176 }177 173 178 174 static void page_errormaincfg (const text_t &gsdlhome, const text_t &collection) { … … 326 322 // returns 1 if successful, 0 if unsuccessful 327 323 int gsdl_init () { 324 #if defined (GSDL_USE_IOS_H) 328 325 cerr = &logstream; 329 326 cout = &textstream; 327 #else 328 cerr.rdbuf(&logstream); 329 cout.rdbuf(&textstream); 330 #endif 330 331 331 332 // collection should be set to "" unless in … … 425 426 426 427 pageaction *apageaction = new pageaction(); 428 apageaction->set_receptionist (&recpt); 427 429 recpt.add_action (apageaction); 428 430 … … 430 432 recpt.add_action (apingaction); 431 433 434 tipaction *atipaction = new tipaction(); 435 recpt.add_action (atipaction); 436 432 437 queryaction *aqueryaction = new queryaction(); 438 aqueryaction->set_receptionist (&recpt); 433 439 recpt.add_action (aqueryaction); 434 440 435 441 documentaction *adocumentaction = new documentaction(); 442 adocumentaction->set_receptionist (&recpt); 436 443 recpt.add_action (adocumentaction); 437 444 … … 442 449 recpt.add_action (anextlinkaction); 443 450 444 //buildaction *abuildaction = new buildaction();445 //abuildaction->set_receptionist (&recpt);446 //recpt.add_action (abuildaction);451 buildaction *abuildaction = new buildaction(); 452 abuildaction->set_receptionist (&recpt); 453 recpt.add_action (abuildaction); 447 454 448 455 authenaction *aauthenaction = new authenaction(); … … 450 457 recpt.add_action (aauthenaction); 451 458 452 delhistoryaction adelhistoryaction;453 recpt.add_action (&adelhistoryaction);459 delhistoryaction *adelhistoryaction = new delhistoryaction(); 460 recpt.add_action (adelhistoryaction); 454 461 455 462 … … 503 510 // those read in last will override those read earlier 504 511 // collections being used together in this way should be 505 // careful not to have site.cfg ormain.cfg files that might512 // careful not to have main.cfg files that might 506 513 // screw with each other. 507 514 text_tset::const_iterator thome = gsdlhomes.begin(); 508 515 text_tset::const_iterator ehome = gsdlhomes.end(); 509 516 while (thome != ehome) { 510 // TODO: should only need to do this once now I think511 // gsdlsite.cfg will need to be installed along with executable512 // if (!site_cfg_read (recpt, *thome, maxrequests)) {513 // couldn't find the site configuration file514 // page_errorsitecfg (*thome, collection);515 // return 0;516 // } else517 517 if (!main_cfg_read (recpt, *thome, collection)) { 518 518 // couldn't find the main configuration file
Note:
See TracChangeset
for help on using the changeset viewer.