configpath defaults to .:/fat/people/drose:/usr/local/etc

This commit is contained in:
David Rose 2002-06-14 15:54:14 +00:00
parent 429c4aa079
commit 3bb494bbf0
2 changed files with 25 additions and 44 deletions

View File

@ -49,15 +49,7 @@ INLINE void ConfigTable::ConfigSuffixDefault(void) {
} }
INLINE void ConfigTable::ConfigPathDefault(void) { INLINE void ConfigTable::ConfigPathDefault(void) {
#ifdef PENV_PS2 configpath = "CFG_PATH";
// When this is empty, ReadConfigFile (ConfigTable.C) is forced
// to look in CONFIG_PATH compiler_flag (instead of env var)
configpath = "";
#else
configpath = "CONFIG_PATH";
#endif
} }
INLINE void ConfigTable::ConfigCmtDefault(void) { INLINE void ConfigTable::ConfigCmtDefault(void) {

View File

@ -120,45 +120,34 @@ void ConfigTable::ParseConfigFile(istream& is, const ConfigString& Filename)
} }
void ConfigTable::ReadConfigFile(void) { void ConfigTable::ReadConfigFile(void) {
if (configpath.empty()) { // The configpath variable lists the environment variables that
// themselves should be considered to contain search paths for
// Configrc files. This is one level of indirection from the
// intuitive definition.
#ifdef PENV_PS2 DSearchPath config_search;
while (!configpath.empty()) {
// roight. PS2 has no environment variables, so the config path int i = configpath.find_first_of(" ");
// has to be explicitly set with the CONFIG_PATH compiler variable. ConfigString stmp = configpath.substr(0, i);
// this is currently done in makefile.config.so... if (ExecutionEnvironment::has_environment_variable(stmp)) {
config_search.append_path(ExecutionEnvironment::get_environment_variable(stmp));
// CSN.
#ifndef CONFIG_PATH
#define CONFIG_PATH "."
#endif
configpath = CONFIG_PATH;
#else
configpath = ".";
#endif
} else {
ConfigString S;
while (!configpath.empty()) {
int i = configpath.find_first_of(" ");
ConfigString stmp = configpath.substr(0, i);
if (ExecutionEnvironment::has_environment_variable(stmp)) {
S += " ";
S += ExecutionEnvironment::get_environment_variable(stmp);
}
configpath.erase(0, i);
CropString(configpath);
} }
if (S.empty()) configpath.erase(0, i);
S = "."; CropString(configpath);
CropString(S); }
configpath = S;
if (config_search.is_empty()) {
// If we still have no directories on the search path, then at
// least search the current directory.
config_search.append_directory(".");
}
if (microconfig_cat->is_spam()) {
microconfig_cat->spam()
<< "search path from configpath is: "
<< config_search << endl;
} }
if (microconfig_cat->is_spam())
microconfig_cat->spam() << "evaluated value of configpath '"
<< configpath << "'" << endl;
DSearchPath config_search(configpath);
DSearchPath::Results config_files; DSearchPath::Results config_files;
if (!configsuffix.empty()) { if (!configsuffix.empty()) {