Changeset 10035


Ignore:
Timestamp:
2005-06-09T17:16:32+12:00 (19 years ago)
Author:
mdewsnip
Message:

Removed the unnecessary PATH setting code and tidied up the rest of the init() function.

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

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/recpt/gsdl_modules_cfg.h

    r10018 r10035  
    5454#define GSDL_USE_COLLECTOR_ACTION
    5555#define GSDL_USE_EXTLINK_ACTION
    56 #undef GSDL_USE_GTI_ACTION
     56#define GSDL_USE_GTI_ACTION
    5757#define GSDL_USE_PHIND_ACTION
    5858#define GSDL_USE_PING_ACTION
  • trunk/gsdl/src/recpt/gtiaction.cpp

    r10032 r10035  
    6868gtiaction::~gtiaction()
    6969{
    70   // Nothing to do in destructor
    71 }
    72 
    73 
    74 
    75 bool gtiaction::init (ostream & /*logout*/)
    76 {
    77   // set up GSDLOS, GSDLHOME and PATH environment variables
    78   text_t gsdlos, path;
    79   unsigned int path_separator = ':';
     70  delete[] set_gsdlhome_cstr;
     71  delete[] set_gsdlos_cstr;
     72}
     73
     74
     75
     76bool gtiaction::init (ostream& /*logout*/)
     77{
     78  // Set GSDLHOME and GSDLOS environment variables
     79  text_t set_gsdlhome = "GSDLHOME=" + gsdlhome;
     80  text_t set_gsdlos = "GSDLOS=";
    8081
    8182#if defined (__WIN32__)
    82   gsdlos = "windows";
    83   path_separator = ';';
    84 
    85   path = filename_cat(gsdlhome, "bin", "windows", "perl", "bin;");
    86 
     83  set_gsdlos += "windows";
    8784#else
    8885  struct utsname *buf = new struct utsname();
    89   int i = uname (buf);
    90   if (i == -1) gsdlos = "linux"; // uname failed
    91   else gsdlos.setcstr (buf->sysname);
     86  if (uname(buf) == -1) {
     87    // uname failed, so this must be linux
     88    set_gsdlos += "linux";
     89  }
     90  else {
     91    text_t gsdlos = buf->sysname;
     92    lc(gsdlos);
     93    set_gsdlos += gsdlos;
     94  }
    9295  delete buf;
    93   lc (gsdlos);
    9496#endif
    9597
    96   pathc = getenv ("PATH");
    97   path += filename_cat (gsdlhome, "bin", gsdlos);
    98   path.push_back (path_separator);
    99   path += filename_cat (gsdlhome, "bin", "script");
    100   if (pathc != NULL) {
    101     path.push_back (path_separator);
    102     path += pathc;
    103   }
    104   path = "PATH=" + path;
    105 
    106   gsdlos = "GSDLOS=" + gsdlos;
    107   text_t setgsdlhome = "GSDLHOME=" + gsdlhome;
    108 
    109   // these will be cleaned up in the destructor
    110   gsdlosc = gsdlos.getcstr();
    111   gsdlhomec = setgsdlhome.getcstr();
    112   pathc = path.getcstr();
    113  
    114   putenv (gsdlosc);
    115   putenv (gsdlhomec);
    116   putenv (pathc);
     98  // These will be cleaned up in the destructor
     99  set_gsdlhome_cstr = set_gsdlhome.getcstr();
     100  set_gsdlos_cstr = set_gsdlos.getcstr();
     101  putenv(set_gsdlhome_cstr);
     102  putenv(set_gsdlos_cstr);
    117103
    118104  return true;
     
    130116
    131117  // Authenticate the user before allowing modifications
    132   // logout << "Must authenticate for language " + args["tlc"] + "!" << endl;
    133118  args["uan"] = 1;
    134119  args["ug"] = "langadmin_" + args["tlc"];
  • trunk/gsdl/src/recpt/gtiaction.h

    r10027 r10035  
    6565  receptionist *recpt;
    6666
    67   // package whose contents will be displayed in the form space
    68   char *gsdlosc;
    69   char *gsdlhomec;
    70   char *pathc;
     67  char* set_gsdlhome_cstr;
     68  char* set_gsdlos_cstr;
    7169
    7270public:
Note: See TracChangeset for help on using the changeset viewer.