Ignore:
Timestamp:
2000-07-13T10:21:53+12:00 (24 years ago)
Author:
sjboddie
Message:

merged changes to trunk into New_Config_Format branch

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
    13#include <windows.h>
    24#include <string.h>
     
    3234
    3335// actions
    34 #include "action.h"
    3536#include "statusaction.h"
    3637#include "pageaction.h"
     
    3839#include "queryaction.h"
    3940#include "documentaction.h"
     41#include "tipaction.h"
    4042#include "authenaction.h"
    4143#include "usersaction.h"
    4244#include "extlinkaction.h"
    43 //#include "buildaction.h"
     45#include "buildaction.h"
    4446#include "delhistoryaction.h"
    4547
    4648// browsers
    47 #include "browserclass.h"
    4849#include "vlistbrowserclass.h"
    4950#include "hlistbrowserclass.h"
     
    7879  RequestInfoT *RInfo;
    7980  ostream *casostr;
     81#if !defined (GSDL_USE_IOS_H)
     82  char buffer[256];
     83#endif
    8084};
    8185
    8286textstreambuf::textstreambuf() {
    8387  tsbreset();
     88#if !defined (GSDL_USE_IOS_H)
     89  setp (&buffer[0], &buffer[255]);
     90#else
    8491  if (base() == ebuf()) allocate();
    8592  setp (base(), ebuf());
     93#endif
    8694};
    8795
    8896int textstreambuf::sync () {
    8997  if ((RInfo != NULL) &&
    90       (Send_String_N(pbase(), out_waiting(), RInfo) < 0)) {
     98      (Send_String_N(pbase(), pptr()-pbase(), RInfo) < 0)) {
    9199    RInfo = NULL;
    92100  }
     
    94102  if (casostr != NULL) {
    95103    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]);
    97105  }
    98106 
     
    118126  int overflow (int ch);
    119127  int underflow () {return EOF;}
     128
     129#if !defined (GSDL_USE_IOS_H)
     130private:
     131  char buffer[256];
     132#endif
    120133};
    121134
    122135logstreambuf::logstreambuf () {
     136#if !defined (GSDL_USE_IOS_H)
     137  setp (&buffer[0], &buffer[255]);
     138#else
    123139  if (base() == ebuf()) allocate();
    124140  setp (base(), ebuf());
     141#endif
    125142}
    126143
     
    128145  if (gsdl_keep_log || gsdl_show_console) {
    129146    log_message ("LOCAL LIB MESSAGE: ");
    130         log_message_N (pbase(), out_waiting());
     147        log_message_N (pbase(), pptr()-pbase());
    131148  }
    132149
     
    154171DWORD lastlibaccesstime;
    155172DWORD 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 }
    177173
    178174static void page_errormaincfg (const text_t &gsdlhome, const text_t &collection) {
     
    326322// returns 1 if successful, 0 if unsuccessful
    327323int gsdl_init () {
     324#if defined (GSDL_USE_IOS_H)
    328325  cerr = &logstream;
    329326  cout = &textstream;
     327#else
     328  cerr.rdbuf(&logstream);
     329  cout.rdbuf(&textstream);
     330#endif
    330331
    331332  // collection should be set to "" unless in
     
    425426 
    426427  pageaction *apageaction = new pageaction();
     428  apageaction->set_receptionist (&recpt);
    427429  recpt.add_action (apageaction);
    428430 
     
    430432  recpt.add_action (apingaction);
    431433 
     434  tipaction *atipaction = new tipaction();
     435  recpt.add_action (atipaction);
     436 
    432437  queryaction *aqueryaction = new queryaction();
     438  aqueryaction->set_receptionist (&recpt);
    433439  recpt.add_action (aqueryaction);
    434440 
    435441  documentaction *adocumentaction = new documentaction();
     442  adocumentaction->set_receptionist (&recpt);
    436443  recpt.add_action (adocumentaction);
    437444 
     
    442449  recpt.add_action (anextlinkaction);
    443450
    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);
    447454 
    448455  authenaction *aauthenaction = new authenaction();
     
    450457  recpt.add_action (aauthenaction);
    451458
    452   delhistoryaction adelhistoryaction;
    453   recpt.add_action(&adelhistoryaction);
     459  delhistoryaction *adelhistoryaction = new delhistoryaction();
     460  recpt.add_action (adelhistoryaction);
    454461
    455462
     
    503510  // those read in last will override those read earlier
    504511  // collections being used together in this way should be
    505   // careful not to have site.cfg or main.cfg files that might
     512  // careful not to have main.cfg files that might
    506513  // screw with each other.
    507514  text_tset::const_iterator thome = gsdlhomes.begin();
    508515  text_tset::const_iterator ehome = gsdlhomes.end();
    509516  while (thome != ehome) {
    510     // TODO: should only need to do this once now I think
    511     // gsdlsite.cfg will need to be installed along with executable
    512     //    if (!site_cfg_read (recpt, *thome, maxrequests)) {
    513       // couldn't find the site configuration file
    514     //      page_errorsitecfg (*thome, collection);
    515     //      return 0;
    516     //    } else
    517517    if (!main_cfg_read (recpt, *thome, collection)) {
    518518      // couldn't find the main configuration file
Note: See TracChangeset for help on using the changeset viewer.