diff options
author | Michael Vogt <mvo@debian.org> | 2014-05-07 17:55:10 +0200 |
---|---|---|
committer | Michael Vogt <mvo@debian.org> | 2014-05-07 17:55:10 +0200 |
commit | 38d2959ffb8c6f5f291b2910014a67b1b352ab4c (patch) | |
tree | c5977b8f34aaf973ed3956952ec3ff43ac59f143 /apt-pkg/contrib/configuration.cc | |
parent | fce69e7a0f38299c57ef96ae1c1dd9a5379bfd5a (diff) | |
parent | 3fa4e98f62e469f4292d2811b4e15f4afb678fbd (diff) |
Merge branch 'debian/sid' into debian/experimental
Conflicts:
apt-pkg/cachefilter.h
apt-pkg/contrib/fileutl.cc
apt-pkg/contrib/netrc.h
apt-pkg/deb/debsrcrecords.cc
apt-pkg/init.h
apt-pkg/pkgcache.cc
debian/apt.install.in
debian/changelog
Diffstat (limited to 'apt-pkg/contrib/configuration.cc')
-rw-r--r-- | apt-pkg/contrib/configuration.cc | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc index 4ef4663c0..00f6ad0f9 100644 --- a/apt-pkg/contrib/configuration.cc +++ b/apt-pkg/contrib/configuration.cc @@ -21,10 +21,18 @@ #include <apt-pkg/error.h> #include <apt-pkg/strutl.h> #include <apt-pkg/fileutl.h> - +#include <apt-pkg/macros.h> + +#include <ctype.h> +#include <regex.h> +#include <stddef.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <algorithm> +#include <string> #include <vector> #include <fstream> -#include <iostream> #include <apti18n.h> @@ -42,8 +50,7 @@ Configuration::Configuration() : ToFree(true) } Configuration::Configuration(const Item *Root) : Root((Item *)Root), ToFree(false) { -}; - +} /*}}}*/ // Configuration::~Configuration - Destructor /*{{{*/ // --------------------------------------------------------------------- @@ -246,12 +253,18 @@ string Configuration::FindDir(const char *Name,const char *Default) const // 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 +#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR < 13) +vector<string> Configuration::FindVector(const char *Name) const { return FindVector(Name, ""); } +#endif +vector<string> Configuration::FindVector(const char *Name, std::string const &Default) const { vector<string> Vec; const Item *Top = Lookup(Name); if (Top == NULL) - return Vec; + return VectorizeString(Default, ','); + + if (Top->Value.empty() == false) + return VectorizeString(Top->Value, ','); Item *I = Top->Child; while(I != NULL) @@ -259,6 +272,9 @@ vector<string> Configuration::FindVector(const char *Name) const Vec.push_back(I->Value); I = I->Next; } + if (Vec.empty() == true) + return VectorizeString(Default, ','); + return Vec; } /*}}}*/ |