From 50c409c42a971c6e8a25cb32a87992474247834b Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 4 Sep 2009 19:32:45 +0200 Subject: add a helper to easily get a vector of strings from the configuration --- apt-pkg/contrib/configuration.cc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'apt-pkg/contrib/configuration.cc') diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc index 48a5f0bff..b83ece3e4 100644 --- a/apt-pkg/contrib/configuration.cc +++ b/apt-pkg/contrib/configuration.cc @@ -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 Configuration::FindVector(const char *Name) const +{ + vector 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 /*{{{*/ // --------------------------------------------------------------------- /* */ -- cgit v1.2.3 From c914647fb05653878a14ae391f52b5e94cc73b26 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 7 Sep 2009 14:59:19 +0200 Subject: reintroduce #clear and #include in the config files, they there broken since 0.7.21 with the introduction of #-comments --- apt-pkg/contrib/configuration.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'apt-pkg/contrib/configuration.cc') diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc index b83ece3e4..4e8586e83 100644 --- a/apt-pkg/contrib/configuration.cc +++ b/apt-pkg/contrib/configuration.cc @@ -601,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] == '/') || *I == '#') - { + + 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; } -- cgit v1.2.3