]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/contrib/configuration.cc
merge patch from Daniel Hartwig to Show a error message if {,dist-}upgrade is used...
[apt.git] / apt-pkg / contrib / configuration.cc
index ce02f1bd22e73e76b16b8c41f23454a3261d3e21..31cd9f8adc25efa0a4d6cf9a3bfd2f3a5105ee3b 100644 (file)
@@ -194,7 +194,11 @@ string Configuration::FindFile(const char *Name,const char *Default) const
 
         // Absolute
         if (val.length() >= 1 && val[0] == '/')
+        {
+           if (val.compare(0, 9, "/dev/null") == 0)
+              val.erase(9);
            break;
+        }
 
         // ~/foo or ./foo
         if (val.length() >= 2 && (val[0] == '~' || val[0] == '.') && val[1] == '/')
@@ -230,7 +234,12 @@ string Configuration::FindDir(const char *Name,const char *Default) const
 {
    string Res = FindFile(Name,Default);
    if (Res.end()[-1] != '/')
+   {
+      size_t const found = Res.rfind("/dev/null");
+      if (found != string::npos && found == Res.size() - 9)
+        return Res; // /dev/null returning
       return Res + '/';
+   }
    return Res;
 }
                                                                        /*}}}*/
@@ -411,6 +420,18 @@ void Configuration::Clear(string const &Name, string const &Value)
       }
    }
      
+}
+                                                                       /*}}}*/
+// Configuration::Clear - Clear everything                             /*{{{*/
+// ---------------------------------------------------------------------
+void Configuration::Clear()
+{
+   const Configuration::Item *Top = Tree(0);
+   while( Top != 0 )
+   {
+      Clear(Top->FullTag());
+      Top = Top->Next;
+   }
 }
                                                                        /*}}}*/
 // Configuration::Clear - Clear an entire tree                         /*{{{*/
@@ -949,7 +970,7 @@ Configuration::MatchAgainstConfig::MatchAgainstConfig(char const * Config)
         continue;
       }
    }
-   if (strings.size() == 0)
+   if (strings.empty() == true)
       patterns.push_back(NULL);
 }
                                                                        /*}}}*/