summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/configuration.cc
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/contrib/configuration.cc')
-rw-r--r--apt-pkg/contrib/configuration.cc32
1 files changed, 27 insertions, 5 deletions
diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc
index 7326b84ea..4e8586e83 100644
--- a/apt-pkg/contrib/configuration.cc
+++ b/apt-pkg/contrib/configuration.cc
@@ -182,9 +182,9 @@ string Configuration::FindFile(const char *Name,const char *Default) const
if (Itm == 0 || Itm->Value.empty() == true)
{
if (Default == 0)
- return "";
+ return rootDir;
else
- return Default;
+ return rootDir + Default;
}
string val = Itm->Value;
@@ -223,6 +223,25 @@ string Configuration::FindDir(const char *Name,const char *Default) const
return Res;
}
/*}}}*/
+// Configuration::FindVector - Find a vector of values /*{{{*/
+// ---------------------------------------------------------------------
+/* Returns a vector of config values under the given item */
+vector<string> Configuration::FindVector(const char *Name) const
+{
+ vector<string> Vec;
+ const Item *Top = Lookup(Name);
+ if (Top == NULL)
+ return Vec;
+
+ Item *I = Top->Child;
+ while(I != NULL)
+ {
+ Vec.push_back(I->Value);
+ I = I->Next;
+ }
+ return Vec;
+}
+ /*}}}*/
// Configuration::FindI - Find an integer value /*{{{*/
// ---------------------------------------------------------------------
/* */
@@ -521,6 +540,7 @@ bool ReadConfigFile(Configuration &Conf,const string &FName,bool AsSectional,
F.getline(Buffer,sizeof(Buffer) / 2);
Input += Buffer;
+ delete[] Buffer;
}
while (F.fail() && !F.eof());
@@ -581,9 +601,11 @@ bool ReadConfigFile(Configuration &Conf,const string &FName,bool AsSectional,
InQuote = !InQuote;
if (InQuote == true)
continue;
-
- if (*I == '/' && I + 1 != End && I[1] == '/')
- {
+
+ if ((*I == '/' && I + 1 != End && I[1] == '/') ||
+ (*I == '#' && strcmp(string(I,I+6).c_str(),"#clear") != 0 &&
+ strcmp(string(I,I+8).c_str(),"#include") != 0))
+ {
End = I;
break;
}