Changeset 963


Ignore:
Timestamp:
2000-02-22T11:01:02+13:00 (24 years ago)
Author:
sjboddie
Message:

gsdlhome now comes from gsdlsite.cfg

Location:
trunk/gsdl/src/recpt
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/recpt/buildaction.cpp

    r822 r963  
    3030#include "htmlutils.h"
    3131#include "buildaction.h"
    32 #include "gsdlhome.h"
    3332
    3433///////////////
     
    103102    logout << "The page action does not contain information\n"
    104103           << "about any receptionists. The method set_receptionist\n"
    105            <<   "was probably not called from the module which instantiated\n"
    106            <<   "this page action.\n";
     104           << "was probably not called from the module which instantiated\n"
     105           << "this page action.\n";
    107106    return;
    108107  }
     
    111110  if (rprotolist == NULL) return;
    112111 
    113   const recptconf &rcinfo = recpt->get_configinfo ();
    114 
    115112  // build up javascript and HTML code useful in web forms
    116113  text_t first_dirname = "";
     
    193190        // check to see if the "collection" is writable
    194191        text_t cfg_fname
    195           = filename_cat(GSDL_GSDLHOME,"collect",*collist_here,"etc","collect.cfg");
     192          = filename_cat(gsdlhome, "collect", *collist_here, "etc", "collect.cfg");
    196193        if (!file_writable(cfg_fname))
    197194          {
     
    276273  // set macro cfgperm based on whether config file can be read or no
    277274  text_t dirname = (args["bc1dirname"] == "") ? first_dirname : args["bc1dirname"];
    278   text_t cfg_fname = filename_cat(rcinfo.gsdlhome,"collect",dirname,"etc","collect.cfg");
     275  text_t cfg_fname = filename_cat(gsdlhome, "collect", dirname, "etc", "collect.cfg");
    279276  text_t cfgperm = (file_writable(cfg_fname)) ? "read/write" : "readonly";
    280277  disp.setmacro("cfgperm","build",cfgperm);
     
    288285      // read in collect.cfg     
    289286      text_t cfg_fname
    290     = filename_cat(GSDL_GSDLHOME,"collect",dirname,"etc","collect.cfg");
     287    = filename_cat(gsdlhome, "collect", dirname, "etc", "collect.cfg");
    291288      ifstream cfg_ifs (cfg_fname.getcstr(), ios::in | ios::nocreate);
    292289      if (cfg_ifs)
     
    323320
    324321      // read in collect.bld
    325       text_t bld_fname = filename_cat(rcinfo.gsdlhome,"log",dirname+".bld");
     322      text_t bld_fname = filename_cat(gsdlhome, "log", dirname+ ".bld");
    326323      ifstream bld_ifs (bld_fname.getcstr(), ios::in | ios::nocreate);
    327324      if (bld_ifs)
     
    356353                 ostream &logout) {
    357354
     355  // make sure we know about a receptionist
     356  if (recpt == NULL) {
     357    logout << "The page action does not contain information\n"
     358           << "about any receptionists. The method set_receptionist\n"
     359           << "was probably not called from the module which instantiated\n"
     360           << "this page action.\n";
     361    return false;
     362  }
    358363
    359364  if (args["bca"] == "newcol") {
     
    419424                   outconvertclass &outconvert, ostream &textout,
    420425                   ostream &logout) {
     426
     427
    421428
    422429
     
    448455 
    449456      textout << outconvert << disp << headmess << content << "_build:framefooter_\n";
    450 
    451       text_t cmd = filename_cat(GSDL_GSDLHOME,"cgi-bin","webpage_buildcol.pl");
     457      text_t cmd = filename_cat(gsdlhome, "cgi-bin", "webpage_buildcol.pl");
    452458      cmd += " gsdlhome=\""+args["gsdlhome"]+"\" httpbuild=\""+args["httpbuild"]+"\"";
    453459      cmd += " bc1copydata=\""+args["bc1copydata"]+"\"";
  • trunk/gsdl/src/recpt/cgiwrapper.cpp

    r872 r963  
    2828/*
    2929   $Log$
     30   Revision 1.22  2000/02/21 21:56:46  sjboddie
     31   gsdlhome now comes from gsdlsite.cfg
     32
    3033   Revision 1.21  2000/01/25 22:45:59  sjboddie
    3134   few changes to get fastcgi to work properly
     
    120123#include "cgiwrapper.h"
    121124#include "recptconfig.h"
     125#include "fileutil.h"
    122126#include <stdlib.h>
    123127#include <assert.h>
    124 
    125 
    126 // get GSDL_GSDLHOME
    127 #include "gsdlhome.h"
    128 
    129128
    130129#if defined(GSDL_USE_OBJECTSPACE)
     
    193192
    194193
    195 static void page_errorsitecfg (const text_t &gsdlhome, const text_t &collection,
    196                    text_t &errorpage) {
     194static void page_errorsitecfg (text_t &errorpage, int mode) {
    197195  errorpage += "Content-type: text/html\n\n";
    198196
     
    203201  errorpage += "<body>\n";
    204202  errorpage += "<h2>Oops!</h2>\n";
    205   errorpage += "The site.cfg configuration file could not be found. This file\n";
    206   errorpage += "should contain configuration information relating to this\n";
    207   errorpage += "site's setup. ";
    208   if (collection.empty()) {
    209     errorpage += "As this cgi script is not being run in collection specific mode,\n";
    210     errorpage += "the file should reside at ";
    211     errorpage += gsdlhome;
    212     errorpage += "/etc/site.cfg.\n";
    213   } else {
    214     errorpage += "As this cgi script is being run in collection specific mode,\n";
    215     errorpage += "the file can reside in ";
    216     errorpage += gsdlhome;
    217     errorpage += "/collect/";
    218     errorpage += collection;
    219     errorpage += "/etc/site.cfg or ";
    220     errorpage += gsdlhome;
    221     errorpage += "/etc/site.cfg.\n";
     203  if (mode == 0) {
     204    errorpage += "The gsdlsite.cfg configuration file could not be found. This file\n";
     205    errorpage += "should contain configuration information relating to this\n";
     206    errorpage += "site's setup.\n";
     207    errorpage += "gsdlsite.cfg should reside in the same directory as this executable\n";
     208  } else if (mode == 1) {
     209    errorpage += "The gsdlsite.cfg configuration file does not contain a valid gsdlhome\n";
     210    errorpage += "entry.\n";
     211    errorpage += "gsdlsite.cfg resides in the same directory as this executable\n";
    222212  }
    223213  errorpage += "</body>\n";
     
    237227  errorpage += "<h2>Oops!</h2>\n";
    238228  if (collection.empty()) {
     229    text_t main_cfg_file = filename_cat (gsdlhome, "etc", "main.cfg");
    239230    errorpage += "The main.cfg configuration file could not be found. This file\n";
    240231    errorpage += "should contain configuration information relating to the\n";
    241232    errorpage += "setup of the interface. As this cgi script is not being run\n";
    242233    errorpage += "in collection specific mode the file should reside at\n";
    243     errorpage += gsdlhome;
    244     errorpage += "/etc/main.cfg.\n";
     234    errorpage += main_cfg_file + ".\n";
    245235  } else {
    246     errorpage += "Neither the collect.cfg or main.cfg configuration files could\n";
     236    text_t collect_cfg_file = filename_cat (gsdlhome, "collect", collection, "etc", "collect.cfg");
     237    text_t main_collect_cfg_file = filename_cat (gsdlhome, "etc", "collect.cfg");
     238    text_t main_cfg_file = filename_cat (gsdlhome, "etc", "main.cfg");
     239    errorpage += "Either the collect.cfg or main.cfg configuration file could\n";
    247240    errorpage += "not be found. This file should contain configuration information\n";
    248241    errorpage += "relating to the setup of the interface. As this cgi script is\n";
    249242    errorpage += "being run in collection specific mode the file should reside\n";
    250243    errorpage += "at either ";
    251     errorpage += gsdlhome;
    252     errorpage += "/collect/";
    253     errorpage += collection;
    254     errorpage += "/etc/collect.cfg, ";
    255     errorpage += gsdlhome;
    256     errorpage += "/etc/collect.cfg or ";
    257     errorpage += gsdlhome;
    258     errorpage += "/etc/main.cfg.\n";
     244    errorpage += collect_cfg_file + ",\n";
     245    errorpage += main_collect_cfg_file + " or " + main_cfg_file + ".\n";
    259246  }
    260247  errorpage += "</body>\n";
     
    263250
    264251
    265 static void page_errorinit (const text_t &/*gsdlhome*/, text_t &errorpage) {
     252static void page_errorinit (const text_t &gsdlhome, text_t &errorpage) {
    266253  errorpage += "Content-type: text/html\n\n";
    267254
     
    276263  errorpage += "correctly.\n";
    277264
    278   ifstream initin (GSDL_GSDLHOME "/etc/initout.txt");
     265  text_t init_file = filename_cat (gsdlhome, "etc", "initout.txt");
     266  char *ifile = init_file.getcstr();
     267  ifstream initin (ifile);
     268  delete ifile;
    279269  if (initin) {
    280     errorpage += "The initialisation error log, " GSDL_GSDLHOME "/etc/initout.txt, contains the\n";
     270    errorpage += "The initialisation error log, " + init_file + ", contains the\n";
    281271    errorpage += "following information:\n\n";
    282272    errorpage += "<pre>\n";
     
    294284
    295285  } else {
    296     errorpage += "Please consult " GSDL_GSDLHOME "/etc/initout.txt for more information.\n";
     286    errorpage += "Please consult " + init_file + " for more information.\n";
    297287  }
    298288
     
    301291}
    302292
    303 static void page_errorparseargs (const text_t &/*gsdlhome*/, text_t &errorpage) {
     293static void page_errorparseargs (const text_t &gsdlhome, text_t &errorpage) {
    304294  errorpage += "Content-type: text/html\n\n";
    305295
     
    312302  errorpage += "An error occurred during the parsing of the cgi arguments.\n";
    313303
    314   ifstream errin (GSDL_GSDLHOME "/etc/errout.txt");
     304  text_t error_file = filename_cat (gsdlhome, "etc", "errout.txt");
     305  char *efile = error_file.getcstr();
     306  ifstream errin (efile);
     307  delete efile;
    315308  if (errin) {
    316     errorpage += "The error log, " GSDL_GSDLHOME "/etc/errout.txt, contains the\n";
     309    errorpage += "The error log, " + error_file + ", contains the\n";
    317310    errorpage += "following information:\n\n";
    318311    errorpage += "<pre>\n";
     
    328321
    329322  } else {
    330     errorpage += "Please consult " GSDL_GSDLHOME "/etc/errout.txt for more information.\n";
     323    errorpage += "Please consult " + error_file + " for more information.\n";
    331324  }
    332325
     
    335328}
    336329
    337 static void page_errorcgipage (const text_t &/*gsdlhome*/, text_t &errorpage) {
     330static void page_errorcgipage (const text_t &gsdlhome, text_t &errorpage) {
    338331  errorpage += "Content-type: text/html\n\n";
    339332
     
    346339  errorpage += "An error occurred during the construction of the cgi page.\n";
    347340
    348   ifstream errin (GSDL_GSDLHOME "/etc/errout.txt");
     341
     342  text_t error_file = filename_cat (gsdlhome, "etc", "errout.txt");
     343  char *efile = error_file.getcstr();
     344  ifstream errin (efile);
     345  delete efile;
    349346  if (errin) {
    350     errorpage += "The error log, " GSDL_GSDLHOME "/etc/errout.txt, contains the\n";
     347    errorpage += "The error log, " + error_file + ", contains the\n";
    351348    errorpage += "following information:\n\n";
    352349    errorpage += "<pre>\n";
     
    362359
    363360  } else {
    364     errorpage += "Please consult " GSDL_GSDLHOME "/etc/errout.txt for more information.\n";
     361    errorpage += "Please consult " + error_file + " for more information.\n";
    365362  }
    366363
     
    386383  // set defaults
    387384  int maxrequests = 10000;
    388   recpt.configure ("gsdlhome", GSDL_GSDLHOME);
    389385  recpt.configure ("collection", collection);
    390386  recpt.configure ("httpimg", "/gsdl/images");
     
    394390
    395391  // read in the configuration files.
    396   if (!site_cfg_read (recpt, GSDL_GSDLHOME, collection, maxrequests)) {
     392  text_t gsdlhome;
     393  if (!site_cfg_read (recpt, gsdlhome, maxrequests)) {
    397394    // couldn't find the site configuration file
    398     page_errorsitecfg (GSDL_GSDLHOME, collection, errorpage);
    399   } else if (!main_cfg_read (recpt, GSDL_GSDLHOME, collection)) {
     395    page_errorsitecfg (errorpage, 0);
     396  } else if (gsdlhome.empty()) {
     397    // no gsdlhome in gsdlsite.cfg
     398    page_errorsitecfg (errorpage, 1);
     399  } else if (!main_cfg_read (recpt, gsdlhome, collection)) {
    400400    // couldn't find the main configuration file
    401     page_errormaincfg (GSDL_GSDLHOME, collection, errorpage);
     401    page_errormaincfg (gsdlhome, collection, errorpage);
    402402  }
    403403
    404404  // initialise the library software
    405405  if (errorpage.empty()) {
    406     ofstream initout (GSDL_GSDLHOME "/etc/initout.txt");
     406    text_t init_file = filename_cat (gsdlhome, "etc", "initout.txt");
     407    char *iout = init_file.getcstr();
     408    ofstream initout (iout);
     409    delete iout;
    407410    if (!recpt.init(initout)) {
    408411      // an error occurred during the initialisation
    409412      initout.close();
    410       page_errorinit(GSDL_GSDLHOME, errorpage);
     413      page_errorinit(gsdlhome, errorpage);
    411414    }
    412415    initout.close();
     
    523526
    524527    if (errorpage.empty()) {
    525       ofstream errout (GSDL_GSDLHOME "/etc/errout.txt");
     528      text_t error_file = filename_cat (gsdlhome, "etc", "errout.txt");
     529      char *eout = error_file.getcstr();
     530      ofstream errout (eout);
     531      delete eout;
    526532      cerr = errout;
    527533   
     
    530536      if (!recpt.parse_cgi_args (argstr, args, errout, fastcgienv)) {
    531537    errout.close ();
    532     page_errorparseargs(GSDL_GSDLHOME, errorpage);
     538    page_errorparseargs(gsdlhome, errorpage);
    533539      } else {
    534540    if (!recpt.produce_cgi_page (args, pageout, errout, fastcgienv)) {
    535541      errout.close ();
    536       page_errorcgipage(GSDL_GSDLHOME, errorpage);
     542      page_errorcgipage(gsdlhome, errorpage);
    537543    } else {
    538544      errout.close ();
  • trunk/gsdl/src/recpt/historydb.cpp

    r939 r963  
    2828/*
    2929  $Log$
     30  Revision 1.3  2000/02/21 22:01:02  sjboddie
     31  gsdlhome now comes from gsdlsite.cfg
     32
    3033  Revision 1.2  2000/02/17 02:40:21  sjboddie
    3134  tidied up a bit - fixed a bug (gdbm file wasn't always being closed properly)
     
    3538
    3639#include "historydb.h"
    37 #include "gsdlhome.h"
    3840#include "fileutil.h"
    3941#include "cgiutils.h"
     
    4446// returns true on success (in which case historyinfo will contain
    4547// the information for this history)
    46 bool get_history_info (const text_t &userid, text_tarray &historyinfo, ostream &logout) {
    47 
    48   text_t historyfile = filename_cat(GSDL_GSDLHOME, "etc", "history.db");
     48bool get_history_info (const text_t &userid, text_tarray &historyinfo,
     49               const text_t &gsdlhome, ostream &logout) {
     50
     51  text_t historyfile = filename_cat(gsdlhome, "etc", "history.db");
    4952 
    5053  bool result = false;
     
    7477
    7578// returns true on success
    76 bool set_history_info (const text_t &userid, const text_t &history) {
    77 
    78   text_t historyfile = filename_cat(GSDL_GSDLHOME, "etc", "history.db");
     79bool set_history_info (const text_t &userid, const text_t &history, const text_t &gsdlhome) {
     80
     81  text_t historyfile = filename_cat(gsdlhome, "etc", "history.db");
    7982 
    8083  bool result = false;
     
    126129
    127130// deletes all a users history
    128 bool delete_all_history_info (const text_t &userid) {
    129 
    130   text_t historyfile = filename_cat(GSDL_GSDLHOME, "etc", "history.db");
     131bool delete_all_history_info (const text_t &userid, const text_t &gsdlhome) {
     132
     133  text_t historyfile = filename_cat(gsdlhome, "etc", "history.db");
    131134 
    132135  // open the history database 
     
    142145
    143146//deletes only the selected records
    144 bool delete_history_info(const text_t &userid, const text_t &deletemode, const text_t &selection) {
    145 
    146   text_t historyfile = filename_cat(GSDL_GSDLHOME, "etc", "history.db");
     147bool delete_history_info (const text_t &userid, const text_t &deletemode,
     148              const text_t &selection, const text_t &gsdlhome) {
     149
     150  text_t historyfile = filename_cat(gsdlhome, "etc", "history.db");
    147151  bool result;
    148152  // open the history database 
     
    305309// replaces a reference to a previous query with the search
    306310// string from that query
    307 bool combine_query(text_t &userid, text_t &query)
     311bool combine_query(text_t &userid, text_t &query, const text_t &gsdlhome)
    308312{
    309313  text_t::iterator begin = query.begin();
     
    314318 
    315319  text_t queryresult = "";
    316   text_t historyfile = filename_cat(GSDL_GSDLHOME, "etc", "history.db");
     320  text_t historyfile = filename_cat(gsdlhome, "etc", "history.db");
    317321  text_t historyresult;
    318322  // open the history database 
  • trunk/gsdl/src/recpt/historydb.h

    r939 r963  
    5151// returns true on success (in which case historyinfo will contain
    5252// the information for this history)
    53 bool get_history_info ( const text_t &userid, text_tarray &historyinfo, ostream &logout);
     53bool get_history_info (const text_t &userid, text_tarray &historyinfo,
     54               const text_t &gsdlhome, ostream &logout);
    5455
    5556// returns true on success
    56 bool set_history_info (const text_t &userid, const text_t &historyinfo);
     57bool set_history_info (const text_t &userid, const text_t &historyinfo,
     58               const text_t &gsdlhome);
    5759
    58 bool delete_all_history_info (const text_t &userid);
     60bool delete_all_history_info (const text_t &userid, const text_t &gsdlhome);
    5961
    6062// deletes only the entries specified
    6163bool delete_history_info(const text_t &userid, const text_t &deletemode,
    62              const text_t &selection);
     64             const text_t &selection, const text_t &gsdlhome);
    6365
    6466// takes a text_t with x-y, and retrieves the x and y params
     
    7274// second version looks it up inthe records map (used in
    7375// delete history -are doing a lotof #x replacing at once.
    74 bool combine_query(text_t &userid, text_t &query);
     76bool combine_query(text_t &userid, text_t &query, const text_t &gsdlhome);
    7577bool combine_query(text_t &userid, HistRecordmap  &records);
    7678
  • trunk/gsdl/src/recpt/librarymain.cpp

    r937 r963  
    2828/*
    2929   $Log$
     30   Revision 1.23  2000/02/21 21:59:37  sjboddie
     31   gsdlhome now comes from gsdlsite.cfg
     32
    3033   Revision 1.22  2000/02/17 02:35:48  sjboddie
    3134   tidied up a bit
     
    138141#include "htmlbrowserclass.h"
    139142
    140 #include "gsdlhome.h"
     143#include "recptconfig.h"
    141144
    142145int main () {
    143146  receptionist recpt;
    144147  nullproto nproto;
    145 
    146148  text_tarray collections;
    147   if (!read_dir (GSDL_GSDLHOME "/collect", collections)) exit (1);
     149
     150  // get gsdlhome (if we fail the error will be picked up later -- in
     151  // cgiwrapper)
     152  text_t gsdlhome;
     153  if (site_cfg_read (gsdlhome)) {
     154    text_t collectdir = filename_cat (gsdlhome, "collect");
     155    if (!read_dir (collectdir, collections)) exit (1);
     156  }
    148157
    149158  text_tarray::const_iterator thiscol = collections.begin();
    150159  text_tarray::const_iterator endcol = collections.end();
    151 
     160 
    152161  while (thiscol != endcol) {
    153 
     162   
    154163    // ignore the modelcol
    155     if (*thiscol == "modelcol") {
    156       thiscol ++;
    157       continue;
    158     }
    159 
     164    if (*thiscol == "modelcol") {thiscol ++; continue;}
     165   
    160166    // this memory is created but never destroyed
    161167    // we're also not doing any error checking to make sure we didn't
     
    168174    filterclass *filter = new filterclass ();
    169175    cserver->add_filter (filter);
    170    
     176     
    171177    // add a browse filter
    172178    browsefilterclass *browsefilter = new browsefilterclass();
     
    179185    queryfilter->set_mgsearchptr (mgsearch);
    180186    cserver->add_filter (queryfilter);
    181 
     187   
    182188    // add a mg and gdbm source
    183189    mggdbmsourceclass *mggdbmsource = new mggdbmsourceclass ();
     
    196202  // add the protocol to the receptionist
    197203  recpt.add_protocol (&nproto);
    198 
     204 
    199205  // add other converters
    200206  utf8inconvertclass utf8inconvert;
     
    202208  recpt.add_converter ("u", &utf8inconvert, &utf8outconvert);
    203209
    204   mapinconvertclass gbinconvert;
    205   gbinconvert.setmapfile (GSDL_GSDLHOME, "gbku", 0x25a1);
    206   mapoutconvertclass gboutconvert;
    207   gboutconvert.setmapfile (GSDL_GSDLHOME, "ugbk", 0xa1f5);
    208   recpt.add_converter ("g", &gbinconvert, &gboutconvert);
     210  if (!gsdlhome.empty()) {
     211    mapinconvertclass gbinconvert;
     212    gbinconvert.setmapfile (gsdlhome, "gbku", 0x25a1);
     213    mapoutconvertclass gboutconvert;
     214    gboutconvert.setmapfile (gsdlhome, "ugbk", 0xa1f5);
     215    recpt.add_converter ("g", &gbinconvert, &gboutconvert);
     216  }
    209217
    210218  // the list of actions. Note: these actions will become invalid
  • trunk/gsdl/src/recpt/recptconfig.cpp

    r533 r963  
    2828/*
    2929   $Log$
     30   Revision 1.6  2000/02/21 21:55:33  sjboddie
     31   gsdlhome now comes from gsdlsite.cfg
     32
    3033   Revision 1.5  1999/09/07 04:56:59  sjboddie
    3134   added GPL notice
     
    6770
    6871// reads site configuration file returning true on success
    69 bool site_cfg_read (receptionist &recpt, const text_t &gsdlhome,
    70              const text_t &collection, int &maxrequests) {
     72// also sets gsdlhome and maxrequests
     73// gsdlsite.cfg should be in same directory as library executable
     74bool site_cfg_read (receptionist &recpt, text_t &gsdlhome, int &maxrequests) {
    7175
    72   maxrequests = 10000; // a reasonable default
     76  gsdlhome.clear();
    7377
    74   // Look for site.cfg in GSDLHOME/collect/collection-name/etc directory
    75   // (if this is for a particular collection), and then GSDLHOME/etc.
    76   text_t filename;
    77   if (!collection.empty()) {
    78     filename = filename_cat (gsdlhome, "collect");
    79     filename = filename_cat (filename, collection);
    80     filename = filename_cat (filename, "etc");
    81     filename = filename_cat (filename, "site.cfg");
    82     if (!file_exists (filename)) filename.clear();
    83   }
    84   if (filename.empty()) {
    85     filename = filename_cat (gsdlhome, "etc");
    86     filename = filename_cat (filename, "site.cfg");
    87     if (!file_exists (filename)) return false;
    88   }
    89 
    90   // read in the site configuration file
     78  // Look for gsdlsite.cfg in same directory that executable is in.
    9179  text_tarray cfgline;
    9280  text_t key;
    93   char *cstr = filename.getcstr();
    94   ifstream confin (cstr);
    95   delete cstr;
     81  ifstream confin ("gsdlsite.cfg");
    9682
    9783  if (confin) {
     
    10086    key = cfgline[0];
    10187    cfgline.erase(cfgline.begin());
    102 
     88   
    10389    if (key == "maxrequests") {
    10490      maxrequests = cfgline[0].getint();
    10591      if (maxrequests < 1) maxrequests = 1;
    10692    }
     93
     94    if (key == "gsdlhome")
     95      gsdlhome = cfgline[0];
    10796
    10897    // configure the receptionist
     
    116105}
    117106
     107// this version just grabs gsdlhome, returns false if it can't find it
     108bool site_cfg_read (text_t &gsdlhome) {
     109
     110  gsdlhome.clear();
     111
     112  // Look for gsdlsite.cfg in same directory that executable is in.
     113  text_tarray cfgline;
     114  text_t key;
     115  ifstream confin ("gsdlsite.cfg");
     116
     117  if (confin) {
     118    while (read_cfg_line(confin, cfgline) >= 0) {
     119      if (cfgline.size () >= 2) {
     120    if (cfgline[0] == "gsdlhome") {
     121      gsdlhome = cfgline[1];
     122      return true;
     123    }
     124      }
     125    }
     126    confin.close ();
     127  }
     128  return false;
     129}
    118130
    119131// main_cfg_read reads both main.cfg and collect.cfg. It attempts
  • trunk/gsdl/src/recpt/recptconfig.h

    r533 r963  
    3737
    3838// reads site configuration file returning true on success
    39 bool site_cfg_read (receptionist &recpt, const text_t &gsdlhome,
    40              const text_t &collection, int &maxrequests);
     39bool site_cfg_read (receptionist &recpt, text_t &gsdlhome, int &maxrequests);
     40bool site_cfg_read (text_t &gsdlhome);
    4141
    4242// main_cfg_read reads either collect.cfg or main.cfg and returning
     
    4444// collection is specified and then it tries to read in main.cfg
    4545bool main_cfg_read (receptionist &recpt, const text_t &gsdlhome,
    46              const text_t &collection);
     46            const text_t &collection);
    4747
    4848
Note: See TracChangeset for help on using the changeset viewer.