--- a/src/utils/conftree.cpp
+++ b/src/utils/conftree.cpp
@@ -14,9 +14,7 @@
* Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+#include "autoconfig.h"
#ifndef TEST_CONFTREE
@@ -70,7 +68,7 @@
}
{
- int ll = strlen(cline);
+ size_t ll = strlen(cline);
while (ll > 0 && (cline[ll-1] == '\n' || cline[ll-1] == '\r')) {
cline[ll-1] = 0;
ll--;
@@ -576,8 +574,8 @@
int ConfTree::get(const std::string &name, string &value, const string &sk)
const
{
- if (sk.empty() || sk[0] != '/') {
- // LOGDEB((stderr, "ConfTree::get: looking in global space\n"));
+ if (sk.empty() || !path_isabsolute(sk) ) {
+ // LOGDEB((stderr, "ConfTree::get: looking in global space for sk [%s]\n", sk.c_str()));
return ConfSimple::get(name, value, sk);
}
@@ -590,15 +588,21 @@
// Look in subkey and up its parents until root ('')
for (;;) {
- // LOGDEB((stderr,"ConfTree::get: looking for '%s' in '%s'\n",
- // name.c_str(), msk.c_str()));
+ // LOGDEB((stderr,"ConfTree::get: looking for '%s' in '%s'\n",
+ // name.c_str(), msk.c_str()));
if (ConfSimple::get(name, value, msk))
return 1;
string::size_type pos = msk.rfind("/");
if (pos != string::npos) {
msk.replace(pos, string::npos, string());
- } else
+ } else {
+#ifdef _WIN32
+ if (msk.size() == 2 && isalpha(msk[0]) && msk[1] == ':')
+ msk.clear();
+ else
+#endif
break;
+ }
}
return 0;
}